Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Update generate_localized.dart #31

Closed
wants to merge 2 commits into from
Closed

Conversation

devoncarew
Copy link
Contributor

Fix two analysis warnings:

unused_element: The top level variable '_keepAnalysisHappy' isn't used.
non_constant_identifier_names: Name non-constant identifiers using lowerCamelCase.

@alan-knight, these show up in Flutter user code, including in the examples for the flutter website (flutter/website#1036).

@googlebot googlebot added the cla: yes Google CLA signed label Jun 1, 2018
@alan-knight
Copy link
Contributor

The analyzer should not be trying to apply warnings to generated code, where the user can arbitrarily change settings and invalidate code that the user of the application can't do anything about. dart-lang/sdk#57261 although that's more the linter than analysis in general.

The _keepAnalysisHappy variable is introduced precisely to fix this kind of problem, and it has a //ignore comment on it. The generated code may or may not use the defaultLocale, depending on what it's generating, so sometimes it would complain about that as being undefined.

@devoncarew
Copy link
Contributor Author

I now remember we've had a few issues discussion the topic :)

I don't think we should endeavor to have generated code clean of lint issues where the lints are very subjective.

Where the specific lints are used much more commonly, have low-false positive lints for common user issues, or are validating some recommended style guides, I think we should try and have generated code warning clean, or, have a clear reason why we should have an exception for the specific generated file.

Let me update this PR a bit to eliminate the warning for Intl.defaultLocale, in a way that just turns off the analyzer warning.

@devoncarew
Copy link
Contributor Author

I updated this to use the ~newer ignore_for_file analyzer directive.

@devoncarew devoncarew closed this Aug 21, 2019
alan-knight pushed a commit to dart-archive/intl that referenced this pull request Aug 26, 2019
Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating dart-archive/intl_translation#31 but then expanded.

PiperOrigin-RevId: 264686901
alan-knight pushed a commit to dart-archive/intl that referenced this pull request Aug 26, 2019
*** Reason for rollback ***

Google Fiber application doesn't build: https://test.corp.google.com/ui#cl=264686901

*** Original change description ***

Make Intl generated code pass most current lint options
Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating dart-archive/intl_translation#31 but then expanded.

***

PiperOrigin-RevId: 264727285
alan-knight pushed a commit to dart-archive/intl that referenced this pull request Aug 26, 2019
Trying this again, but reverted the "new" removal and one additional type in generated code, as the generated code is used in Dart 1 projects that are still active.

Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating dart-archive/intl_translation#31 but then expanded.
Cloned from CL 264686901 by 'g4 patch'.
Original change by alanknight@alanknight:intl_maintenance:290:citc on 2019/08/21 14:02:13.

PiperOrigin-RevId: 264925581
alan-knight pushed a commit that referenced this pull request Aug 26, 2019
Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating #31 but then expanded.

PiperOrigin-RevId: 264686901
alan-knight pushed a commit that referenced this pull request Aug 26, 2019
*** Reason for rollback ***

Google Fiber application doesn't build: https://test.corp.google.com/ui#cl=264686901

*** Original change description ***

Make Intl generated code pass most current lint options
Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating #31 but then expanded.

***

PiperOrigin-RevId: 264727285
alan-knight pushed a commit that referenced this pull request Aug 26, 2019
Trying this again, but reverted the "new" removal and one additional type in generated code, as the generated code is used in Dart 1 projects that are still active.

Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating #31 but then expanded.
Cloned from CL 264686901 by 'g4 patch'.
Original change by alanknight@alanknight:intl_maintenance:290:citc on 2019/08/21 14:02:13.

PiperOrigin-RevId: 264925581
@kevmoo kevmoo deleted the devoncarew-patch-1 branch March 8, 2022 16:58
mosuem pushed a commit to dart-lang/i18n that referenced this pull request Mar 2, 2023
Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating dart-archive/intl_translation#31 but then expanded.

PiperOrigin-RevId: 264686901
mosuem pushed a commit to dart-lang/i18n that referenced this pull request Mar 2, 2023
*** Reason for rollback ***

Google Fiber application doesn't build: https://test.corp.google.com/ui#cl=264686901

*** Original change description ***

Make Intl generated code pass most current lint options
Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating dart-archive/intl_translation#31 but then expanded.

***

PiperOrigin-RevId: 264727285
mosuem pushed a commit to dart-lang/i18n that referenced this pull request Mar 2, 2023
Trying this again, but reverted the "new" removal and one additional type in generated code, as the generated code is used in Dart 1 projects that are still active.

Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating dart-archive/intl_translation#31 but then expanded.
Cloned from CL 264686901 by 'g4 patch'.
Original change by alanknight@alanknight:intl_maintenance:290:citc on 2019/08/21 14:02:13.

PiperOrigin-RevId: 264925581
mosuem pushed a commit to dart-lang/i18n that referenced this pull request Mar 2, 2023
Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating dart-archive/intl_translation#31 but then expanded.

PiperOrigin-RevId: 264686901
mosuem pushed a commit to dart-lang/i18n that referenced this pull request Mar 2, 2023
*** Reason for rollback ***

Google Fiber application doesn't build: https://test.corp.google.com/ui#cl=264686901

*** Original change description ***

Make Intl generated code pass most current lint options
Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating dart-archive/intl_translation#31 but then expanded.

***

PiperOrigin-RevId: 264727285
mosuem pushed a commit to dart-lang/i18n that referenced this pull request Mar 2, 2023
Trying this again, but reverted the "new" removal and one additional type in generated code, as the generated code is used in Dart 1 projects that are still active.

Mostly using ignore_for_file, but fixing a few of the most obvious issues
Started out as integrating dart-archive/intl_translation#31 but then expanded.
Cloned from CL 264686901 by 'g4 patch'.
Original change by alanknight@alanknight:intl_maintenance:290:citc on 2019/08/21 14:02:13.

PiperOrigin-RevId: 264925581
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Google CLA signed
Development

Successfully merging this pull request may close these issues.

3 participants