You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be ideal to have scalafix along with its addons such as organize-imports to automatically
Remove unused imports
Organize imports to avoid unnecessary nesting, FQCN usages etc etc
Sort imports
And many other rules, some of which already exist here https://github.com/apache/incubator-pekko/blob/f84e8db3cbdbc05743cb06a2d4264d1a7ce01b96/.scalafix.conf . Although historically people have used Intellij to sort/clean imports, this is not ideal for many reasons i.e. it ties Pekko to a specific IDE, Intellij isn't always correct due to the same reasons why it also reports uncompilable code incorrectly and most critically we can't use it in github actions CI to enforce the rules are consistently applied and don't rot over time.
It would have been great to have already done this, particularly soon after we integrated scalafix some time ago however there are some features of Pekko's codebase which would cause issues if we enable scalafix. The first one is that in order to avoid excessive boilerplate due to adding org.apache to our root package, in Scala source files we have a "root" import, i.e.
importorg.apache.pekko
So that any future references to code within Pekko packages just needs pekko.<something> which is the same as how the code was in Akka and the other one is our complicated usage of paradox directives which when combined with the first problem of root imports makes things even more complicated (i.e. some source files such as https://github.com/apache/incubator-pekko-http/blob/fb224dfba74d03d88866d5c40d63ebd9729cdded/docs/src/test/scala/docs/http/scaladsl/HttpServerExampleSpec.scala have the same import org.apache.pekko multiple times but thats because the additional cases of that import is going to be within generated documentation otherwise when people copy code from the docs they will miss an import).
It would be ideal to have scalafix along with its addons such as organize-imports to automatically
And many other rules, some of which already exist here https://github.com/apache/incubator-pekko/blob/f84e8db3cbdbc05743cb06a2d4264d1a7ce01b96/.scalafix.conf . Although historically people have used Intellij to sort/clean imports, this is not ideal for many reasons i.e. it ties Pekko to a specific IDE, Intellij isn't always correct due to the same reasons why it also reports uncompilable code incorrectly and most critically we can't use it in github actions CI to enforce the rules are consistently applied and don't rot over time.
It would have been great to have already done this, particularly soon after we integrated scalafix some time ago however there are some features of Pekko's codebase which would cause issues if we enable scalafix. The first one is that in order to avoid excessive boilerplate due to adding
org.apache
to our root package, in Scala source files we have a "root" import, i.e.So that any future references to code within Pekko packages just needs
pekko.<something>
which is the same as how the code was in Akka and the other one is our complicated usage of paradox directives which when combined with the first problem of root imports makes things even more complicated (i.e. some source files such as https://github.com/apache/incubator-pekko-http/blob/fb224dfba74d03d88866d5c40d63ebd9729cdded/docs/src/test/scala/docs/http/scaladsl/HttpServerExampleSpec.scala have the sameimport org.apache.pekko
multiple times but thats because the additional cases of that import is going to be within generated documentation otherwise when people copy code from the docs they will miss an import).I created issues upstream documenting these cases
doc-generation-directives
scalacenter/scalafix#1793The text was updated successfully, but these errors were encountered: