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

feat: remove declaration in prefer-immediate-return #824

Merged

Conversation

ookami-kb
Copy link
Contributor

@ookami-kb ookami-kb commented Apr 30, 2022

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix
[ ] New rule
[x] Changes an existing rule
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

prefer-immediate-return will remove variable declaration as well, if this is a single declaration (e.g. it will remove final x = 1 but not final a = 2, x = 1).

It will solve the most common use case, when there's a single variable declaration and immediate return.

Is there anything you'd like reviewers to focus on?

@ookami-kb ookami-kb changed the title fix: remove declaration in prefer-immediate-return feat: remove declaration in prefer-immediate-return Apr 30, 2022
@ookami-kb ookami-kb force-pushed the fix-prefer-immediate-return branch 2 times, most recently from ee31017 to 05f0c0b Compare April 30, 2022 16:40
@codecov
Copy link

codecov bot commented Apr 30, 2022

Codecov Report

Merging #824 (78f688e) into master (43a293a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #824   +/-   ##
=======================================
  Coverage   87.26%   87.27%           
=======================================
  Files         277      277           
  Lines        5898     5902    +4     
=======================================
+ Hits         5147     5151    +4     
  Misses        751      751           
Impacted Files Coverage Δ
...es/rules_list/prefer_immediate_return/visitor.dart 100.00% <ø> (ø)
...immediate_return/prefer_immediate_return_rule.dart 100.00% <100.00%> (ø)
lib/src/utils/node_utils.dart 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c451262...78f688e. Read the comment docs.

@ookami-kb ookami-kb marked this pull request as ready for review April 30, 2022 17:17
@incendial incendial added type: enhancement New feature or request area-rules labels May 1, 2022
@incendial incendial added this to the 4.15.0 milestone May 1, 2022
@dkrutskikh dkrutskikh merged commit 374f392 into dart-code-checker:master May 3, 2022
@ookami-kb ookami-kb deleted the fix-prefer-immediate-return branch May 3, 2022 10:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-rules type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants