MegaLinter descriptor

Type: object

Descriptor definition for MegaLinter

No Additional Properties

Active if one of file names found

Type: array of string

Names of the config files to be found (at least one), else descriptor will be deactivated. Search in workspace, linter rules path, and filessubdirectory

No Additional Items

Each item of this array must be:


Example:

[
    ".editorconfig",
    ".eslintrc.json"
]

Flavors

Type: array Default: []

MegaLinter flavors matching this descriptor

No Additional Items

Each item of this array must be:

Type: enum (of string)

Must be one of:

  • "all_flavors"
  • "all"
  • "c_cpp"
  • "ci_light"
  • "cupcake"
  • "documentation"
  • "dotnet"
  • "dotnetweb"
  • "formatters"
  • "go"
  • "java"
  • "javascript"
  • "php"
  • "python"
  • "ruby"
  • "rust"
  • "salesforce"
  • "security"
  • "swift"
  • "terraform"

Example:

[
    "all_flavors",
    "java",
    "php"
]

Flavors

Type: array Default: []

MegaLinter flavors that must not contain this descriptor

No Additional Items

Each item of this array must be:

Type: enum (of string)

Must be one of:

  • "all_flavors"
  • "all"
  • "c_cpp"
  • "ci_light"
  • "cupcake"
  • "documentation"
  • "dotnet"
  • "dotnetweb"
  • "formatters"
  • "go"
  • "java"
  • "javascript"
  • "php"
  • "python"
  • "ruby"
  • "rust"
  • "salesforce"
  • "security"
  • "swift"
  • "terraform"

Example:

[
    "all_flavors",
    "java",
    "php"
]

Descriptor unique identifier

Type: string Default: ""

Uppercase unique identifier for the language, tooling format or identifier


Examples:

"PYTHON"
"XML"
"OPENAPI"

Descriptor label

Type: string Default: ""

Label for descriptor documentation, if different from Id. Ex: C++ for CPP


Examples:

"C++"
"Visual Basic .NET"

Descriptor type

Type: enum (of string) Default: ""

Descriptor type: language, format or tooling format

Must be one of:

  • "language"
  • "format"
  • "tooling_format"
  • "other"

Examples:

"language"
"format"
"tooling_format"
"other"

File content regex filters

Type: array of string Default: []

Regular expression list for filtering files by their content

No Additional Items

Each item of this array must be:


Example:

[
    "AWSTemplateFormatVersion",
    "(AWS|Alexa|Custom)::"
]

File contain regex extensions filters

Type: array of string Default: []

If filecontainsregex is set, use this property to filter extensions of the files that will be checked

No Additional Items

Each item of this array must be:


Example:

[
    "",
    ".json"
]

Allowed file extensions

Type: array of string Default: []

File extension filters. Empty list excludes all files. Can be overridden at linter level

No Additional Items

Each item of this array must be:


Example:

[
    ".py",
    ""
]

Filter on end of file name

Type: array of string Default: []

List of strings to filter the files according to their end of file name

No Additional Items

Each item of this array must be:


Example:

[
    "vault.yml",
    "galaxy.xml"
]

File name regex filters

Type: array of string Default: []

Regular expression list for filtering files by their base names using regex full match. Empty list includes all files. Can be overridden at linter level

No Additional Items

Each item of this array must be:


Example:

[
    "Dockerfile(-.+)?",
    "Jenkinsfile"
]

Files sub-directory

Type: string

Set when a linter only lints a sub-directory


Example:

[
    "ansible",
    "kubernetes"
]

Installation requirements

Type: object Default: {}

List of apk, dockerfile instructions, npm/pip/gem packages required to use the descriptor linters


Examples:

{
    "apk": [
        "openjdk11"
    ]
}
{
    "dockerfile": [
        "ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk",
        "ENV PATH=\"$JAVA_HOME/bin:${PATH}\""
    ]
}
{
    "npm": [
        "sfdx-cli"
    ]
}

List of APK packages (Linux)

Type: array of string

APK packages identifiers (with or without version)

No Additional Items

Each item of this array must be:

Type: string

Example:

[
    "openjdk11"
]

List of Cargo packages (Rust)

Type: array of string

Cargo packages identifiers (with or without version)

No Additional Items

Each item of this array must be:

Type: string

List of Dockerfile instructions packages

Type: array of string

Will be automatically integrated in generated Dockerfile

No Additional Items

Each item of this array must be:


Example:

[
    "ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk",
    "ENV PATH=\"$JAVA_HOME/bin:${PATH}\""
]

List of GEM packages (Ruby)

