SwitfLint

A tool to enforce Swift style and conventions.

Version

0.33.1

Runtime

Swift 5.0.1

Supported Languages

Swift

Official Documentation

https://github.com/realm/SwiftLint/tree/0.33.1

YAML Configuration

swiftlint:

  • input:

    Patterns to include in reports.

    Note: The input patterns are not applied when running SwiftLint therefore the files excluded by the patterns are always processed and you may even see logs related to the excluded files in the job console, but Inspecode eventually ignores any issues detected on the excluded files when generating job reports.

  • ignore:

    Patterns to exclude from reports.

    Note: The ignore patterns are not applied when running SwiftLint as same as input:.

  • auto-fix:

    true/false

  • config-file:

    Alias of --config option.

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.5 CPU with 1920 MiB RAM.

  • options:

    Below is the list of options that are supported:

    [--config (string)]
      the path to SwiftLint's configuration file
    
    [--lenient]
      downgrades serious violations to warnings, warning threshold is disabled
    
    [--force-exclude]
      exclude files in config `excluded` even if their paths are explicitly specified
    
    [--enable-all-rules]
      run all rules, even opt-in and disabled ones, ignoring `whitelist_rules`
    
    [--format]
      should reformat the Swift files
    

YAML Examples

  • With default options:

    inspecode:
      swiftlint: default
    
  • With custom machine:

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

    inspecode:
      swiftlint:
        options:
          --lenient:
    
  • With a configuration file:

    inspecode:
      swiftlint:
        config-file: .swiftlint.yml
    

    The above configuration is equivalent to:

    inspecode:
      swiftlint:
        options:
          --config: .swiftlint.yml
    

Configuration File Detection

If no configuration files are specified via config-file or options field, Inspecode first lets SwiftLint to find configuration files in your repository. See https://github.com/realm/SwiftLint/tree/0.26.0#configuration about how SwiftLint looks for configuration files.

In addition, if SwiftLint cannot find any configuration files, Inspecode also walks the file tree in lexical order in your repository to find a configuration file named .swiftlint.yml and specifies the file first found to SwiftLint automatically via --config option.

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:
  swiftlint:
    config-file: ""

results matching ""

    No results matching ""