GithubHelp home page GithubHelp logo

maischbe / maven-scalafmt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ashwanthkumar/maven-scalafmt

0.0 0.0 0.0 25 KB

Wrapper to launch scalafmt through Maven

License: Apache License 2.0

Java 100.00%

maven-scalafmt's Introduction

Synopsis

This is a wrapper that allows you to use the Scalafmt formatter in Mvn. Current version of the embedded Scalafmt is 0.2.11

Usage

There are two goals by default you can use: verify and format. Verify will launch as default scalafmt with --test -f . through your maven projects. Format will launch as default scalafmt with -i -f . through your maven projects.

To include it into your pom.xml, just specify some lines as below in the phase you want to format/verify your code:

<plugin>
  <groupId>com.devsmobile</groupId>
  <artifactId>mvn-scalafmt</artifactId>
  <version>0.2.11</version>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
        <goal>format</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Or

<plugin>
  <groupId>com.devsmobile</groupId>
  <artifactId>mvn-scalafmt</artifactId>
  <version>0.2.11</version>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
        <goal>verify</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Additional parameters

If you want to change the default parameters for the format/verify goals, you can provide it in the following properties:

<plugin>
  <groupId>com.devsmobile</groupId>
  <artifactId>mvn-scalafmt</artifactId>
  <version>0.2.11</version>
  <configuration>
    <formatParameters>--maxColumn 110 -i -f .</formatParameters>
    <verifyParameters>--test --maxColumn 110 -f .</verifyParameters>
  </configuration>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
        <goal>format</goal>
        <goal>verify</goal>
      </goals>
    </execution>
  </executions>
</plugin>

##Debug If you are finding an strange behaviour with the plugin you can check the exit from scalafmt using -X mvn option which provides Debug log. Also you can remove from your ~/.scalafmt the jar that is copied in order to use the plugin from maven.

##Limitations For now only Linux/Unix is provided. I'm looking to extend it to Windows.

maven-scalafmt's People

Contributors

pianista215 avatar ashwanthkumar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.