Type: array of string

GEM packages identifiers (with or without version)

No Additional Items

Each item of this array must be:

Type: string

List of NPM packages (Node.js)

Type: array of string

NPM packages identifiers (with or without version)

No Additional Items

Each item of this array must be:

Type: string

Example:

[
    "sfdx-cli"
]

List of PIP packages (Python)

Type: array of string

PIP packages identifiers (with or without version)

No Additional Items

Each item of this array must be:

Type: string

Lint all files

Type: boolean Default: false

If set to true, this descriptor linters will always lint all files, undepending their name/extensions/content

Lint all other linters files

Type: boolean Default: false

If set to true, this descriptor linters will lint one by one all files collected by all other linters

List of linters

Type: array of object

List of linter definitions associated to the descriptor

No Additional Items

Each item of this array must be:

Linter definition

Type: object

Parameters defining behaviour and installation of a linter

No Additional Properties
Example:

{
    "cli_config_extra_args": [
        "--no-eslintrc",
        "--no-ignore"
    ],
    "config_file_name": ".eslintrc.yml",
    "examples": [
        "eslint myfile.js",
        "eslint -c .eslintrc.yml --no-eslintrc --no-ignore myfile.js"
    ],
    "install": {
        "npm": [
            "eslint",
            "eslint-config-airbnb",
            "eslint-config-prettier",
            "eslint-plugin-jest",
            "eslint-plugin-prettier",
            "babel-eslint"
        ]
    },
    "linter_banner_image_url": "https://d33wubrfki0l68.cloudfront.net/3b5ac7586466159bb6f237b633bfc4f5a8d5acf8/ee0a1/assets/img/posts/eslint-collective.png",
    "linter_name": "eslint",
    "linter_url": "https://eslint.org",
    "name": "JAVASCRIPT_ES"
}

Activation rules

Type: array of object Default: []

List of rules to check to activate linter

No Additional Items

Each item of this array must be:


Example:

[
    {
        "default_value": "standard",
        "expected_value": "prettier",
        "type": "variable",
        "variable": "JAVASCRIPT_DEFAULT_STYLE"
    }
]

Active if one of file names found

Type: array of string

Names of the config files to be found (at least one), else descriptor will be deactivated

No Additional Items

Each item of this array must be:


Example:

[
    ".editorconfig",
    ".eslintrc.json"
]

Can output SARIF

Type: boolean Default: false

Shows if the linter is capable of output SARIF report within MegaLinter

Linter custom python class name

Type: string

If MegaLinter core is not enough, use a custom class inheriting from Linter class


Examples:

"CSpellLinter"
"DotnetFormatLinter"
"RakuLinter"

CLI configuration file argument name if different from -c

Type: string

Default value for config argument, in case it is not a file

Type: string

Additional CLI arguments when config file is used

Type: array of string Default: []

When a configuration file is used with the linter CLI, send these additional arguments

No Additional Items

Each item of this array must be:


Example:

[
    "--no-eslintrc",
    "--no-ignore"
]

CLI docker run arguments

Type: array of string Default: []

Arguments for docker run before image name

No Additional Items

Each item of this array must be:


Example:

[
    "-v",
    "`pwd`:`pwd`",
    "-w",
    "`pwd`"
]

Name of the docker image to use for linting

Type: string

Example:

"norionomura/swiftlint"

Docker image version

Type: string Default: "latest"

Version of the docker image to use for linting


Example:

"0.42.0_swift-5.3.2"

CLI executable for linting request

Type: string

Override if different from linter_name

CLI executable for help request

Type: string

Override if different from cli executable used for linting

CLI executable for version request

Type: string

Override if different from cli executable used for linting

CLI Help argument name if different from -h

Type: string

CLI help extra arguments

Type: array of string

When linter CLI is call for help, send these additional arguments

No Additional Items

Each item of this array must be:

CLI help extra commands

Type: array of string

When linter CLI is call for help, send these additional commands

No Additional Items

Each item of this array must be:

Lint errors count mode

Type: enum (of string)

Defines how to count errors from log file. regexnumber, regexcount, regexsum, or totallines

Must be one of:

  • "regex_number"
  • "regex_count"
  • "regex_sum"
  • "total_lines"
  • "sarif"

Examples:

"regex_number"
"regex_count"
"regex_sum"
"total_lines"

Lint errors number regex

Type: string

Regex allowing to extract the number of errors from linter output logs


Example:

"Issues found: (.*) in .* files"

CLI Lint extra arguments (before config args)

Type: array of string Default: []

When linter CLI is call for linting, send these additional arguments before config args

