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

Add linting #1137

Closed
wants to merge 2 commits into from
Closed

Add linting #1137

wants to merge 2 commits into from

Conversation

jnfeinstein
Copy link
Contributor

@jnfeinstein jnfeinstein commented Jan 14, 2021

I've added org.jmailen.kotlinter plugin, which is my go-to ktlint plugin for gradle (org.jlleitschuh.gradle.ktlint uses gradle features that are being deprecated in 7.0). The only manual changes are found in the root build.gradle.kts and .editorconfig. The rest of the changes are autogenerated using the linter.

The linter is executed using ./gradlew lintKotlin to check styling, and ./gradlew formatKotlin to auto-correct styling.

infix fun <TargetID: Comparable<TargetID>, Target: Entity<TargetID>, REF:Comparable<REF>> EntityClass<TargetID, Target>.optionalBackReferencedOn(column: Column<REF>)
= registerRefRule(column) { OptionalBackReference<TargetID, Target, ID, Entity<ID>, REF>(column as Column<REF?>, this) }
infix fun <TargetID : Comparable<TargetID>, Target : Entity<TargetID>, REF : Comparable<REF>> EntityClass<TargetID, Target>.optionalBackReferencedOn(column: Column<REF>) =
registerRefRule(column) { OptionalBackReference<TargetID, Target, ID, Entity<ID>, REF>(column as Column<REF?>, this) }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Tapac these were the only changes I had to make manually, the linter did not like moving the = sign to the previous line. Ideally in this case I would use brackets and return, but the list of generics is long and it is useful to have them computed transparently in this case.

@jnfeinstein
Copy link
Contributor Author

@Tapac just updated this branch.

@hfhbd
Copy link
Contributor

hfhbd commented Apr 12, 2021

How about adding this to the CI?

@jnfeinstein
Copy link
Contributor Author

@hfhbd 99% certain that the plugin adds lintKotlin to the test or check phase. If not then I am not opposed to adding in a separate PR. I figured this one would install the plugin and baseline the code, which is a process unto itself.

Tapac pushed a commit that referenced this pull request Apr 18, 2021
@Tapac
Copy link
Contributor

Tapac commented Apr 18, 2021

Your PR was squashed to master manually, so I'll close the PR.

@Tapac Tapac closed this Apr 18, 2021
@BorzdeG
Copy link
Contributor

BorzdeG commented Apr 26, 2021

Why did you use kotliner? why not https://github.com/arturbosch/detekt/?

@jnfeinstein
Copy link
Contributor Author

Kotlinter is a gradle plugin wrapper for ktlint. I've used it before, it's easy and works well. Please submit a PR if you think the project could benefit from using detekt. 🙂

SchweinchenFuntik pushed a commit to SchweinchenFuntik/Exposed that referenced this pull request Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants