Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H-2444: Add Turbine from BP incubator #56

Merged
merged 4 commits into from
Apr 17, 2024
Merged

H-2444: Add Turbine from BP incubator #56

merged 4 commits into from
Apr 17, 2024

Conversation

vilkinsons
Copy link
Member

@vilkinsons vilkinsons commented Apr 9, 2024

Ports across @indietyp's work on turbine from the blockprotocol/incubator repository.

@vilkinsons vilkinsons self-assigned this Apr 9, 2024
@vilkinsons vilkinsons requested a review from indietyp April 9, 2024 07:49
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

.filter_map(|(k, v)| k.as_str().map(|k| (k.to_owned(), v.into())))
.collect();

Self::from(properties)

Check failure

Code scanning / clippy

the trait bound turbine::entity::EntityProperties: core::convert::From<hashbrown::HashMap<alloc::string::String, serde_json::Value>> is not satisfied Error

the trait bound turbine::entity::EntityProperties: core::convert::From<hashbrown::HashMap<alloc::string::String, serde_json::Value>> is not satisfied
use petgraph::{graph::NodeIndex, Graph};
use turbine::{
entity::{Entity, EntityId, LinkData},
VersionedUrl, VersionedUrlRef,

Check warning

Code scanning / clippy

unused import: VersionedUrl Warning

unused import: VersionedUrl

#[derive(Debug, Copy, Clone)]
pub(crate) struct Node<'a> {
id: &'a VersionedUrl,

Check warning

Code scanning / clippy

fields id and kind are never read Warning

fields id and kind are never read
}

#[derive(Debug, Copy, Clone)]
pub(crate) struct Node<'a> {

Check warning

Code scanning / clippy

fields id and kind are never read Warning

fields id and kind are never read
#[derive(Debug, Copy, Clone)]
pub(crate) struct Node<'a> {
id: &'a VersionedUrl,
kind: NodeKind,

Check warning

Code scanning / clippy

fields id and kind are never read Warning

fields id and kind are never read
&self.links
}

pub(crate) fn should_skip(&self, url: &VersionedUrl) -> bool {

Check warning

Code scanning / clippy

unused self argument Warning

unused self argument
Comment on lines +18 to +20
pub(crate) fn links(&self) -> &HashSet<VersionedUrl> {
&self.links
}

Check warning

Code scanning / clippy

this could be a const fn Warning

this could be a const fn
.as_ref()
.unwrap_or(&location.name.value);
let mut type_name = Ident::new(type_name_raw, Span::call_site()).to_token_stream();
let owned_type_name = type_name.clone();

Check warning

Code scanning / clippy

redundant clone Warning

redundant clone
.unwrap_or(&location.name.value);
let mut type_name = Ident::new(type_name_raw, Span::call_site()).to_token_stream();
let owned_type_name = type_name.clone();
let mut anon_type_name = type_name.clone();

Check warning

Code scanning / clippy

redundant clone Warning

redundant clone
Comment on lines +597 to +606
let body = match self.variant {
Variant::Ref => {
self.state.import.box_ = true;
quote!((#vis Box<[#inner #lifetime]>))
}
_ => {
self.state.import.vec = true;
quote!((#vis Vec<#inner #lifetime>))
}
};

Check warning

Code scanning / clippy

you seem to be trying to use match for an equality check. Consider using if Warning

you seem to be trying to use match for an equality check. Consider using if
Variant::Mut => quote!(TypeMut),
Variant::Owned => panic!("cannot call into_owned on the owned type!"),
},
ConversionFunction::AsRef => quote!(Type),

Check warning

Code scanning / clippy

this match arm has an identical body to another arm Warning

this match arm has an identical body to another arm
Comment on lines +278 to +297
let apply = match kind {
PropertyKind::Array => {
quote! {
let serde_json::Value::Array(value) = value else {
return false;
};

for value in value {
if !<#type_>::is_valid_value(value) {
return false;
}
}
}
}
_ => quote! {
if !<#type_>::is_valid_value(value) {
return false;
}
},
};

Check warning

Code scanning / clippy

you seem to be trying to use match for destructuring a single pattern. Consider using if let Warning

you seem to be trying to use match for destructuring a single pattern. Consider using if let
Copy link
Member

@indietyp indietyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I can take a look at the lint errors either in this PR or a subsequent one.

@vilkinsons vilkinsons merged commit b80a5db into main Apr 17, 2024
7 of 15 checks passed
@vilkinsons vilkinsons deleted the dw/turbine branch April 17, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants