Contributions to Scalafix are welcome! This document is a guide to help you get familiar with the Scalafix build, if you are unsure about anything, don't hesitate to ask in the gitter channel.
scalafix-core/data structures for rewriting and linting Scala source code.
scalafix-reflect/utilities to compile and classload rules from configuration.
scalafix-rules/built-in rules such as
scalafix-tests/projects for unit and integration tests.
scalafix-docs/documentation code for the Scalafix website.
The project should import normally into IntelliJ and there should not be any
false red squiggles. To use the debugger or run tests from withing IntelliJ, run
at least once
sbt unit/test to generate a
BuildInfo file and property files
for Scalafix testkit.
Start an sbt shell with
$ sbt. The commands below assume you have a running
> unit/test # Fast unit tests for rules, cli, core. Contains a lot # of different test suites, so it's recommended to use testOnly. > unit/testOnly *RuleSuite # Only run tests for rules, using scalafix-testkit. > unit/testOnly *RuleSuite -- -z ProcedureSyntax # Only run only ProcedureSyntax unit test.
Unit tests for rules are written using scalafix-testkit
scalafix-tests ├── input # Source files to be analyzed and fixed by rules ├── output # Expected output from running rewrite rules ├── shared # Code that is shared between input and unit projects └── unit # Unit test suites.
Be sure to run
scalafmt (available in the root folder) to ensure code
./scalafmt --diff formats only the files that have changed from
the master branch. You can read more about it at http://scalafmt.org
First, make sure you have the yarn package manager installed installed.
Next, start sbt and compile the markdown documentation. The documentation will re-generate on file save.
$ sbt > docs/run -w
To view the website in your browser, start the Docusaurus live reload server
cd website yarn install yarn start
Consult the Docusaurus website for instructions on how to customize the sidebar or tweak the landing page.
To avoid breaking binary compatiblity we use the Migration Manage for Scala or Mima for short.
Anything under the package
scalafix.internal._ does not have compatibility
sbt mimaReportBinaryIssues to check for any compatibility issues.
Scalafix uses sbt-ci-release to automate Sonatype releases. A new SNAPSHOT release is published on every merge into master. A stable release is published to Maven Central on every git tag.
export APPVEYOR_TOKEN="<your-api-token>" curl -vvv -H "Authorization: Bearer $APPVEYOR_TOKEN" -XDELETE https://ci.appveyor.com/api/projects/scalacenter/scalafix/buildcache
[ ] Releases > "Draft a new release"
[ ] Write changelog, linking to each merged PR and attributing contributor, following a similar format as previous release notes.
[ ] "Publish release", this pushes a tag and triggers the CI to release to sonatype.
[ ] after CI releases, double check the end of logs of the entry where CI_PUBLISH=true. You have to expand the after_success section.
[ ] after sonatype release is completed, double check after ~30 minutes that the artifacts have synced to maven by running this command:
coursier fetch ch.epfl.scala:scalafix-core_2.12:VERSION
[ ] once the artifacts are synced to maven, go to the scalafix repo and update the
scalafixbinary with the following command and open a PR to the scalafix repo.
coursier bootstrap ch.epfl.scala:scalafix-cli_2.12.4:VERSION -f --main scalafix.cli.Cli -o scalafix -f
If everything went smoothly, congrats!
If something goes wrong for any reason making the artifacts not reach maven, delete the pushed tag with the following command
TAG=??? # for example "v0.5.3" git tag -d $TAG git push origin :refs/tags/$TAG
It's important that the latest tag always has an accompanying release on Maven. If there is no release matching the latest tag then the docs will point to scalafix artifacts that cannot be resolved.