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

[Wildcard Variables] UNUSED_LOCAL_VARIABLE support #55719

Open
Tracked by #55680
pq opened this issue May 14, 2024 · 1 comment
Open
Tracked by #55680

[Wildcard Variables] UNUSED_LOCAL_VARIABLE support #55719

pq opened this issue May 14, 2024 · 1 comment
Assignees
Labels
analyzer-warning Issues with the analyzer's Warning codes area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-wildcard-variables Implementation of the wildcard variables feature P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@pq
Copy link
Member

pq commented May 14, 2024

As per the discussion in dart-lang/linter#4968, we want to start reporting UNUSED_LOCAL_VARIABLE for non wildcard underscore cases (e.g., __, ___, etc).

UPDATE: non-wildcard underscores will produce diagnostics but whether we want to start reporting on other identifiers (e.g., e or exception) is still an open question. (See proposal below.)

@pq pq added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-warning Issues with the analyzer's Warning codes P2 A bug or feature request we're likely to work on feature-wildcard-variables Implementation of the wildcard variables feature labels May 14, 2024
@pq pq self-assigned this May 14, 2024
@pq pq changed the title [Wildcard Variable] Update UNUSED_LOCAL_VARIABLE reporting to flag multiple _s [Wildcard Variables] Update UNUSED_LOCAL_VARIABLE reporting to flag multiple _s May 14, 2024
@pq pq changed the title [Wildcard Variables] Update UNUSED_LOCAL_VARIABLE reporting to flag multiple _s [Wildcard Variables] UNUSED_LOCAL_VARIABLE support May 17, 2024
@pq pq reopened this May 17, 2024
@pq
Copy link
Member Author

pq commented May 17, 2024

Follow-up from dart-lang/linter#4974,

Proposal: report UNUSED_LOCAL_VARIABLE on all unused bound catch clause parameters

Specifically, this means we start flagging the following (which we don't today) with an UNUSED_LOCAL_VARIABLE diagnostic:

try {
} catch(e) { }

providing a quick-fix conversion to:

try {
} catch(_) { }

Since the idiom of catching (and ignoring) an exception named e or similar is well established, this will produce a bunch of diagnostics in some projects but with dart fix code can effortlessly be migrated.

/cc @dart-lang/language-team @dart-lang/analyzer-team

@srawlins srawlins added the type-enhancement A request for a change that isn't a bug label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-warning Issues with the analyzer's Warning codes area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-wildcard-variables Implementation of the wildcard variables feature P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants