-
Notifications
You must be signed in to change notification settings - Fork 510
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
Add file annotations rule #714
Conversation
764119a
to
797749d
Compare
b1b8560
to
33b22a2
Compare
@@ -30,6 +37,7 @@ class AnnotationRule : Rule("annotation") { | |||
"Multiple annotations should not be placed on the same line as the annotated construct" | |||
const val annotationsWithParametersAreNotOnSeparateLinesErrorMessage = | |||
"Annotations with parameters should all be placed on separate lines prior to the annotated construct" | |||
const val fileAnnotationsShouldBeSeparated = "File annotations should be separated from packages with a blank line" |
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.
Following up from #747, I think the wording should be a bit different, cause there's not necessarily a package coming after a file annotation (e.g. in .kts
files). So maybe change it to from file contents
or something like that.
if (lineNumber != null && nextLineNumber != null) { | ||
val diff = nextLineNumber - lineNumber | ||
if (diff < 2) { | ||
emit(0, fileAnnotationsShouldBeSeparated, true) |
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.
Hm, what if there's a license header above the file annotation, then I guess 0
offset is not correct anymore? According to codestyle, there can be something on top of the annotation.
Fixes #689