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

Use the sharezone_lints for all packages. #37

Closed
Jonas-Sander opened this issue Sep 11, 2021 · 4 comments · Fixed by #957
Closed

Use the sharezone_lints for all packages. #37

Jonas-Sander opened this issue Sep 11, 2021 · 4 comments · Fixed by #957
Labels
code quality Code quality itself (readable) but e.g. also how we might enforce better quality automatically. technical debt

Comments

@Jonas-Sander
Copy link
Collaborator

E.g. the lint package.

@Jonas-Sander
Copy link
Collaborator Author

We might also need to use different options for only dart packages, flutter packages and might need to differentiate between packages and the app (the app does not need to put docs on all exported members but this might be beneficial for the packages).

@Jonas-Sander Jonas-Sander added code quality Code quality itself (readable) but e.g. also how we might enforce better quality automatically. technical debt labels Jan 31, 2022
@nilsreichardt
Copy link
Member

It should be fixed with #37

@Jonas-Sander
Copy link
Collaborator Author

It should be fixed with #37

Should be fixed with what? #37 is this issue.
Also some packages had different analysis_options from what I remember so we would have to fix some lints to achieve this I think

@nilsreichardt nilsreichardt reopened this Feb 22, 2023
@nilsreichardt
Copy link
Member

Oh, I wanted to use #316. However, we can still keep this issue open and maybe change the title to use something like "Use sharezone_lints in all package"

nilsreichardt added a commit that referenced this issue Feb 22, 2023
The package `sharezone_utils` uses now our `sharezone_lints` package.

Part of #37
@nilsreichardt nilsreichardt changed the title Use the same analysis_options.yaml for all packages. Use the sharezone_lints for all packages. Mar 6, 2023
nilsreichardt added a commit that referenced this issue Mar 6, 2023
I fixed the following warnings with this PR:

```
Analyzing time...                                                       

   info • Use 'const' for final variables initialized to a constant value • lib/src/time.dart:86:5 • prefer_const_declarations
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:114:51 • prefer_const_constructors
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:115:51 • prefer_const_constructors
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:116:52 • prefer_const_constructors
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:117:52 • prefer_const_constructors
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:122:26 • prefer_const_constructors
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:126:26 • prefer_const_constructors
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:130:26 • prefer_const_constructors
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:136:12 • prefer_const_constructors
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:137:12 • prefer_const_constructors
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:138:12 • prefer_const_constructors
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:139:12 • prefer_const_constructors
   info • Use 'const' with the constructor to improve performance • test/time_test.dart:149:7 • prefer_const_constructors

13 issues found. (ran in 1.4s)
```

Part of #37
nilsreichardt added a commit that referenced this issue Mar 6, 2023
I resolved the following warnings in this PR:

```
Nils-MBP-13-M1-3:url_launcher_extended nils$ flutter analyze
Analyzing url_launcher_extended...                                      

   info • The local variable '_canLaunch' starts with an underscore • lib/src/url_launcher_extended.dart:70:11 •
          no_leading_underscores_for_local_identifiers
   info • The local variable '_canLaunch' starts with an underscore • lib/src/url_launcher_extended.dart:119:11 •
          no_leading_underscores_for_local_identifiers
   info • The parameter name 'o' doesn't match the name 'other' in the overridden method • lib/src/url_launcher_extended.dart:136:27 •
          avoid_renaming_method_parameters
   info • The parameter name 'o' doesn't match the name 'other' in the overridden method • lib/src/url_launcher_extended.dart:160:27 •
          avoid_renaming_method_parameters
   info • Can't use a relative path to import a library in 'lib' • test/mock_url_launcher_extended_test.dart:12:8 • avoid_relative_lib_imports

5 issues found. (ran in 0.9s)
```

Part of #37
nilsreichardt added a commit that referenced this issue Mar 6, 2023
Things I needed to fix:

```
Analyzing util...                      0.7s

   info • lib/src/encryption/rsa_pem.dart:21:9 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:23:24 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:24:18 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:29:23 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:29:40 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:31:21 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:32:13 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:39:18 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:40:20 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:42:24 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:44:12 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:48:18 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:49:21 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:51:24 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:53:12 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:76:24 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:77:28 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:80:9 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:84:24 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:88:9 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:90:23 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:101:24 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:102:28 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:105:9 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:109:25 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:132:9 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new
   info • lib/src/encryption/rsa_pem.dart:134:23 • Unnecessary 'new' keyword. Try removing the 'new' keyword. • unnecessary_new

27 issues found.
```

I just used `dart fix --apply` & `dart format .`.

Part of #37
nilsreichardt added a commit that referenced this issue Mar 8, 2023
This PR fixes the following warnings:

```
Analyzing notifications...                                              

   info • Use the generic function type syntax in 'typedef's • lib/src/action_registration.dart:24:24 • prefer_generic_function_type_aliases
   info • The imported package 'meta' isn't a dependency of the importing package • lib/src/instrumentation.dart:9:8 •
          depend_on_referenced_packages
   info • The local variable '_instrumentation' starts with an underscore • lib/src/notification_parser.dart:21:50 •
          no_leading_underscores_for_local_identifiers
   info • The imported package 'collection' isn't a dependency of the importing package • lib/src/push_notification.dart:9:8 •
          depend_on_referenced_packages
   info • Unnecessary 'this.' qualifier • lib/src/push_notification.dart:51:8 • unnecessary_this
   info • The local variable '_other' starts with an underscore • lib/src/push_notification_action_handler.dart:216:43 •
          no_leading_underscores_for_local_identifiers
   info • The local variable '_duplicates' starts with an underscore • lib/src/push_notification_action_handler.dart:223:29 •
          no_leading_underscores_for_local_identifiers
   info • Don't invoke 'print' in production code • test/docs_example_test.dart:24:9 • avoid_print
   info • Use 'const' with the constructor to improve performance • test/docs_example_test.dart:36:7 • prefer_const_constructors

9 issues found. (ran in 1.4s)
```

Part of #37
nilsreichardt added a commit that referenced this issue Mar 8, 2023
Fixes as well:

```
Analyzing sharezone_common...                                           

   info • Don't invoke 'print' in production code • lib/src/api_errors/api_errors.dart:220:9 • avoid_print
   info • Statements in an if should be enclosed in a block • lib/src/api_errors/api_errors.dart:240:5 •
          curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/api_errors/api_errors.dart:242:5 •
          curly_braces_in_flow_control_structures
   info • Statements in a for should be enclosed in a block • lib/src/database_foundation.dart:79:11 • curly_braces_in_flow_control_structures
   info • Statements in a for should be enclosed in a block • lib/src/database_foundation.dart:81:11 • curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/database_foundation.dart:85:11 • curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/database_foundation.dart:87:11 • curly_braces_in_flow_control_structures
   info • Statements in a for should be enclosed in a block • lib/src/database_foundation.dart:89:11 • curly_braces_in_flow_control_structures
   info • Statements in a for should be enclosed in a block • lib/src/database_foundation.dart:91:11 • curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/database_foundation.dart:104:43 •
          curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/database_foundation.dart:105:7 • curly_braces_in_flow_control_structures
   info • Statements in a for should be enclosed in a block • lib/src/database_foundation.dart:110:7 • curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/database_foundation.dart:150:7 • curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/database_foundation.dart:156:7 • curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/database_foundation.dart:158:7 • curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/database_foundation.dart:165:7 • curly_braces_in_flow_control_structures
   info • Statements in a for should be enclosed in a block • lib/src/database_foundation.dart:223:9 • curly_braces_in_flow_control_structures
   info • Statements in a for should be enclosed in a block • lib/src/database_foundation.dart:225:9 • curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/database_foundation.dart:237:43 •
          curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/database_foundation.dart:238:7 • curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/helper_functions.dart:19:5 • curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/helper_functions.dart:29:5 • curly_braces_in_flow_control_structures
   info • Unnecessary escape in string literal • lib/src/helper_functions.dart:50:45 • unnecessary_string_escapes

23 issues found. (ran in 1.6s)
```

Part of #37
nilsreichardt added a commit that referenced this issue Mar 9, 2023
This PR adds `sharezone_lints` to the `analytics` package and fixes the
following lint warnings:

```
Analyzing analytics...                                                  

   info • Use the generic function type syntax in 'typedef's • lib/src/analytics/analytics_navigation_observer.dart:18:17 •
          prefer_generic_function_type_aliases
   info • Don't invoke 'print' in production code • lib/src/analytics/analytics_provider.dart:28:7 • avoid_print
   info • The member 'setUserProperty' overrides an inherited member but isn't annotated with '@OverRide' •
          lib/src/analytics/backend/firebase_analytics_backend.dart:53:16 • annotate_overrides
   info • Don't invoke 'print' in production code • lib/src/analytics/backend/logging_analytics_backend.dart:14:5 • avoid_print
   info • Don't invoke 'print' in production code • lib/src/analytics/backend/logging_analytics_backend.dart:19:5 • avoid_print
   info • Don't invoke 'print' in production code • lib/src/analytics/backend/logging_analytics_backend.dart:24:5 • avoid_print
   info • Don't invoke 'print' in production code • lib/src/analytics/backend/logging_analytics_backend.dart:29:5 • avoid_print
   info • Don't invoke 'print' in production code • lib/src/analytics/backend/logging_analytics_backend.dart:34:5 • avoid_print
```

Part of #37
nilsreichardt added a commit that referenced this issue Mar 9, 2023
This PR adds `sharezone_lints` to the `app_functions` package and fixes
the following lint warnings:

```
Analyzing app_functions...                                              

   info • Don't invoke 'print' in production code • lib/src/app_functions.dart:28:7 • avoid_print
   info • Don't invoke 'print' in production code • lib/src/app_functions.dart:46:5 • avoid_print
   info • Use interpolation to compose strings and values • lib/src/app_functions.dart:46:11 • prefer_interpolation_to_compose_strings
   info • Don't invoke 'print' in production code • lib/src/app_functions.dart:47:5 • avoid_print
   info • Use interpolation to compose strings and values • lib/src/app_functions.dart:47:11 • prefer_interpolation_to_compose_strings
   info • Don't invoke 'print' in production code • lib/src/app_functions.dart:48:5 • avoid_print
   info • Statements in an if should be enclosed in a block • lib/src/app_functions.dart:50:7 • curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/app_functions.dart:58:7 • curly_braces_in_flow_control_structures
   info • Don't invoke 'print' in production code • lib/src/app_functions.dart:59:5 • avoid_print
   info • Use interpolation to compose strings and values • lib/src/app_functions.dart:59:11 • prefer_interpolation_to_compose_strings
   info • Don't invoke 'print' in production code • lib/src/app_functions.dart:60:5 • avoid_print
```

Part of #37
nilsreichardt added a commit that referenced this issue Mar 12, 2023
This PR adds `sharezone_lints` to the `sharezone_about_page_addon`
package and fixes the following lint warnings:

```
Analyzing sharezone_about_page_addon...                                 

   info • Unnecessary 'late' modifier • lib/game/custom/util.dart:11:13 • unnecessary_late
   info • Constructors for public widgets should have a named 'key' parameter • lib/sharezone_about_page_addon.dart:70:7
          • use_key_in_widget_constructors
   info • Invalid use of a private type in a public API • lib/sharezone_about_page_addon.dart:72:3 •
          library_private_types_in_public_api

3 issues found. (ran in 1.0s)
```

Part of #37
nilsreichardt added a commit that referenced this issue Mar 12, 2023
This PR adds `sharezone_lints` to the `remote_configuration` package and
fixes the following lint warnings:

```
Analyzing remote_configuration...                                       

   info • Don't invoke 'print' in production code • lib/src/implementation/firebase_remote_configuration.dart:40:7 •
          avoid_print
   info • The member 'getString' overrides an inherited member but isn't annotated with '@OverRide' •
          lib/src/implementation/stub_remote_configuration.dart:14:10 • annotate_overrides

2 issues found. (ran in 1.1s)
```

Part of #37
nilsreichardt added a commit that referenced this issue Mar 12, 2023
This PR adds `sharezone_lints` to the `key_value_store` package. There
were no warnings to fix.

Part of #37
nilsreichardt added a commit that referenced this issue Mar 12, 2023
This PR adds `sharezone_lints` to the `date` package and fixes the
following lint warnings:

```
Analyzing date...                                                       

   info • Statements in an if should be enclosed in a block • lib/src/fuzzy_date_time_string.dart:21:7 •
          curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/fuzzy_date_time_string.dart:24:9 •
          curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/fuzzy_date_time_string.dart:26:9 •
          curly_braces_in_flow_control_structures

3 issues found. (ran in 1.5s)
```

Part of #37
nilsreichardt added a commit that referenced this issue Mar 12, 2023
This PR adds `sharezone_lints` to the `crash_analytics` package and
fixes the following lint warnings:

```
Analyzing crash_analytics...                                            

   info • Don't return 'null' from a method with a return type of 'void' •
          lib/src/implementation/stub_crash_analytics.dart:22:5 • avoid_returning_null_for_void
   info • Don't return 'null' from a method with a return type of 'void' •
          lib/src/implementation/stub_crash_analytics.dart:27:5 • avoid_returning_null_for_void
   info • Don't return 'null' from a method with a return type of 'void' •
          lib/src/implementation/stub_crash_analytics.dart:32:5 • avoid_returning_null_for_void

3 issues found. (ran in 1.4s)
```

Part of #37
nilsreichardt added a commit that referenced this issue Mar 12, 2023
This PR adds `sharezone_lints` to the `bloc_provider` package and fixes
the following lint warnings:

```
Analyzing bloc_provider...                                              

   info • Invalid use of a private type in a public API • lib/src/bloc_provider.dart:25:3 •
          library_private_types_in_public_api

1 issue found. (ran in 1.4s)
```

Part of #37
nilsreichardt added a commit that referenced this issue Mar 12, 2023
This PR adds `sharezone_lints` to the `build_context` package and fixes
the following lint warnings:

```
Analyzing build_context...                                              

   info • Statements in an if should be enclosed in a block • lib/src/build_context_impl.dart:23:9 •
          curly_braces_in_flow_control_structures
   info • Statements in an if should be enclosed in a block • lib/src/build_context_impl.dart:25:9 •
          curly_braces_in_flow_control_structures

2 issues found. (ran in 1.3s)
```

Part of #37
github-merge-queue bot pushed a commit that referenced this issue Aug 10, 2023
github-merge-queue bot pushed a commit that referenced this issue Aug 17, 2023
github-merge-queue bot pushed a commit that referenced this issue Sep 14, 2023
Sorry for the big PR. Most changes with `dart fix --apply`. Often I need
to add `context.mounted`.

Finally, we can close #37 :)
nilsreichardt added a commit that referenced this issue Sep 24, 2023
We don't should use our `FLUTTER_VERSION`. We should the
`FLUTTER_VERSION` from the FVM GitHub action.
@nilsreichardt nilsreichardt moved this to Closed in Triage May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Code quality itself (readable) but e.g. also how we might enforce better quality automatically. technical debt
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

2 participants