Skip to content

Mark generated code as ignored by linter #70

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

Closed
patkujawa-wf opened this issue Apr 25, 2018 · 11 comments
Closed

Mark generated code as ignored by linter #70

patkujawa-wf opened this issue Apr 25, 2018 · 11 comments

Comments

@patkujawa-wf
Copy link

Unless we can get all the generated code to abide by all the rules.

See dart-lang/sdk#57261 for some options. Perhaps just // ignore_for_file: linter_rule in each generated file?

@davidmarne
Copy link
Contributor

davidmarne commented Apr 25, 2018

So in the dart2 dev branch you can set this by setting the header option in your build.yaml

targets:
  $default:
    builders:
      built_value_generator|built_value:
        enabled: false
    builders:
      built_redux|built_redux:
        options:
          header: // ignore_for_file: linter_rule

However, that will only work with dart 2.

If there are any specific lints you are having issues with post them here and I can just add them to all generated files for stable line.

@patkujawa-wf
Copy link
Author

From https://github.com/Workiva/text_doc_client/pull/2242:

annotate_overrides
avoid_as
overridden_fields

@davidmarne
Copy link
Contributor

will add tonight

@zoechi
Copy link
Contributor

zoechi commented Apr 27, 2018

@patkujawa-wf isn't aviod_as outdated, especially with Dart 2?

@patkujawa-wf
Copy link
Author

Not everyone is on Dart 2 yet ;)

@davidmarne
Copy link
Contributor

Sorry was busy last night, i shouldn't be making promises :)

Will try add this weekend.

@patkujawa-wf
Copy link
Author

No rush, but thanks Dave!

@kostaa
Copy link

kostaa commented Jun 4, 2018

I have tried setting the header option in the build.yaml but getting an exception from the parser.
I am running it with Dart 2.0.0-dev.54.0 version.

D:\repo__at\_moneyvore_rdx>flutter packages pub run build_runner build --delete-conflicting-outputs
[INFO] Generating build script...
Unhandled exception:
Error on line 9, column 38: Mapping values are not allowed here. Did you miss a colon earlier?
          header: /// ignore_for_file: linter_rule
                                     ^
#0      Scanner._fetchValue (package:yaml/src/scanner.dart:713:9)
dart-lang/sdk#57147      Scanner._fetchNextToken (package:yaml/src/scanner.dart:457:11)
dart-lang/sdk#57148      Scanner._fetchMoreTokens (package:yaml/src/scanner.dart:339:7)
dart-lang/sdk#57149      Scanner.peek (package:yaml/src/scanner.dart:317:27)
dart-lang/sdk#57150      Parser._parseBlockMappingKey (package:yaml/src/parser.dart:418:26)

@zoechi
Copy link
Contributor

zoechi commented Jun 4, 2018

@kostaa Have you tried wrapping the string with quotes?

header: "/// ignore_for_file: linter_rule"

@kostaa
Copy link

kostaa commented Jun 4, 2018

Thanks using quotes helps but you also have to drop the second builders: key.

targets:
  $default:
    builders:
      built_value_generator|built_value:
        enabled: false
      built_redux|built_redux:
        options:
          header: "// ignore_for_file: linter_rule"

@davidmarne
Copy link
Contributor

#82

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

No branches or pull requests

4 participants