No Additional Items

Each item of this array must be:

CLI Lint extra arguments (after config args)

Type: array of string Default: []

When linter CLI is call for linting, send these additional arguments after config args

No Additional Items

Each item of this array must be:

If the linter can format or fix, input here the related triggering argument

Type: string

Examples:

"--fix"
"--format"

CLI Lint arguments to remove if fix is activated

Type: array of string Default: []

When linter CLI is call for fixing, remove these arguments

No Additional Items

Each item of this array must be:


Example:

[
    "--check"
]

Path to ignore file argument name

Type: string

If the linter can use an ignore file, input here the related argument


Examples:

"--secretlintignore"
"--ignore-path"

Linting mode

Type: enum (of string) Default: "file"

Defines how the linter is called: file, listoffiles, project

Must be one of:

  • "file"
  • "project"
  • "list_of_files"

CLI SARIF run arguments

Type: array of string Default: []

Arguments to generate SARIF output

No Additional Items

Each item of this array must be:


Example:

[
    "--format",
    "sarif",
    "--output",
    "{{SARIF_OUTPUT_FILE}}"
]

CLI version argument name if different from -v

Type: string

CLI Version extra arguments

Type: array of string

When linter CLI is call for version, send these additional arguments

No Additional Items

Each item of this array must be:

Default file name for the linter configuration file

Type: string

An explanation about the purpose of this instance.


Examples:

".eslintrc.yml"
".markdown-lint.yml"
".python-black"

Is the linter deprecated?

Type: boolean Default: false

Shows if the linter is deprecated.

Description of the deprecated linter

Type: string Default: ""

Displays information on why it is deprecated and whether an alternative is available.

Flavors

Type: array Default: []

MegaLinter flavors matching this linter

No Additional Items

Each item of this array must be:

Type: enum (of string)

Must be one of:

  • "all_flavors"
  • "all"
  • "c_cpp"
  • "ci_light"
  • "cupcake"
  • "documentation"
  • "dotnet"
  • "dotnetweb"
  • "formatters"
  • "go"
  • "java"
  • "javascript"
  • "php"
  • "python"
  • "ruby"
  • "rust"
  • "salesforce"
  • "security"
  • "swift"
  • "terraform"

Example:

[
    "all_flavors",
    "java",
    "php"
]

Flavors

Type: array Default: []

MegaLinter flavors that must not contain this descriptor

No Additional Items

Each item of this array must be:

Type: enum (of string)

Must be one of:

  • "all_flavors"
  • "all"
  • "c_cpp"
  • "ci_light"
  • "cupcake"
  • "documentation"
  • "dotnet"
  • "dotnetweb"
  • "formatters"
  • "go"
  • "java"
  • "javascript"
  • "php"
  • "python"
  • "ruby"
  • "rust"
  • "salesforce"
  • "security"
  • "swift"
  • "terraform"

Example:

[
    "all_flavors",
    "java",
    "php"
]

Disabled

Type: boolean Default: false

Disable linter in MegaLinter next builds

Disabled reason

Type: string Default: false

Explanation about why the linter is disabled

Downgraded reason

Type: string Default: false

Explanation about why the linter is downgraded

Downgraded version

Type: boolean Default: false

Indicates that installation instructions does not use the latest release of the linter

Linter CLI commands examples

Type: array of string

Please add an example with and without configuration file in the command. They will appear in documentation

No Additional Items

Each item of this array must be:


Examples:

[
    "golangci-lint run myfile.go",
    "golangci-lint run -c .golangci.yml myfile.go"
]
[
    "eslint myfile.js",
    "eslint -c .eslintrc.yml --no-eslintrc --no-ignore myfile.js"
]

Allowed file extensions

Type: array of string Default: []

File extension filters if different from the ones defined on parent descriptor

No Additional Items

Each item of this array must be:


Example:

[
    ".py",
    ""
]

Filter on end of file name

Type: array of string Default: []

List of strings to filter the files according to their end of file name

No Additional Items

Each item of this array must be:


Example:

[
    "vault.yml",
    "galaxy.xml"
]

File name regex filters

Type: array of string Default: []

Regular expression list for filtering files by their base names using regex full match. Empty list includes all files. Can be overridden at linter level

No Additional Items

Each item of this array must be:


Example:

[
    "Dockerfile(-.+)?",
    "Jenkinsfile"
]

Files sub-directory

Type: string

Set when a linter only lints a sub-directory


Example:

[
    "ansible",
    "kubernetes"
]

CLI Help valid return code if different from 0

Type: number

IDE Integration

Type: object

List of IDE supporting the linter

Default file name for the linter ignore file

Type: string

An explanation about the purpose of this instance.


Examples:

".eslintignore"
".secretlintignore"

Ignore for flavor suggestions

Type: boolean Default: false

If this property is set to true, this linter will be ignored for flavor suggestions


Examples:

".eslintignore"
".secretlintignore"

Installation requirements

Type: object Default: {}

List of apk, dockerfile instructions, npm/pip/gem packages required to install the linter


Examples:

{
    "dockerfile": [
        "FROM accurics/terrascan:latest as terrascan",
        "COPY --from=terrascan /go/bin/terrascan /usr/bin/",
        "RUN terrascan init"
    ]
}
{
    "npm": [
        "eslint",
        "eslint-config-airbnb",
        "eslint-config-prettier",
        "eslint-plugin-jest",
        "eslint-plugin-prettier",
        "babel-eslint"
    ]
}

List of APK packages (Linux)

Type: array of string

APK packages identifiers (with or without version)

No Additional Items

Each item of this array must be:


Example:

[
    "perl",
    "perl-dev"
]

List of Cargo packages (Rust)

Type: array of string

Cargo packages identifiers (with or without version)

No Additional Items

Each item of this array must be:


Example:

[
    "clippy",
    "sarif-fmt"
]

List of Dockerfile instructions packages

Type: array of string

Will be automatically integrated in generated Dockerfile

No Additional Items

Each item of this array must be:


Example:

[
    "FROM accurics/terrascan:latest as terrascan",
    "COPY --from=terrascan /go/bin/terrascan /usr/bin/",
    "RUN terrascan init"
]

List of GEM packages (Ruby)

Type: array of string

GEM packages identifiers (with or without version)

No Additional Items

Each item of this array must be:


Example:

[
    "rubocop:0.82.0",
    "rubocop-github:0.16.0",
    "rubocop-performance"
]

List of NPM packages (Node.js)

Type: array of string

NPM packages identifiers (with or without version)

No Additional Items

Each item of this array must be:


Example:

[
    "eslint",
    "eslint-config-airbnb@3.2.1"
]

List of PIP packages (Python)

Type: array of string

PIP packages identifiers (with or without version)

No Additional Items

Each item of this array must be:


Example:

[
    "flake8"
]

Is formatter

Type: boolean Default: false

If the linter is just a formatter, set to true so errors will count as warnings

Is SBOM

Type: boolean Default: false

If the linter is SBOM, set to true so extra properties will be returned

Lint all files

Type: boolean Default: false

If set to true, this linter will always lint all files, undepending their name/extensions/content

Lint all other linters files

Type: boolean Default: false

If set to true, this descriptor linters will lint one by one all files collected by all other linters

Linter banner image URL

Type: stringFormat: uri

URL of an image used to build header of linter Markdown documentation


Example:

"https://github.com/stylelint/stylelint/raw/main/identity/stylelint-icon-and-text-white.png"

Hardcoded help content

Type: string

If the linter is unable to return help content, hardcode it here

Linter Icon PNG URL

Type: stringFormat: uri

URL of a PNG image representing the icon of the linter


Example:

"https://github.com/stylelint/stylelint/raw/main/identity/stylelint-icon-and-text-white.png"

Linter image URL

Type: stringFormat: uri

URL of an image used in linter Markdown documentation


Example:

"https://raku.org/camelia-logo.png"

MegaLinter reference URL

Type: string

URL to linter documentation referring to MegaLinter

Linter name

Type: string

Name of the linter (same as cli command if possible)


Example:

"eslint"

Linter URL

Type: stringFormat: uri

URL of the linter repository home page


Example:

"https://github.com/eslint/eslint"

Linter rules configuration URL

Type: stringFormat: uri

URL to linter documentation explaining how to configure the linter

Linter rules ignore config URL

Type: stringFormat: uri

URL to linter documentation explaining how to ignore files

Linter rules inline disable URL

Type: stringFormat: uri

URL to linter documentation explaining how to disable rules directly with comments in files

Linter rules URL

Type: stringFormat: uri

URL to linter documentation listing all the rules that can be detected

spdx license

Type: string

spdx license id of the linter

Speed indicator

Type: enum (of integer)

Average speed of the linter (performances indicator). For 1 (very slow) to 5 (very fast)

Must be one of:

  • 1
  • 2
  • 3
  • 4
  • 5

Additional text for MegaLinter online documentation

Type: string

Linter URL

Type: stringFormat: uri

URL of the linter home page


Example:

"https://eslint.org"

Hardcoded version number

Type: string

If the linter is unable to return a version number, hardcode it here

Linter configuration key

Type: string

When several linters in a descriptor, set a different name that will be used for configuration


Example:

"JAVASCRIPT_ES"

Linter Pre-run commands

Type: array Default: []

Custom bash commands to run after linter

No Additional Items

Each item of this array must be:

Type: object

Command information

Bash command to run

Type: string

Examples:

"npm run test"
"echo \"This is a custom command\""

Continue if failed

Type: boolean Default: true

Folder where to run the command

Type: enum (of string)

Must be one of:

  • "root"
  • "workspace"

Examples:

"root"
"workspace"

Example:

[
    {
        "command": "npm install java-caller",
        "continue_if_failed": false,
        "cwd": "root"
    },
    {
        "command": "echo \"linter post-run command has been called\"",
        "cwd": "workspace"
    }
]

Linter Pre-run commands

Type: array Default: []

Custom bash commands to run before linter

No Additional Items

Each item of this array must be:

Type: object

Command information

Bash command to run

Type: string

Examples:

"npm run test"
"echo \"This is a custom command\""

Continue if failed

Type: boolean Default: true

Folder where to run the command

Type: enum (of string)

Must be one of:

  • "root"
  • "workspace"

Examples:

"root"
"workspace"

Example:

[
    {
        "command": "tflint --init",
        "continue_if_failed": false,
        "cwd": "root"
    },
    {
        "command": "echo \"linter pre-run command has been called\"",
        "cwd": "workspace"
    }
]

SARIF default output file

Type: string

Path to find default SARIF output file when generated by linter


Example:

[
    "./results.sarif"
]

Test folder in .automation/

Type: string

Test folder containing good and bad files, if different from parent descriptor test_folder


Example:

[
    "bash_shfmt",
    "terraform_terrascan"
]

Allowed file extensions

Type: array of string Default: []

Format / Fix test file extension filters.

No Additional Items

Each item of this array must be:


Example:

[
    ".py",
    ""
]

Format / Fix test exclusions

Type: string

Format / Fix test exclusions


Example:

[
    "/bin/|/obj/"
]

Test variables

Type: object

List of variables to set before running tests


Example:

{
    "JAVASCRIPT_DEFAULT_STYLE": "prettier"
}

Custom extra variables for the linter

Type: array

Try to not use this property except if you really have no choice

No Additional Items
Example:

{
    "default_value": "false",
    "description": "If set to `false`, the `bash-exec` linter will report a warning if a shell script is not executable. If set to `true`, the `bash-exec` linter will report an error instead",
    "name": "ERROR_ON_MISSING_EXEC_BIT"
}

CLI version valid return code if different from 0

Type: number

Regex to extract version

Type: string

If default regex to extract version from linter -v call, override it here


Example:

"(?<=npm-groovy-lint version )\\d+(\\.\\d+)+"

Example:

[
    {
        "cli_config_extra_args": [
            "--no-eslintrc",
            "--no-ignore"
        ],
        "config_file_name": ".eslintrc.yml",
        "examples": [
            "eslint myfile.js",
            "eslint -c .eslintrc.yml --no-eslintrc --no-ignore myfile.js"
        ],
        "install": {
            "npm": [
                "eslint",
                "eslint-config-airbnb",
                "eslint-config-prettier",
                "eslint-plugin-jest",
                "eslint-plugin-prettier",
                "@babel/eslint-parser"
            ]
        },
        "linter_banner_image_url": "https://d33wubrfki0l68.cloudfront.net/3b5ac7586466159bb6f237b633bfc4f5a8d5acf8/ee0a1/assets/img/posts/eslint-collective.png",
        "linter_name": "eslint",
        "linter_url": "https://eslint.org",
        "name": "JAVASCRIPT_ES"
    },
    {
        "examples": [
            "standard myfile.js"
        ],
        "install": {
            "npm": [
                "standard"
            ]
        },
        "linter_banner_image_url": "https://github.com/standard/standard/raw/master/sticker.png",
        "linter_name": "standard",
        "linter_url": "https://github.com/standard/standard",
        "name": "JAVASCRIPT_STANDARD"
    }
]

Descriptor processing order

Type: number Default: 0

If descriptor linters may be slow, put a negative processing order. If it is fast, put a positive one. If you don't know, do not set


Example:

[
    -9,
    0,
    9
]

Test folder in .automation/

Type: string

Test folder containing good and bad files. Default: lowercase(descriptor_id)


Example:

[
    "bash_shfmt",
    "terraform_terrascan"
]