Releases: scalacenter/scalafix
Scalafix v0.5.8
Please use v0.5.9 https://github.com/scalacenter/scalafix/releases/tag/v0.5.9
Scalafix v0.5.7
- #472 Add --diff to only report linter messages from a
git diff
. Useful to enable Scalafix into an existing codebase. For more details, see --diff and --diff-base in --help .
Example usage, find all var
s that are introduced since scalafix v0.5.6
$ scalafix -r DisableSyntax --config-str="DisableSyntax.keywords=[var]" --diff-base=v0.5.6
scalafix-tests/unit/src/test/scala/scalafix/tests/cli/CliGitDiffTests.scala:224:13: error: [DisableSyntax.keywords.var] keywords.var is disabled
private var revision = 0
^
scalafix-core/shared/src/main/scala/scalafix/internal/util/IntervalSet.scala:31:11: error: [DisableSyntax.keywords.var] keywords.var is disabled
var i = start
^
- #467 Include column number in linter messages, by @olafurpg
- #469 Re-enable sbt 1.0 for sbt-scalafix, @olafurpg and @MasseGuillaume
- #486 Fix --diff-base hash resolution, by @MasseGuillaume
- #477 Upgrade to 2.12.4 from 2.12.3, by @olafurpg. While upgrading, we encountered a regression that resulted in an unresolved implicit due to the compiler swallowing a stack overflow error, see scala/bug#10649 for more details.
- #480 Fix false positives in testkit, by @MasseGuillaume
Scalafix v0.5.6
First of all, I am excited to welcome @MasseGuillaume to the Scalafix team! Moreover, I'm also thrilled to see @fommil joining the effort by sponsoring @vovapolu to work on improving scalafix for functional programming, see #451. Consider pitching in too!
Features
- #412 Make it easy to enable sbt-scalafix for custom configurations like
IntegrationTest withscalafixConfigure(Compile, Test, IntegrationTest)
, by @olafurpg. See https://scalacenter.github.io/scalafix/docs/users/installation#sbt-scalafix - #415 Suppress false linter errors with comments, by @MasseGuillaume. This PR makes
it a lot more practical to use Scalafix for linting, since previously there was no way
to silence Scalafix for exceptional cases where the linter reports a bogus
diagnostic. See https://scalacenter.github.io/scalafix/docs/users/configuration#per-source-file - #426 Upgrade to Scalameta v2.1.2, with support for Scala 2.11.12 and 2.12.4. Scala 2.11.11 and 2.12.3 are still supported, but no older Scala versions.
- #431 New
DisableSyntax
rule to disable keywords likereturn
/while
/throw
, by @MasseGuillaume - #444 Fix off-by-one error in
TokenList.next/prev
, by @ag91 and @GoldenZero - #445 skip local implicits in ExplicitResultTypes, by @erikwj
- #448 Add support for attaching custom messages to
Disable
rule, by @MasseGuillaume. See https://scalacenter.github.io/scalafix/docs/rules/Disable#custom-error-messages - #448 Add support for asserting against linter messages in
testkit
, by @MasseGuillaume. Example here. - #453 use a flexible parser dialect by default that, for example, supports trailing commas, by @olafurpg
Documentation
- #418 Add detailed documentation comparing scalafix with alternative tools
like Scala Refactoring, WartRemover, ScalaStyle and IntelliJ Scala plugin, by @olafurpg - #419 Simplify installation of sbt-scalafix with
scalafixEnable
command that can
automatically setup all the correct scala compiler settings from an sbt shell session, regardless of
existing settings in build.sbt. Previously, it was necessary to manually
update build.sbt with fairly tricky corner cases, by @olafurpg - #420 New section in the docs for using scalafix with Maven builds, https://scalacenter.github.io/scalafix/docs/users/installation#maven by @fanf
Internal
- #454 refactor the scalafix build for easier cross-building and cross-publishing, by @MasseGuillaume. Please note that there are no published artifacts for v0.5.4 and v0.5.5 due to the build misconfiguration that got fixed by this PR.
Scalafix v0.5.5
(redacted) There are no published artifacts for this release. Please use v0.5.6 https://github.com/scalacenter/scalafix/releases/tag/v0.5.6
Scalafix v0.5.4
(redacted) There are no published artifacts for this release. Please use v0.5.6 https://github.com/scalacenter/scalafix/releases/tag/v0.5.6
Scalafix v0.5.3
Bug fixes
- #378 Fix a bug in the implementation of
addLeft
, by @abeln - #382 Make
addGlobalImport
syntactic, by @olafurpg - #384 Handle coursier's --standalone classloader, by @xeno-by
- #388 Emit linter warnings from cli, by @olafurpg
Features and improvements
- #381 Add
resultType
extension method onSymbol
, by @gabro - #389 Remove dependency on scalamacros/paradise, by @olafurpg
- #386 New documentation website, by @gabro.
Check out our new website https://scalacenter.github.io/scalafix/
Every page has an "Edit this page" link at the top right, please send us PRs to improve the content.
Scalafix v0.5.2
- #367 RemoveUnusedTerms rule for removing unused local var and val, by @DanielaSfregola
- #375 Cross-build sbt-scalafix for sbt 0.13 and 1.0, by @gabro. Note that scalafix-sbt is still not released for sbt 1.0, however.
Scalafix v0.5.1
Scalafix v0.5.0
- #358 Add tab completion for NoInfer, by @olafurpg
- #354 Read ExplicitResultTypes configuraiton key, by @insdami
- #353 Add Disable linter, https://scalacenter.github.io/scalafix/#Disable by @barambani
- #350 Add scalafixTest and sbtfixTest tasks to sbt plugin, by @Krever
- #352 Insert inferred units in NoAutoTupling rewrite, by @insdami
- #351 Fix typos in documentatin, by @mbryzek
Thank you everyone who contributed!
Scalafix v0.5.0-RC3
New features for end-users
This release introduces major improvements to sbt-scalafix, scalafix-cli.
sbtfix
task in sbt-scalafix to run rules on build sources.- Sbt1 rule to migrate usage of deprecated sbt 0.13 APIs, by @jvican.
- NoInfer linter that reports errors when the compiler reports types such as
Any
- ExplicitResultTypes experimental
unsafeShortenNames
option to insert imports instead of fully qualified names. - Scala.js support for scalafix-core, by @gabro.
- Configurable ExplicitResultTypes, by @taisuke.
- Configurable lint reporting.
- sbt-scalafix rule tab completion.
- scalafix-cli
--zsh
and--bash
to generate tab completion scripts for zsh and bash. - replace: to run quick one-off refactorings.
New features for rule authors
- Ability to implement rules for sources of sbt builds, including
*.sbt
files. The API to write sbt rules is identical to regular Scala rules. - Rules can now emit lint messages with
ctx.lint
, see LintMessage. - Thanks to upstream improvements in the Scalameta v2.0 Semantic API, it is now possible to
- query symbols of implicit arguments, implicit conversions, type parameters,
.apply
/.unapply
and symbol signatures. This represents significant portion of the work for Scalafix v0.5 and is a major milestone for the Scalameta semantic API. - parse symbols signatures as
scala.meta.Type
, including the newType.Method
which is the "type of methods" and cannot be written in source.
- query symbols of implicit arguments, implicit conversions, type parameters,
Rule.init(config): Configured[Rule]
allows rules to load the user configuration during rule construction. Before, rules had to parse the configuration while fixing each individual file.PatchOps.replaceSymbol/replaceTree
, see Patch.- PatchOps now has docstrings!
- Rules can have multiple names with optional deprecation warnings.
Bug fixes / Improvements
- ExplicitResultTypes produces valid type signatures in a lot more cases than before. Note that it still has some known bugs, see #324.
- More robust classloading to invoke scalafix in sbt-scalafix. Previously, sbt-scalafix used synthetic projects which cause problem in some multi-module builds. Now, sbt-scalafix uses Coursier instead.
- Improved dynamic compilation of custom rules while running from multi-module sbt builds.
- Extension methods now resolve to the correct symbol. For example,
head
inArray[Int].head
previously resolved toPredef.intArrayOps
and now it resolves toIndexedSeqOptimized.head
. - scalafix-cli automatically infers whether passed --rewrites are semantic or syntactic. This means it's possible to run custom syntactic rules from scalafix-cli without passing in
--classpath
.
Breaking changes
From 0.5 onwards, our CI will check binary breaking changes in the public API on every pull request. Note that modules inside the package scalafix.internal
don't promise binary compatibility between any releases, including PATCH upgrades.
-
github:
rewrites should be inside thescalafix/rules/...
directory instead ofscalafix/rewrites/...
directory -
scalafix.Rewrite/SemanticRewrite
is now deprecated andMirror
is nowSemanticdbIndex
.// before case class MyRewrite(mirror: Mirror) extends SemanticRewrite(mirror) { def rewrite(ctx: RewriteCtx): Patch } // before case class MyRule(index: SemanticdbIndex) extends SemanticRule(index) { def fix(ctx: RewriteCtx): Patch }
-
scalafix.testkit.SemanticRewriteSuite
is now nowSemanticRuleSuite
. -
scalafix.config
has been moved toscalafix.internal.config
. Configuration case classes break binary compatility with every new field. -
.symbol
now returnsOption[Symbol]
instead ofSymbol
..symbolOpt
has been deprecated. -
A large number of unused methods and classes inside
scalafix.internal.util.Failure
,scalafix.`package`
andscalafix.syntax
has been removed. -
upgraded to Scalameta 2.0, which has several breaking changes in the Tree api.
-
The
VolatileLazyVal
rule is now named DottyVolatileLazyVal.
Contributors
git shortlog -sn --no-merges v0.4.2..v0.5.0-RC3
shows 5 people contributed to this release.
- Ólafur Páll Geirsson
- Gabriele Petronella
- Guillaume Massé
- Taisuke Oe
- Andy Scott