Skip to content

Commit

Permalink
1.0.0 Release candidate (#37)
Browse files Browse the repository at this point in the history
Switched to using scalafmt-dynamic over scalafmt-cli
Added support for remote config files
Added support for validating sources without rewriting files
  • Loading branch information
SimonJPegg authored Sep 14, 2019
1 parent 9be3bc3 commit 662b07b
Show file tree
Hide file tree
Showing 40 changed files with 1,161 additions and 591 deletions.
24 changes: 9 additions & 15 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,29 @@ labels: ''
assignees: ''

---

(this template is a suggestion, not a requirement)

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- maven version [e.g. 3.5.1]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Environment (please complete the following information):**
- OS: (e.g. iOS)
- maven version (e.g. 3.5.1)
- scalafmt version (e.g. 1.5.1)
- Version (e.g. 22)

**Additional context**
Add any other context about the problem here.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ labels: ''
assignees: ''

---

(this template is a suggestion, not a requirement)

**Is your feature request related to a problem? Please describe.**
Expand Down
20 changes: 20 additions & 0 deletions .maven.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xsi:schemalocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>travis</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<properties>
<gpg.executable>${env.GPG_EXECUTABLE}</gpg.executable>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
17 changes: 17 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
version = "2.0.0-RC1"
style = defaultWithAlign
maxColumn = 120
continuationIndent.callSite = 2
continuationIndent.defnSite = 2
align.openParenDefnSite = false
align.openParenCallSite = false
danglingParentheses = true
indentOperator = spray
rewrite.rules = [RedundantBraces, RedundantParens, SortModifiers, prefercurlyfors]
unindentTopLevelOperators = true
importSelectors = singleLine
spaces.afterKeywordBeforeParen = true
lineEndings = unix
newlines.penalizeSingleSelectMultiArgList = false
newlines.alwaysBeforeElseAfterCurlyIf = false
binPack.literalArgumentLists = false
runner.optimizer.forceConfigStyleMinArgCount = 1
21 changes: 15 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
language: scala

jdk:
- openjdk8

before_install:
- wget http://apache.mirror.gtcomm.net/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz
- tar xzvf apache-maven-3.6.0-bin.tar.gz
- export PATH=`pwd`/apache-maven-3.6.0/bin:$PATH
- mvn -v
- wget http://apache.mirror.gtcomm.net/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
- tar xzvf apache-maven-3.6.1-bin.tar.gz
- export PATH=`pwd`/apache-maven-3.6.1/bin:$PATH
- echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import
- echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust
- echo $TRAVIS_BRANCH

install:
mvn --settings .maven.xml install -B -V

script:
mvn -Dversion.scalafmt=1.5.1 clean test -Ptest
cache:
directories:
- ~/.m2/repository
74 changes: 34 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,48 @@

A wrapper that allows the use of the [Scalafmt](https://github.com/scalameta/scalafmt/) formatter in Maven.

## Versioning

The versioning of this plugin follows the following format:

```xml
<artifactId>mvn-scalafmt_${scala.version}</artifactId>
<version>${plugin-version}-${scalafmt-version}</version>
```

Current supported versions (of Scalafmt) are 1.1.0 - 1.5.1. For example, to use the latest version
of the plugin with the latest version of scala-fmt you should set the version to 0.10_1.5.1 in your pom.
Note `scala.version` refers to binary versions of scala i.e. `2.11` or `2.12`.

## Usage

Add the following snippet to your pom; anything in \<parameters\> will be
passed through to the CLI as is.
Add the following snippet to your pom.

Note: `version.scala.binary` refers to major releases of scala ie. 2.11 or 2.12 (scalafmt-dynamic doesn't currently support 2.13).

```xml
<plugin>
<groupId>org.antipathy</groupId>
<artifactId>mvn-scalafmt_${scala.version}</artifactId>
<version>0.10_${scalafmt.version}</version>
<configuration>
<parameters>--diff</parameters> <!-- (Optional) Additional command line arguments -->
<skip>false</skip> <!-- (Optional) skip formatting -->
<skiptest>false</skiptest> <!-- (Optional) Skip formatting test sources -->
<skipmain>false</skipmain> <!-- (Optional) Skip formatting main sources -->
<configLocation>${project.basedir}/path/to/scalafmt.conf</configLocation> <!-- (Optional) config location -->
<configRequired>false</configRequired><!-- (Optional) raise an error if configLocation is missing or invalid (otherwise use Scalafmt defaults) -->
<sourceDirectories> <!-- (Optional) Paths to source-directories. Overrides ${project.build.sourceDirectory}/../scala -->
<param>${project.basedir}/src/main/scala</param>
</sourceDirectories>
<testSourceDirectories> <!-- (Optional) Paths to test-source-directories. Overrides ${project.build.testSourceDirectory}/../scala -->
<param>${project.basedir}/src/test/scala</param>
</testSourceDirectories>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
<groupId>org.antipathy</groupId>
<artifactId>mvn-scalafmt_${version.scala.binary}</artifactId>
<version>1.0.1</version>
<configuration>
<configLocation>${project.basedir}/.scalafmt.conf</configLocation> <!-- path to config -->
<skipTestSources>false</skipTestSources> <!-- (Optional) skip formatting test sources -->
<skipSources>false</skipSources> <!-- (Optional) skip formatting main sources -->
<respectVersion>false</respectVersion> <!-- (Optional) fail if no version set in scalafmt.conf -->
<sourceDirectories> <!-- (Optional) Paths to source-directories. Overrides ${project.build.sourceDirectory} -->
<param>${project.basedir}/src/main/scala</param>
</sourceDirectories>
<testSourceDirectories> <!-- (Optional) Paths to test-source-directories. Overrides ${project.build.testSourceDirectory} -->
<param>${project.basedir}/src/test/scala</param>
</testSourceDirectories>
<validateOnly>false</validateOnly> <!-- check formatting without changing files -->
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
```

`configLocation` Can either be a local path (e.g. `${project.basedir}/.scalafmt.conf`) or a HTTP url (e.g `https://raw.githubusercontent.com/jozic/scalafmt-config/master/.scalafmt.conf`)

make sure you have set a version in your scalafmt.conf
```yaml
version = "1.5.1"
```

[licenseimg]: https://img.shields.io/badge/Licence-Apache%202.0-blue.svg
[licenselink]: ./LICENSE

Expand Down
7 changes: 0 additions & 7 deletions deploy.sh

This file was deleted.

Loading

0 comments on commit 662b07b

Please sign in to comment.