scalaintellij-ideascalastyle

export Intellij Idea scala static analysis rules into a scalastyle_configuration file


I want to keep the predefined static analysis rules from Intellij Idea in a scalastyle_configuration file and run the check at prepush githook in order to enforce those rules across our team. Is there a standard way to do so ?


Solution

  • IntelliJ inspections aren't based on ScalaStyle. But you can run them standalone or from a CI server using the inspect.sh or inspect.bat scripts from your IntelliJ installation with the following parameters:

    OSX example:

    /Applications/IntelliJ IDEA.app/Contents/bin/inspect.sh ~/IntelliJ IDEAProjects/MyTestProject ~/Library/Preferences/ideaXX/inspection/Default.xml ~/IntelliJ IDEAProjects/MyTestProject/results-dir -v2
    

    For more details, see the documentation on how to run them standalone: https://www.jetbrains.com/help/idea/2016.3/running-inspections-offline.html#d2149225e24

    Or from TeamCity: https://confluence.jetbrains.com/display/TCD10/Inspections