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

Rule 4.1.1 float arithmetic #303

Merged
merged 11 commits into from
Sep 24, 2020
Merged

Conversation

petertrr
Copy link
Member

@petertrr petertrr commented Sep 17, 2020

Which rule and warnings did you add?

This pull request closes #289

Actions checklist

  • Implemented Rule, added Warnings
  • Added tests on checks
    * [ ] Added tests on fixers
  • Updated diktat-analysis.yml
  • Updated available-rules.md

Fixme

  • current implementation detects only floating-point constants

### What's done:
* Initial implementation
* Tests
### What's done:
* Update yml files and available-rules.md
### What's done:
* Added new rule to DiktatRuleSetProvider
* Added maven central badge
@codecov
Copy link

codecov bot commented Sep 17, 2020

Codecov Report

Merging #303 into master will decrease coverage by 0.09%.
The diff coverage is 77.55%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #303      +/-   ##
============================================
- Coverage     82.38%   82.29%   -0.10%     
- Complexity     1000     1016      +16     
============================================
  Files            51       52       +1     
  Lines          2578     2627      +49     
  Branches        809      830      +21     
============================================
+ Hits           2124     2162      +38     
  Misses          169      169              
- Partials        285      296      +11     
Flag Coverage Δ Complexity Δ
#unittests 82.29% <77.55%> (-0.10%) 1016.00 <16.00> (+16.00) ⬇️

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

Impacted Files Coverage Δ Complexity Δ
...at-rules/src/main/kotlin/generated/WarningNames.kt 0.00% <ø> (ø) 0.00 <0.00> (ø)
...n/kotlin/org/cqfn/diktat/ruleset/utils/PsiUtils.kt 54.16% <63.63%> (+2.81%) 0.00 <0.00> (ø)
...set/rules/calculations/AccurateCalculationsRule.kt 80.55% <80.55%> (ø) 16.00 <16.00> (?)
...tlin/org/cqfn/diktat/ruleset/constants/Warnings.kt 96.70% <100.00%> (+0.03%) 9.00 <0.00> (ø)
...cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt 97.67% <100.00%> (+0.05%) 3.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 c7d53a6...82620f6. Read the comment docs.

@orchestr7 orchestr7 added the enhancement New feature or request label Sep 17, 2020
info/available-rules.md Outdated Show resolved Hide resolved
### What's done:
* Fixes
…float-ariphmethic

# Conflicts:
#	diktat-analysis.yml
#	diktat-rules/src/main/kotlin/generated/WarningNames.kt
#	diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/constants/Warnings.kt
#	diktat-rules/src/main/resources/diktat-analysis-huawei.yml
#	diktat-rules/src/main/resources/diktat-analysis.yml
#	info/available-rules.md
### What's done:
* Fixes
Copy link
Collaborator

@kentr0w kentr0w left a comment

Choose a reason for hiding this comment

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

What about remainder of dividing (rem, %)? Or it shouldn't be there?

@petertrr
Copy link
Member Author

What about remainder of dividing (rem, %)? Or it shouldn't be there?

Fair enough, I forgot about it.

### What's done:
* Added PERC and PERCEQ to handled operators
Copy link
Collaborator

@kentr0w kentr0w left a comment

Choose a reason for hiding this comment

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

LGTM

@petertrr petertrr merged commit 471ded1 into master Sep 24, 2020
@petertrr petertrr deleted the feature/rule-4.1.1-float-ariphmethic branch September 24, 2020 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule 4.1.1: Do not use Float and Double when accurate calculations are needed
3 participants