Scalastyle

Scalastyle examines your Scala code and indicates potential problems with it.

Version

1.0.0

Note: This tool offers a different jar for each scala version. Inspecode uses the jar associated with the specified scala version.

Runtime

OpenJDK 8

Supported Languages

Scala

Official Documentation

http://www.scalastyle.org/

YAML Configuration

scalastyle:

  • input:

    Patterns to include in execution and reports.

  • ignore:

    Patterns to exclude from execution and reports.

  • auto-fix:

    N/A

  • config-file:

    Alias of --config option.

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.25 CPU with 960 MiB RAM.

      Inspecode configures the maximum heap size (-Xmx) of the Java virtual machine (JVM) according to this value. Inspecode reserves 240 MiB RAM for system, and makes the rest of RAM available to JVM for heap allocation. For example, -Xmx720m is specified by default (for 0.25 CPU), -Xmx5520m is specified for 1.5 CPU.

  • options:

    Below is the list of options that are supported:

    -c, --config FILE               configuration file (required)
        --inputEncoding STRING      encoding for the source files
    -e, --externalJar FILE          jar containing custom rules
    -x, --excludedFiles STRING      regular expressions to exclude file paths (delimitted by semicolons)
    
  • thresholds:

    • num-issues:

      No tool specific severity levels are available.

  • experimental:

    • incremental:

      true/false

      Note: The incremental analysis is disabled if any kinds of configuration files are changed. The files recognized as configuration files are as follows:

      • Configuration files:
        • Files specified in config-file field
        • Files specified to -c, --config options
        • If none of the above configuration files are found:
          • **/scalastyle_config.xml, **/scalastyle-config.xml
      • JAR files:
        • Files specified to -e, --externalJar options

YAML Examples

  • With default options:

    inspecode:
      scalastyle: default
    
  • With custom machine:

    inspecode:
      scalastyle:
        machine:
          cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
    
  • With custom options:

    inspecode:
      scalastyle:
        options:
          --externalJar: nofoobarchecker.jar
    
  • With a configuration file:

    inspecode:
      scalastyle:
        config-file: lib/scalastyle_config.xml
    

    The above configuration is equivalent to:

    inspecode:
      scalastyle:
        options:
          --config: lib/scalastyle_config.xml
    

Configuration File Detection

If no configuration files are specified via config-file or options field, Inspecode walks the file tree in lexical order in your repository to find one of the following configuration files and specifies the file first found to Scalastyle automatically via --config option.

  • scalastyle_config.xml
  • scalastyle-config.xml

Note: Inspecode ignores specific configuration files while searching. See Configuration > Tool Configuration > Field: config-file for detail.

If the configuration file detected by Inspecode is not the one you want to use or you do not want to use any configuration files, you can disable Inspecode from detecting configuration files by explicitly setting an empty string to config-file field like below:

inspecode:
  scalastyle:
    config-file: ""

If there are no configuration files in your repository, Inspecode specifies the default configuration file to Scalastyle by default since Scalastyle always requires a configuration file via -c or --config option.

results matching ""

    No results matching ""