Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Ignore non_constant_identifier_names, camel_case_types in generated (.g.dart) files #222

Closed
vinicentus opened this issue Nov 25, 2021 · 5 comments · Fixed by #223
Closed

Comments

@vinicentus
Copy link
Contributor

I would like to propose that we automatically include the comment // ignore_for_file: non_constant_identifier_names, camel_case_types in the beginning of every file generated using pub run build_runner build. That way, dart doesn't complain about Name non-constant identifiers using lowerCamelCase and Name types using UpperCamelCase. The rationale behind this suggestion is that the smart contracts, written in another language and perhaps with other naming conventions, shouldn't have to conform to dart's standards, as long as they still work.
This would be especially useful in large projects with multiple contract classes.

If you think this suggestion makes sense, I can create a PR.

RELATED:
Naming can however become a problem, as is evident in #213. In that special case, functions outright won't be acessible from outside the file. Then we might need to actually rename a function (starting with _), or create a public wrapper funtion.

@simolus3
Copy link
Owner

You can also ignore generated files with an analysis_options.yaml file:

analyzer:
  exclude: 
    - '**/*.g.dart'

@vinicentus
Copy link
Contributor Author

vinicentus commented Nov 25, 2021

Yes. That is much cleaner. This probably has to be added manually on a case-by-case basis though? So maybe it could be added to the documentation as an option?

@simolus3
Copy link
Owner

This sounds like something the readme could point out, yes :) Do you want to open a PR for that?

@vinicentus
Copy link
Contributor Author

Sure, can do that tomorrow

vinicentus added a commit to vinicentus/web3dart that referenced this issue Nov 26, 2021
Add note about suppressing analyzer warnings for generated files.

Closes simolus3#222
@vinicentus
Copy link
Contributor Author

Created a PR

simolus3 pushed a commit that referenced this issue Nov 26, 2021
Add note about suppressing analyzer warnings for generated files.

Closes #222
mjkim pushed a commit to mjkim/web3dart that referenced this issue Dec 10, 2021
Add note about suppressing analyzer warnings for generated files.

Closes simolus3#222

(cherry picked from commit 4b809ec)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants