Skip to content

Markdownlint doesn’t support "--disable" argument #263

Description

@echoix

Describe the bug
When using the following command argument, markdownlint throws an error saying the ``--disableargument is not supported:.mega-linter.yaml` snippet

# Disable Line Length on markdown files
MARKDOWN_MARKDOWNLINT_ARGUMENTS:
  - --disable MD013

Error

--Error detail:
error: unknown option '--disable MD013'

Executed MegaLinter command

- Command: [markdownlint --fix --disable MD013 -c /action/lib/.automation/.markdownlint.json .github/ISSUE-TEMPLATE/bug_report.md .github/ISSUE-TEMPLATE/feature_request.md .github/pull_request-template.md CODE-OF-CONDUCT.md CONTRIBUTING.md DEVELOPMENT.md README....(truncated)]

To Reproduce
Steps to reproduce the behavior:

  • Add the following to your megalinter configuration file
# Disable Line Length on markdown files
MARKDOWN_MARKDOWNLINT_ARGUMENTS:
  - --disable MD013
  • Run npx mega-linter-runner

Expected behavior

I would expect no errors and markdownlint to run as normal with this rule disabled.

Additional context
The error message indicates that this version of markdownlint doesnt support the --disable argument however adding the following precommand

MARKDOWN_MARKDOWNLINT_PRE_COMMANDS:
  - command: markdownlint --help

prints out the following:

⚠️ Linted [MARKDOWN] files with [markdownlint]: Found 1 non blocking error(s) and 0 non blocking warning(s) - (3.77s)
- Using [markdownlint v0.45.0] https://megalinter.io/8.8.0/descriptors/markdown_markdownlint
- MegaLinter key: [MARKDOWN_MARKDOWNLINT]
- Rules config: [.markdownlint.json]
- Number of files analyzed: [8]
- Command: [markdownlint --fix --disable MD013 -c /action/lib/.automation/.markdownlint.json .github/ISSUE-TEMPLATE/bug_report.md .github/ISSUE-TEMPLATE/feature_request.md .github/pull_request-template.md CODE-OF-CONDUCT.md CONTRIBUTING.md DEVELOPMENT.md README....(truncated)]
[Pre][MARKDOWN_MARKDOWNLINT] run: [markdownlint --help] in cwd [/]
[Pre][MARKDOWN_MARKDOWNLINT] result:
Usage: markdownlint [options] [files|directories|globs...]

MarkdownLint Command Line Interface

Arguments:
  files|directories|globs                    files, directories, and/or globs to lint

Options:
  -V, --version                              output the version number
  -c, --config <configFile>                  configuration file (JSON, JSONC, JS, YAML, or TOML)
  --configPointer <pointer>                  JSON Pointer to object within configuration file (default: "")
  -d, --dot                                  include files/folders with a dot (for example `.github`)
  -f, --fix                                  fix basic errors (does not work with STDIN)
  -i, --ignore <file|directory|glob>         file(s) to ignore/exclude (default: [])
  -j, --json                                 write issues in json format
  -o, --output <outputFile>                  write issues to file (no console)
  -p, --ignore-path <file>                   path to file with ignore pattern(s)
  -q, --quiet                                do not write issues to STDOUT
  -r, --rules <file|directory|glob|package>  include custom rule files (default: [])
  -s, --stdin                                read from STDIN (does not work with files)
  --enable <rules...>                        Enable certain rules, e.g. --enable MD013 MD041 --
  --disable <rules...>                       Disable certain rules, e.g. --disable MD013 MD041 --
  -h, --help                                 display help for command

--Error detail:
error: unknown option '--disable MD013'

Which indicates it is supported.

If I run the linter locally without megalinter by using the following command:

markdownlint --fix --disable MD013 -c ./megalinter-reports/IDE-config/.markdownlint.json 

It works as expected.

The contents of ./megalinter-reports/IDE-config/.markdownlint.json are as follows:

{
  "MD004": false,
  "MD007": {
    "indent": 2
  },
  "MD013": {
    "line_length": 400
  },
  "MD026": {
    "punctuation": ".,;:!。,;:"
  },
  "MD029": false,
  "MD033": false,
  "MD036": false,
  "blank_lines": false
}

And the full contents of .mega-linter.yaml is as follows:

# Configuration file for MegaLinter
#
# See all available variables at https://megalinter.io/latest/config-file/ and in
# linters documentation

# all, none, or list of linter keys
APPLY_FIXES: all

# If you use ENABLE variable, all other languages/formats/tooling-formats will
# be disabled by default
# ENABLE:

# If you use ENABLE_LINTERS variable, all other linters will be disabled by
# default
# ENABLE_LINTERS:

DISABLE_LINTERS:
  - SPELL_CSPELL
  - REPOSITORY_CHECKOV
  - REPOSITORY_TRUFFLEHOG
  - REPOSITORY_TRIVY_SBOM
  - REPOSITORY_TRIVY
  - REPOSITORY_SYFT
  - REPOSITORY_GRYPE
  - COPYPASTE_JSCPD
  - REPOSITORY_KICS
  - SPELL_LYCHEE
  - REPOSITORY_DEVSKIM
SHOW_ELAPSED_TIME: true

# Uncomment if you want MegaLinter to detect errors but not block CI to pass
# DISABLE_ERRORS: true
GITHUB_COMMENT_REPORTER: true
GITHUB_STATUS_REPORTER: true
VALIDATE_ALL_CODEBASE: true
OUTPUT_DETAIL: detailed
# Disable Line Length on markdown files
MARKDOWN_MARKDOWNLINT_ARGUMENTS:
  - --disable MD013
MARKDOWN_MARKDOWNLINT_PRE_COMMANDS:
  - command: markdownlint --help

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions