-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: use OrganizeImports scalafix built-in rule, MISC-485 #205
Conversation
@@ -1,13 +1,20 @@ | |||
rule = [ | |||
SortImports | |||
OrganizeImports, | |||
RedundantSyntax // remove extra string interpolator when not needed |
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 know this one is "extra"
But it is harmless and may clean the code :)
OrganizeImports { | ||
blankLines = Auto | ||
expandRelative = true | ||
groupedImports = Merge | ||
groups = [ | ||
"re:javax?\\.", | ||
"scala.", | ||
"io.gatling.", | ||
"*", | ||
"re:x?sbti?\\." | ||
] | ||
importSelectorsOrder = SymbolsFirst | ||
importsOrder = SymbolsFirst | ||
removeUnused = false | ||
} |
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.
Way more detailed than before, but the defaults are different
@@ -16,8 +16,7 @@ | |||
|
|||
package io.gatling.build | |||
|
|||
import io.gatling.build.automated.GatlingAutomatedScalafixPlugin | |||
import io.gatling.build.automated.GatlingAutomatedScalafmtPlugin | |||
import io.gatling.build.automated.{GatlingAutomatedScalafixPlugin, GatlingAutomatedScalafmtPlugin} |
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.
Application of the "groupedImports = Merge" clause
otherwise the plugin wanted to explode every import...
Maybe we should do it (java style?) to limit impact (and possible conflict) on git diff?
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.
Arf! outdated because I forgot to compile (and trigger scalafmt after scalafix)
override def buildSettings: Seq[Def.Setting[_]] = Seq( | ||
semanticdbEnabled := true, | ||
semanticdbVersion := scalafixSemanticdb.revision | ||
) |
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 need to activate semanticdb now
@@ -91,7 +91,7 @@ object GatlingSonatypePlugin extends AutoPlugin { | |||
* - inject it to the state needed by publishSigned task | |||
* - call sonatypeClose command with full state from sonatypeOpen | |||
*/ | |||
state.log.info(s"Opening sonatype staging") | |||
state.log.info("Opening sonatype staging") |
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.
Application of the "RedundantSyntax" rule :)
8353826
to
838bf65
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.
Great!
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.
Tests fail because semanticDb requires upgrading Scala version: https://github.com/gatling/gatling-build-plugin/blob/main/src/sbt-test/gatling-build-plugin/scalaVersion/build.sbt#L1
Motivation: NeQuissimus/sort-imports is no longer maintained. Even though it works very well, scalafix complains about it being compiled against scalafix 0.9 and pollutes the logs. Modifications: * Configure the "new" OrganizeImports built-in rule to be as close as possible from current code * Upgrade sbt and scalaVersion for scripted test Result: Small changes in code but use an uptodate version of scalafix rule
838bf65
to
6978fdb
Compare
Motivation:
NeQuissimus/sort-imports is no longer maintained. Even though it works very well, scalafix complains about it being compiled against scalafix 0.9 and pollutes the logs.
Modifications:
Result:
Small changes in code but use an uptodate version of scalafix rule