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

Bugfix. Unused_import rule should ignore all standard operator funs #880

Merged
merged 5 commits into from
May 13, 2021

Conversation

aktsay6
Copy link
Collaborator

@aktsay6 aktsay6 commented May 12, 2021

What's done:

  • Fixed bug
  • Added test

This pull request closes #837

### What's done:
  * Fixed bug
  * Added test
@aktsay6 aktsay6 added the bug Something isn't working label May 12, 2021
@aktsay6 aktsay6 requested review from petertrr and Cheshiriks May 12, 2021 09:24
@codecov
Copy link

codecov bot commented May 12, 2021

Codecov Report

Merging #880 (cdd0ab2) into master (cf126df) will decrease coverage by 0.02%.
The diff coverage is 50.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #880      +/-   ##
============================================
- Coverage     83.53%   83.51%   -0.03%     
  Complexity     2215     2215              
============================================
  Files           101      101              
  Lines          5690     5689       -1     
  Branches       1628     1628              
============================================
- Hits           4753     4751       -2     
  Misses          256      256              
- Partials        681      682       +1     
Flag Coverage Δ Complexity Δ
unittests 83.51% <50.00%> (-0.03%) 2215.00 <0.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
.../ruleset/rules/chapter3/files/FileStructureRule.kt 83.11% <50.00%> (-0.76%) 77.00 <0.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 cf126df...cdd0ab2. Read the comment docs.

Comment on lines 78 to 82
// Fixme: this imports should be deleted if unused
private val ignoreOperators = setOf("getValue", "plus", "minus", "times", "div",
"rem", "rangeTo", "contains", "plusAssign", "minusAssign", "timesAssign",
"divAssign", "remAssign", "compareTo", "inc", "dec", "unaryPlus", "unaryMinus", "not")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we supplement the dictionary with operatorMap operators in AstConstants.kt so that these operators are not ignored?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

### What's done:
  * Fixed bug
)
}

@Disabled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide a reason

importName
)
) {
} else if (importName != null && !ignoreImports.contains(importName) && !refSet.contains(importName) && !operatorMap.containsKey(importName)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you disable deleting imports from operatorMap?

@kgevorkyan kgevorkyan self-requested a review May 12, 2021 15:13
@petertrr petertrr added this to the 0.5.3 milestone May 13, 2021
@petertrr petertrr merged commit 7f74e9a into master May 13, 2021
@petertrr petertrr deleted the bugfix/unused-import-operator(#837) branch May 13, 2021 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unused_import rule should ignore all standard operator funs
3 participants