Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sbt/sbt-scalariform
sbt plugin adding support for source code formatting using Scalariform
https://github.com/sbt/sbt-scalariform
Last synced: 5 days ago
JSON representation
sbt plugin adding support for source code formatting using Scalariform
- Host: GitHub
- URL: https://github.com/sbt/sbt-scalariform
- Owner: sbt
- Created: 2012-10-04T07:19:54.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2019-06-29T12:57:08.000Z (over 5 years ago)
- Last Synced: 2025-01-10T03:08:42.421Z (12 days ago)
- Language: Scala
- Size: 134 KB
- Stars: 258
- Watchers: 24
- Forks: 63
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-sbt-plugins - sbt-scalariform - sbt plugin adding support for source code formatting using Scalariform (TEST & QA)
README
sbt-scalariform
===============Welcome to sbt-scalariform, an sbt plugin adding support for source code formatting
using Scalariform.Installing
--------------------------```
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3")
```Configuration (build.sbt)
----------------------Imports
```
import scalariform.formatter.preferences._
```Example Preferences:
```
scalariformPreferences := scalariformPreferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentConstructorArguments, true)
.setPreference(DanglingCloseParenthesis, Preserve)
```Sources are automatically formatted on `compile` and `test:compile` by default.
To enable Scalariform for integration tests in addition to `compile` and `test:compile` add to the build:
```
scalariformItSettings
```Other useful configuration options are provided by sbt setting keys:
- `includeFilter in scalariformFormat`: Defaults to **.scala*
- `excludeFilter in scalariformFormat`: Using the default of sbtConfiguration (filesystem)
----------------------Copy [default Scalariform preferences](https://github.com/scala-ide/scalariform/blob/master/formatterPreferences.properties)
and create a preferences file globally in `~/.scalariform.conf`, or locally in `projectRoot/.scalariform.conf`.Modify preferences accordingly.
Note: It is *not* recommended to mix build and filesystem level preferences. If for some reason this is required,
to override, for example, global filesystem preferences, create an empty `.scalariform.conf` file in the project root
and define build level preferences accordingly.Disable Autoformatting / Enable Formatting of Base Directory Sources
----------------------Custom configuration options can be applied in the build, or in a `.scalariform.conf` preferences file.
Build
```
scalariformAutoformat := false
scalariformWithBaseDirectory := true
```Filesystem
add to the top of target `.scalariform.conf` file:
```
autoformat=false
withBaseDirectory=true
```License
-------This code is open source software licensed under the Apache 2.0 License.