-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fix bug with incorrect reordering of enum classes #847
Conversation
2fb0bea
to
c643e2d
Compare
### What's done: * Fixed bug in logic * Added tests * Added smoke tests * Refactoring
c643e2d
to
3b7766a
Compare
Codecov Report
@@ Coverage Diff @@
## master #847 +/- ##
============================================
- Coverage 81.01% 81.00% -0.01%
+ Complexity 2292 2282 -10
============================================
Files 100 100
Lines 5840 5843 +3
Branches 1815 1814 -1
============================================
+ Hits 4731 4733 +2
Misses 286 286
- Partials 823 824 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
.allBlockFlattened() | ||
.map { astNode -> | ||
Pair(astNode, astNode.siblings(false).takeWhile { it.elementType == WHITE_SPACE || it.isPartOfComment() }.toList()) | ||
listOf(astNode) + astNode.siblings(false).takeWhile { it.elementType == WHITE_SPACE || it.isPartOfComment() }.toList() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check Annotations in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, annotations are usually part of node with declaration, specifically part of modifier list. Can you give any example that would break with this logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, forgot that they are in modifier list. Then everything should be fine
@@ -73,49 +75,21 @@ class ClassLikeStructuresOrderRule(configRules: List<RulesConfig>) : DiktatRule( | |||
val initBlocks = node.getChildren(TokenSet.create(CLASS_INITIALIZER)).toMutableList() | |||
val constructors = node.getChildren(TokenSet.create(SECONDARY_CONSTRUCTOR)).toMutableList() | |||
val methods = node.getChildren(TokenSet.create(FUN)).toMutableList() | |||
val (usedClasses, unusedClasses) = node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not able to understand where was the issue because of the refactoring, could you please provide some info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are explicitly choosing class elements to sort. We were simply skipping enum members, now I added handling of them. I believe there are no more unexpected class elements that are not covered.
...rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/ClassLikeStructuresOrderRule.kt
Show resolved
Hide resolved
|
why do we select different properties? and after that unify them:
this is useless, no? |
|
We group them in four distinct blocks and then arrange in order of these blocks. I believe I introduced this class so that |
### What's done: * Refactoring * Changed code style guide for logger properties
…43' into bugfix/class-ordering-in-enums#843
### What's done: * Code style
33224ae
to
8ee50f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
### What's done: * Code style
What's done:
This pull request closes #843