Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Linter rules#1462

Draft
sorewanya wants to merge 41 commits intoteam113:mainfrom
sorewanya:linter_rules
Draft

Linter rules#1462
sorewanya wants to merge 41 commits intoteam113:mainfrom
sorewanya:linter_rules

Conversation

@sorewanya
Copy link
Copy Markdown
Contributor

@sorewanya sorewanya commented Oct 12, 2025

Synopsis

This PR introduces a set of linting rules to improve code consistency and maintainability. The changes aim to make the code more readable and easier to navigate, helping contributors understand and follow established conventions.

Solution

Added and configured linting rules via analysis_options.yaml, enforcing best practices for code style, naming conventions, and documentation. The changes organized into 32 atomic commits, each with a descriptive message explaining the adjustments made.

Notice

  • Please don't take this as toxic, it's just another way of following the rules from CONTRIBUTING.md, which seems more appropriate to me than the dry line from this file, not supplemented by any reminder in the IDE.
  • I just set a goal to understand the application code so that it would not be as boring as just reading the documentation, or immediately taking on one of the tasks. I hope these changes will really be perceived as useful.
  • I can't attach an issue reference because the fixes could have led to subtle errors or are more related to optimization.

Checklist

  • Created PR:
    • In draft mode
    • Name contains issue reference
    • Has type and k:: labels applied
  • Before review:
    • Documentation is updated (if required)
    • Tests are updated (if required)
    • Changes conform code style
    • CHANGELOG entry is added (if required)
    • FCM (final commit message) is posted or updated
    • Draft mode is removed
  • Review is completed and changes are approved
    • FCM (final commit message) is approved
  • Before merge:
    • Milestone is set
    • PR's name and description are correct and up-to-date
    • All temporary labels are removed

…t other places:

- many packages have problems with this - for example `AppDriverAdapter get appDriver => _adapter!;` in class FlutterWorld. AppDriverAdapter have generics, but FlutterWorld dont give it.
- Map<String, dynamic> use have problems. short `((document['server'])?['http']?['graphql'] ?? graphql)` transform to ` (((document['server'] as Map<String, dynamic>?)?['http']  as Map<String, dynamic>?)?['graphql'] ?? graphql)`
"AVOID using the following asynchronous file I/O methods because they are much slower than their synchronous counterparts."(c)
closed in "onClose()" in _subscriptions.forEach

This is not a mandatory commit.
"If a class is not immutable, overloading operator == and hashCode can lead to unpredictable and undesirable behavior when used in collections."(c)
"Declaring parameters as final can lead to unnecessarily verbose code, especially when using the "parameter_assignments" rule."(c)
This is a good way to unify all imports.
I understand that most(or all in directives_ordering) of the changes are related to the default sorting option, for example, the same VSCode sorts:
import '/domain/model/user_call_cover.dart';
import '/domain/model/user.dart';

and this directive make:
import '/domain/model/user.dart';
import '/domain/model/user_call_cover.dart';
Unfortunately, there is no separate option for true and false.
This is a controversial point; writing something like:
if(!some_lond_line);
is worse read than:
if(some_lond_line==false);

This is not a mandatory commit.
GraphQlProviderExceptions.parse return final Object? originalException; ... I'm just checking type to throw Exception
remove empty Widgets

it's a matter of taste, that's why I turned it off
'...allows the compiler to do optimizations'(c)
it's realy many fixes, 'allows the compiler to do optimizations'(c)
it's a matter of taste, but:
'Note that this guideline specifically says "function literal". If you want to invoke some already existing function on each element, forEach() is fine.'(c)
fix int? => int
(not noticed when adding `final` (pubspec.g.dart generate error)... I hate rebase, so...)
it's a matter of taste to remove await..., but
this is important to use: remove async it do not create Future object if it not needed. it's good for optimization
ColoredBox faster Container
DecoratedBox faster Container
it's a matter of taste
good optimization, since the merger happens once at the end
it's realy many fixes, 'allows the compiler to do optimizations'(c)
return prefer_relative_imports: true
@SleepySquash SleepySquash modified the milestones: 0.7.1, 0.8.0, 0.7.2 Jan 7, 2026
@SleepySquash SleepySquash modified the milestones: 0.8.0, 0.9.0, 0.8.1 Jan 21, 2026
@SleepySquash SleepySquash modified the milestones: 0.8.2, 0.9.0, 0.10.0 Feb 2, 2026
@SleepySquash SleepySquash modified the milestones: 0.9.1, 0.10.0, 0.9.2 Feb 11, 2026
@SleepySquash SleepySquash modified the milestones: 0.9.3, 0.10.0, 0.9.4 Feb 23, 2026
@SleepySquash SleepySquash modified the milestones: 0.9.5, 0.10.0, 0.9.6 Mar 9, 2026
@SleepySquash SleepySquash modified the milestones: 0.10.0, 0.11.0 Mar 26, 2026
@SleepySquash SleepySquash modified the milestones: 0.10.1, 0.11.0, 0.10.2 Apr 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement Improvement of existing features or bugfix k::refactor Refactor changes of existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants