mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-22 14:10:56 -05:00
6.3 KiB
6.3 KiB
Disabling linters and rules
If you find you need to ignore certain errors and warnings, you will need to know the format to disable the linter rules.
Below is examples and documentation for each language and the various methods to disable.
Ruby
Rubocop Config file
.ruby-lint.yml
- You can pass multiple rules and overwrite default rules
- File should be located at:
.github/linters/.ruby-lint.yml
- Note: We use the Default GitHub Rule set from Rubocop-GitHub
Rubocop disable single line
method(argument) # rubocop:disable SomeRule, SomeOtherRule
Rubocop disable code block
# rubocop:disable
This is a long line
var="this is some other stuff"
# rubocop:enable
Rubocop disable entire file
If you need to ignore an entire file, you can update the .ruby-lint.yml
to ignore certain files and locations
inherit_from:
- .rubocop_todo.yml
- .rubocop_app_overrides.yml
inherit_mode:
merge:
- Exclude
Rails:
Enabled: true
AllCops:
TargetRubyVersion: 2.5.1
EnabledByDefault: true
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'bin/{rails,rake}'
- !ruby/regexp /old_and_unused\.rb$/
Shell
Shellcheck is an opensource tool we use for linting and validation of shell scripting.
Shellcheck Config file
- There is no top level configuration file available at this time
Shellcheck disable single line
echo "Terrible stuff" # shellcheck disable=SC2059,SC2086
Shellcheck disable code block
# shellcheck disable=SC2059,SC2086
echo "some hot garbage"
echo "More garbage code"
Shellcheck disable entire file
- Note: The disable must be on the second line of the code right after the shebang
#!/bin/sh
# shellcheck disable=SC2059,SC1084
echo "stuff"
moreThings()
Ansible
Ansible-lint Config file
Ansible-lint disable single line
Ansible-lint disable code block
Ansible-lint disable entire file
YAML
Yamllint Config file
Yamllint disable single line
Yamllint disable code block
Yamllint disable entire file
Python3
Pylint Config file
Pylint disable single line
Pylint disable code block
Pylint disable entire file
JSON
JsonLint Config file
JsonLint disable single line
JsonLint disable code block
JsonLint disable entire file
Markdown
Markdownlint Config file
.markdown-lint.yml
- You can pass multiple rules and overwrite default rules
- File should be located at:
.github/linters/.markdownlint.yml
Markdownlint disable single line
## Here is some document
Here is some random data
<!-- markdownlint-disable -->
any violation you want
<!-- markdownlint-restore -->
Here is more data
Markdownlint disable code block
## Here is some document
Here is some random data
<!-- markdownlint-disable -->
any violations you want
<!-- markdownlint-restore -->
Here is more data
Markdownlint disable entire file
- You can encapsulate the entire file with the code block format to disable an entire file from being parsed