-
-
Notifications
You must be signed in to change notification settings - Fork 757
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: ModifierOrder #239
Rule: ModifierOrder #239
Conversation
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.
Please add a test case where you run the rule against a real file (in resources) with no problems. 👍
given("a kt parameter with wrongly ordered modifiers") { | ||
val code = "lateinit internal private val test: String" | ||
|
||
it("should report the package statement and import statements by default") { |
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 this is a mistake?
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.
Oh.. Good catch. Copy pasted the MaxLineLengthSpec and forgot to change the description 🙃
given("a kt parameter with correctly ordered modifiers") { | ||
val code = "private internal lateinit val test: String" | ||
|
||
it("should report the package statement and import statements by default") { |
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.
Here too?
14c9898
to
8feda1c
Compare
Updated the tests and included a Test class for the Modifier order. It felt wrong writing that class with the modifiers all over the place... 😐 |
it("should not report modifiers") { | ||
val rule = ModifierOrder() | ||
|
||
val findings = rule.lint(file.text) |
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.
Just give Case.Default.path
to lint
or you compile two times the file :)
} | ||
|
||
given("a kt file with correctly ordered modifiers") { | ||
val file = compileForTest(Case.ModifierOrder.path()) |
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.
Here too
Resolves #129
The modifier order and rule setup was inspired by ktlint: https://github.com/shyiko/ktlint/blob/master/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/ModifierOrderRule.kt#L35