-
Notifications
You must be signed in to change notification settings - Fork 3
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
update linting configurations #35
Conversation
@@ -10,6 +10,7 @@ import { | |||
// Configure arguments here. | |||
const lintArgs = [ | |||
'-Zunstable-options', | |||
'--all-targets', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to add --all-features
here as well, but looks like maybe we're not configuring kaigan
serde support properly?
the trait `generated::accounts::address_lookup_table::_::_serde::Deserialize<'_>` is not implemented for `kaigan::types::U64PrefixVec<solana_program::pubkey::Pubkey>`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nvm, I added the fix for this. But I found another clippy error for the Anchor one.
expected `anchor_lang::prelude::Pubkey`, found `solana_program::pubkey::Pubkey`
| help: change the output type to match the trait: `anchor_lang::prelude::Pubkey`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need to adjust the renderer @lorisleiva so that it uses more Anchor-compatible types, or can somehow tell rustc that the types are the same. Maybe it's a versioning thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not sure I understand what you'd like to adjust. Could you share the bit of code that is causing this clippy error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a clippy error that arises if you pass --all-features
, which runs lint on the anchor
feature.
Looks like it's because Anchor 0.30 runs solana-program
v1.16.
https://github.com/coral-xyz/anchor/blob/852fcc77beb6302474a11e0f8e6f1e688021be36/lang/Cargo.toml#L60
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I guess we just have to make sure create-solana-program generates a template with compatible SDK versions for Anchor, or remove the Anchor support from the base template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see what you mean.
The way create-solana-program
figures out versioning is by checking the version of your local binaries. So if you end up with incompatible versions, it should mean that the versions you had locally were incompatible at the time of generating the repo.
Recently, we added a new option on the Rust renderer that turns off any Anchor-related traits so you don't need to have any dependency on Anchor. So maybe we should use that here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh perfect! I just added the new renderer.
@@ -10,7 +10,7 @@ license-file = "../../LICENSE" | |||
[features] | |||
anchor = ["dep:anchor-lang"] | |||
test-sbf = [] | |||
serde = ["dep:serde", "dep:serde_with"] | |||
serde = ["dep:serde", "dep:serde_with", "kaigan/serde"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lorisleiva this optional feature-flag for kaigan
is only necessary when the user adds kaigan
types to the repository. This is a manual step, right? Would they be configuring Codama to use kaigan
as well?
Asking because it doesn't seem like there's a good place to work this into create-solana-program.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is a manual step that you only need to do if you end up using more complex types that are defined in Kaigan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Just a little question about the ignore cfgs
6658690
to
83a9637
Compare
Summary of Changes
Adds a config to the program's manifest for ignoring
unexpected_cfg
(liketarget_os = "solana"
). Also adjusts the linting scripts to cover all targets and features.