Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix for no_leading_underscores_for_local_identifiers does not fix local functions #52821

Closed
@kturney

Description

@kturney

dart-archive/linter#3361 added support in the linter to detect local functions for which the name begins with an underscore.

However, as far as I can tell, analysis_server...remove_leading_underscore.dart was never updated to provide a fix for this.

dart --version: Dart SDK version: 3.0.5 (stable) (Mon Jun 12 18:31:49 2023 +0000) on "macos_arm64"

I will be submitting an MR with a test shortly.

I'd planned to also develop a fix, but I can't seem to build anything due to a missing ../../third_party/pkg/yaml_edit dependency for analysis_server.

I'll also inline here the test I am adding to pkg/analysis_server/test/src/services/correction/fix/remove_leading_underscore_test.dart

  Future<void> test_localFunction() async {
    await resolveTestCode(r'''
void f() {
  int _foo() => 1;
  print(_foo());
}
''');
    await assertHasFix('''
void f() {
  int foo() => 1;
  print(foo());
}
''');
  }

I'm willing to develop a fix if I can receive some guidance on fixing the missing yaml_edit dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestdevexp-quick-fixIssues with analysis server (quick) fixesdevexp-serverIssues related to some aspect of the analysis serverlegacy-area-analyzerUse area-devexp instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions