scalacenter / scalafix

Refactoring and linting tool for Scala

Home Page:https://scalacenter.github.io/scalafix/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use rules defined in SBT module within a multi-module build

cchantep opened this issue · comments

Currently it's not possible to use rules defined in a SBT modules in other modules of the same multi-modules project without publishing, aka not possible to use inter-module dependencies (e.g. dependsOn).

Local rules are not sufficient neither when rules are to be used accross several sibling modules, nor when the rules module itself needs specific libraryDependencies.

Hi @cchantep !

By "rule defined in SBT module", I assume you are refering to that scenario (although the other one might be more maintainable if you start sharing rules across projets)?

I might be misinterpreting your request, but considering that local rules rely on a sbt configuration ScalafixConfig / "scalafix", you should already have full flexibility on dependency management.

Local rules are not sufficient neither when rules are to be used accross several sibling modules

You should be able to use service2.dependsOn(service1 % "scalafix->scalafix") (see docs).

nor when the rules module itself needs specific libraryDependencies.

Did you try service1 / libraryDependencies += "external" % "dependency" % "1.0.0" % ScalafixConfig ? (see docs)


Let me know if that helps. If it does, a PR to clarify the docs would be welcome. If it does not, a concrete example would help, to better understand your needs.

Hi @cchantep, any feedback on that?