2020-04-23 12:22:10 -04:00
# Disabling linters and Rules
2020-07-21 13:08:05 -04:00
2020-06-30 12:42:59 -04:00
Linters can often require additional configuration to ensure they work with your codebase and your team's coding style, to avoid flagging false-positives. The **GitHub Super-Linter** has set up some default configurations for each linter which should work reasonably well with common code bases, but many of the linters can be configured to disable certain rules or configure the rules to ignore certain pieces of codes.
2020-06-30 09:53:08 -04:00
2020-06-30 10:13:25 -04:00
To run with your own configuration for a linter, copy the relevant [`TEMPLATE` configuration file for the linter you are using from this repo ](https://github.com/github/super-linter/tree/master/TEMPLATES ) into the `.github/linters` folder in your own repository, and then edit it to modify, disable - or even add - rules and configuration to suit how you want your code checked.
2020-06-30 09:53:08 -04:00
2020-06-30 12:42:59 -04:00
How the changes are made differ for each linter, and also how much the **Github Super-Linter** has decided to change the linter's defaults. So, for some linters (e.g. [pylint for python ](https://github.com/github/super-linter/blob/master/TEMPLATES/.python-lint )), there may be a large configuration file. For others (e.g. [stylelint for CSS ](https://github.com/github/super-linter/blob/master/TEMPLATES/.stylelintrc.json )) the default configuration file may initially be nearly empty. And for some (e.g. StandardJS) it may not be possible to change configuration at all so there is no Template file.
2020-06-30 09:53:08 -04:00
2020-06-30 12:42:59 -04:00
Where a configuration file exists in your repo, it will be used in preference to the default one in the **GitHub Super-Linter** `TEMPLATES` directory (not in addition to it), and where one doesn't exist the `TEMPLATES` version will be used. So you should copy the complete configuration file you require to change from the `TEMPLATES` directory and not just the lines of config you want to change.
2020-06-30 09:53:08 -04:00
2020-07-21 13:08:05 -04:00
It is possible to have custom configurations for some linters, and continue to use the default from `TEMPLATES` directory for others, so if you use `Python` and `JavaScript` and only need to tweak the `Python` rules, then you only need to have a custom configuration for _pylint_ and continue to use the default `TEMPLATE` from the main repo for _ESLint_ , for example.
2020-06-30 09:53:08 -04:00
For some linters it is also possible to override rules on a case by case level with directives in your code. Where this is possible we try to note how to do this in the specific linter sections below, but the official linter documentation will likely give more detail on this.
2020-06-24 00:50:54 -04:00
2020-04-23 12:22:10 -04:00
## Table of Linters
2020-07-21 13:08:05 -04:00
2020-04-23 10:57:18 -04:00
- [Ruby ](#ruby )
- [Shell ](#shell )
- [Ansible ](#ansible )
- [YAML ](#yaml )
2020-06-19 12:41:19 -04:00
- [AWS CloudFormation templates ](#cfn )
2020-04-23 10:57:18 -04:00
- [Python ](#python3 )
- [JSON ](#json )
- [Markdown ](#markdown )
- [Perl ](#perl )
2020-07-05 22:21:13 -04:00
- [Raku ](#raku )
2020-06-18 13:53:24 -04:00
- [PHP ](#php )
2020-04-23 10:57:18 -04:00
- [XML ](#xml )
- [Coffeescript ](#coffeescript )
2020-04-23 12:18:58 -04:00
- [Javascript Eslint ](#javascript-eslint )
- [Javascript Standard ](#javascript-standard )
- [Typescript Eslint ](#typescript-eslint )
- [Typescript Standard ](#typescript-standard )
2020-04-23 10:57:18 -04:00
- [Golang ](#golang )
- [Dockerfile ](#dockerfile )
- [Terraform ](#terraform )
2020-06-29 20:00:16 -04:00
- [CSS ](#css )
2020-06-19 13:32:07 -04:00
- [ENV ](#dotenv-linter )
2020-06-21 03:59:18 -04:00
- [Kotlin ](#kotlin )
2020-06-25 06:21:11 -04:00
- [OpenAPI ](#openapi )
2020-06-28 07:07:51 -04:00
- [Protocol Buffers ](#protocol-buffers )
2020-07-23 08:55:56 -04:00
- [Clojure ](#clojure )
2020-06-21 03:16:45 -04:00
- [EDITORCONFIG-CHECKER ](#editorconfig-checker )
2020-07-04 18:14:27 -04:00
- [HTML ](#html )
2020-04-23 10:57:18 -04:00
<!-- toc -->
2020-04-23 11:38:33 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
## Ruby
2020-07-21 13:08:05 -04:00
2020-06-19 07:46:13 -04:00
- [RuboCop ](https://github.com/rubocop-hq/rubocop )
2020-04-22 12:58:51 -04:00
2020-06-19 07:46:13 -04:00
### RuboCop Config file
2020-07-21 13:08:05 -04:00
2020-04-23 08:55:25 -04:00
- `.github/linters/.ruby-lint.yml`
2020-04-22 12:58:51 -04:00
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.ruby-lint.yml`
2020-06-19 07:46:13 -04:00
- **Note:** We use the Default **GitHub** Rule set from [RuboCop-GitHub ](https://github.com/github/rubocop-github )
2020-04-22 12:58:51 -04:00
2020-06-19 07:46:13 -04:00
### RuboCop disable single line
2020-07-21 13:08:05 -04:00
2020-04-22 12:58:51 -04:00
```ruby
method(argument) # rubocop:disable SomeRule, SomeOtherRule
```
2020-06-19 07:46:13 -04:00
### RuboCop disable code block
2020-07-21 13:08:05 -04:00
2020-04-22 12:58:51 -04:00
```ruby
# rubocop:disable
This is a long line
var="this is some other stuff"
# rubocop:enable
```
2020-04-22 11:22:51 -04:00
2020-06-19 07:46:13 -04:00
### RuboCop disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 10:01:15 -04:00
If you need to ignore an entire file, you can update the `.github/linters/.ruby-lint.yml` to ignore certain files and locations
2020-04-23 08:50:07 -04:00
```yml
inherit_from:
- .rubocop_todo.yml
- .rubocop_app_overrides.yml
inherit_mode:
merge:
- Exclude
Rails:
Enabled: true
AllCops:
TargetRubyVersion: 2.5.1
EnabledByDefault: true
Exclude:
2020-07-21 13:08:05 -04:00
- "db/**/*"
- "config/**/*"
- "script/**/*"
- "bin/{rails,rake}"
2020-04-23 08:50:07 -04:00
- !ruby/regexp /old_and_unused\.rb$/
```
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
## Shell
2020-07-21 13:08:05 -04:00
2020-04-23 08:50:07 -04:00
- [Shellcheck ](https://github.com/koalaman/shellcheck )
2020-04-22 11:22:51 -04:00
### Shellcheck Config file
2020-07-21 13:08:05 -04:00
- There is no top level _configuration file_ available at this time
2020-04-23 08:50:07 -04:00
2020-04-22 11:22:51 -04:00
### Shellcheck disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 08:50:07 -04:00
```bash
echo "Terrible stuff" # shellcheck disable=SC2059,SC2086
```
2020-04-22 11:22:51 -04:00
### Shellcheck disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 08:50:07 -04:00
```bash
# shellcheck disable=SC2059,SC2086
echo "some hot garbage"
echo "More garbage code"
```
2020-04-22 11:22:51 -04:00
### Shellcheck disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 08:50:07 -04:00
- **Note:** The disable must be on the second line of the code right after the shebang
2020-07-21 13:08:05 -04:00
2020-04-23 08:50:07 -04:00
```bash
#!/bin/sh
# shellcheck disable=SC2059,SC1084
echo "stuff"
moreThings()
```
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
## Ansible
2020-07-21 13:08:05 -04:00
2020-04-23 10:39:20 -04:00
- [ansible-lint ](https://github.com/ansible/ansible-lint )
2020-04-22 11:22:51 -04:00
### Ansible-lint Config file
2020-07-21 13:08:05 -04:00
2020-04-23 10:39:20 -04:00
- `.github/linters/.ansible-lint.yml`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.ansible-lint.yml`
2020-04-22 11:22:51 -04:00
### Ansible-lint disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 10:39:20 -04:00
```yml
- name: this would typically fire GitHasVersionRule 401 and BecomeUserWithoutBecomeRule 501
2020-07-21 13:08:05 -04:00
become_user: alice # noqa 401 501
2020-04-23 10:39:20 -04:00
git: src=/path/to/git/repo dest=checkout
```
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
### Ansible-lint disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 10:39:20 -04:00
```yml
- name: this would typically fire GitHasVersionRule 401
git: src=/path/to/git/repo dest=checkout
tags:
2020-07-21 13:08:05 -04:00
- skip_ansible_lint
2020-04-23 10:39:20 -04:00
```
2020-04-22 11:22:51 -04:00
2020-04-23 10:39:20 -04:00
### Ansible-lint disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 10:39:20 -04:00
```yml
- name: this would typically fire GitHasVersionRule 401
git: src=/path/to/git/repo dest=checkout
tags:
2020-07-21 13:08:05 -04:00
- skip_ansible_lint
2020-04-23 10:39:20 -04:00
```
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
## YAML
2020-07-21 13:08:05 -04:00
2020-04-23 08:55:25 -04:00
- [YamlLint ](https://github.com/adrienverge/yamllint )
2020-04-22 11:22:51 -04:00
### Yamllint Config file
2020-07-21 13:08:05 -04:00
2020-04-23 08:55:25 -04:00
- `.github/linters/.yaml-lint.yml`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.yaml-lint.yml`
2020-04-22 11:22:51 -04:00
### Yamllint disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 08:55:25 -04:00
```yml
2020-07-21 13:08:05 -04:00
This line is waaaaaaaaaay too long # yamllint disable-line
2020-04-23 08:55:25 -04:00
```
2020-04-22 11:22:51 -04:00
### Yamllint disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 08:55:25 -04:00
```yml
# yamllint disable rule:colons
2020-07-21 13:08:05 -04:00
- Key: value
dolor: sit,
foo: bar
2020-04-23 08:55:25 -04:00
# yamllint enable
```
2020-04-22 11:22:51 -04:00
### Yamllint disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 10:01:15 -04:00
If you need to ignore an entire file, you can update the `.github/linters/.yaml-lint.yml` to ignore certain files and locations
2020-07-21 13:08:05 -04:00
2020-04-23 08:55:25 -04:00
```yml
# For all rules
ignore: |
*.dont-lint-me.yaml
/bin/
!/bin/*.lint-me-anyway.yaml
rules:
key-duplicates:
ignore: |
generated
*.template.yaml
trailing-spaces:
ignore: |
*.ignore-trailing-spaces.yaml
/ascii-art/*
```
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
## Python3
2020-07-21 13:08:05 -04:00
2020-04-23 10:39:20 -04:00
- [pylint ](https://www.pylint.org/ )
2020-04-22 11:22:51 -04:00
### Pylint Config file
2020-07-21 13:08:05 -04:00
2020-04-23 10:39:20 -04:00
- `.github/linters/.python-lint`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.python-lint`
2020-04-22 11:22:51 -04:00
### Pylint disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 10:39:20 -04:00
```python
global VAR # pylint: disable=global-statement
```
2020-04-22 11:22:51 -04:00
### Pylint disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 10:39:20 -04:00
```python
"""pylint option block-disable"""
__revision__ = None
class Foo(object):
"""block-disable test"""
def __init__ (self):
pass
def meth1(self, arg):
"""this issues a message"""
print(self)
def meth2(self, arg):
"""and this one not"""
# pylint: disable=unused-argument
print(self\
+ "foo")
def meth3(self):
"""test one line disabling"""
# no error
2020-06-21 19:41:24 -04:00
print(self.baz) # pylint: disable=no-member
2020-04-23 10:39:20 -04:00
# error
2020-06-21 19:41:24 -04:00
print(self.baz)
2020-04-23 10:39:20 -04:00
```
2020-04-22 11:22:51 -04:00
### Pylint disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 10:39:20 -04:00
```python
#!/bin/python3
# pylint: skip-file
var = "terrible code down here..."
```
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
2020-06-19 12:41:19 -04:00
## AWS CloudFormation templates
2020-07-21 13:08:05 -04:00
2020-06-19 12:41:19 -04:00
- [cfn-lint ](https://github.com/aws-cloudformation/cfn-python-lint/ )
### cfn-lint Config file
2020-07-21 13:08:05 -04:00
2020-06-19 12:41:19 -04:00
- `.github/linters/.cfnlintrc.yml`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.cfnlintrc.yml`
### cfn-lint disable single line
2020-07-21 13:08:05 -04:00
2020-06-19 12:41:19 -04:00
- There is currently **No** way to disable rules inline of the file(s)
### cfn-lint disable code block
2020-07-21 13:08:05 -04:00
2020-06-19 12:41:19 -04:00
You can disable both [template ](https://github.com/aws-cloudformation/cfn-python-lint/#template-based-metadata ) or [resource ](https://github.com/aws-cloudformation/cfn-python-lint/#resource-based-metadata ) via [metadata ](https://github.com/aws-cloudformation/cfn-python-lint/#metadata ):
2020-07-21 13:08:05 -04:00
2020-06-19 12:41:19 -04:00
```yaml
Resources:
myInstance:
Type: AWS::EC2::Instance
Metadata:
cfn-lint:
config:
ignore_checks:
2020-07-21 13:08:05 -04:00
- E3030
2020-06-19 12:41:19 -04:00
Properties:
InstanceType: nt.x4superlarge
ImageId: ami-abc1234
```
### cfn-lint disable entire file
2020-07-21 13:08:05 -04:00
2020-06-19 12:41:19 -04:00
If you need to ignore an entire file, you can update the `.github/linters/.cfnlintrc.yml` to ignore certain files and locations
2020-07-21 13:08:05 -04:00
2020-06-19 12:41:19 -04:00
```yaml
ignore_templates:
2020-07-21 13:08:05 -04:00
- codebuild.yaml
2020-06-19 12:41:19 -04:00
```
2020-07-21 13:08:05 -04:00
---
2020-06-19 12:41:19 -04:00
2020-04-22 11:22:51 -04:00
## JSON
2020-07-21 13:08:05 -04:00
2020-04-23 10:19:21 -04:00
- [jsonlint ](https://github.com/zaach/jsonlint )
2020-04-22 11:22:51 -04:00
### JsonLint Config file
2020-07-21 13:08:05 -04:00
- There is no top level _configuration file_ available at this time
2020-04-23 10:19:21 -04:00
2020-04-22 11:22:51 -04:00
### JsonLint disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 10:19:21 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### JsonLint disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 10:19:21 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### JsonLint disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 10:19:21 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
## Markdown
2020-07-21 13:08:05 -04:00
2020-06-18 12:55:01 -04:00
- [markdownlint-cli ](https://github.com/igorshubovych/markdownlint-cli#readme )
- [markdownlint rule documentation ](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md )
- [markdownlint inline comment syntax ](https://github.com/DavidAnson/markdownlint#configuration )
2020-04-22 11:22:51 -04:00
2020-06-18 12:55:01 -04:00
### markdownlint Config file
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
- You can pass multiple rules and overwrite default rules
2020-07-06 15:20:04 -04:00
- File should be located at: `.github/linters/.markdown-lint.yml`
2020-04-22 11:22:51 -04:00
2020-06-18 12:55:01 -04:00
### markdownlint disable single line
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
```markdown
## Here is some document
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
Here is some random data
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
<!-- markdownlint - disable -->
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
any violation you want
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
<!-- markdownlint - restore -->
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
Here is more data
```
2020-07-21 13:08:05 -04:00
2020-06-18 12:55:01 -04:00
### markdownlint disable code block
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
```markdown
## Here is some document
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
Here is some random data
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
<!-- markdownlint - disable -->
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
any violations you want
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
<!-- markdownlint - restore -->
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
Here is more data
```
2020-06-18 12:55:01 -04:00
### markdownlint disable entire file
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
- You can encapsulate the entire file with the _code block format_ to disable an entire file from being parsed
---
2020-04-22 11:22:51 -04:00
## Perl
2020-07-21 13:08:05 -04:00
2020-04-23 10:41:00 -04:00
- [perl ](https://pkgs.alpinelinux.org/package/edge/main/x86/perl )
2020-04-22 11:22:51 -04:00
### Perl Config file
2020-07-21 13:08:05 -04:00
- There is no top level _configuration file_ available at this time
2020-04-23 10:41:00 -04:00
2020-04-22 11:22:51 -04:00
### Perl disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 10:41:00 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### Perl disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 10:41:00 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### Perl disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 10:41:00 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
2020-07-05 22:21:13 -04:00
## Raku
2020-07-21 13:08:05 -04:00
2020-07-05 22:21:13 -04:00
- [raku ](https://raku.org )
### Raku Config file
2020-07-21 13:08:05 -04:00
- There is no top level _configuration file_ available at this time
2020-07-05 22:21:13 -04:00
### Raku disable single line
2020-07-21 13:08:05 -04:00
2020-07-05 22:21:13 -04:00
- There is currently **No** way to disable rules inline of the file(s)
### Raku disable code block
2020-07-21 13:08:05 -04:00
2020-07-05 22:21:13 -04:00
- There is currently **No** way to disable rules inline of the file(s)
### Raku disable entire file
2020-07-21 13:08:05 -04:00
2020-07-05 22:21:13 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-07-21 13:08:05 -04:00
---
---
2020-07-05 22:21:13 -04:00
2020-06-18 13:53:24 -04:00
## PHP
2020-07-21 13:08:05 -04:00
2020-06-18 13:53:24 -04:00
- [PHP ](https://www.php.net/ )
### PHP Config file
2020-07-21 13:08:05 -04:00
- There is no top level _configuration file_ available at this time
2020-06-18 13:53:24 -04:00
### PHP disable single line
2020-07-21 13:08:05 -04:00
2020-06-18 13:53:24 -04:00
- There is currently **No** way to disable rules inline of the file(s)
### PHP disable code block
2020-07-21 13:08:05 -04:00
2020-06-18 13:53:24 -04:00
- There is currently **No** way to disable rules inline of the file(s)
### PHP disable entire file
2020-07-21 13:08:05 -04:00
2020-06-18 13:53:24 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-07-21 13:08:05 -04:00
---
2020-06-18 13:53:24 -04:00
2020-04-22 11:22:51 -04:00
## XML
2020-07-21 13:08:05 -04:00
2020-04-23 10:03:56 -04:00
- [XML ](http://xmlsoft.org/ )
2020-04-22 11:22:51 -04:00
### LibXML Config file
2020-07-21 13:08:05 -04:00
- There is no top level _configuration file_ available at this time
2020-04-23 10:03:56 -04:00
2020-04-22 11:22:51 -04:00
### LibXML disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 10:03:56 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### LibXML disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 10:03:56 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### LibXML disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 10:03:56 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
## Coffeescript
2020-07-21 13:08:05 -04:00
2020-06-18 17:29:06 -04:00
- [coffeelint ](https://coffeelint.github.io/ )
2020-04-23 10:08:38 -04:00
2020-04-22 11:22:51 -04:00
### coffeelint Config file
2020-07-21 13:08:05 -04:00
2020-04-23 10:08:38 -04:00
- `.github/linters/.coffee-lint.yml`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.coffee.yml`
2020-04-22 11:22:51 -04:00
### coffeelint disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 10:08:38 -04:00
```Coffeescript
# coffeelint: disable=max_line_length
foo = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width"
# coffeelint: enable=max_line_length
```
2020-04-22 11:22:51 -04:00
### coffeelint disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 10:08:38 -04:00
```Coffeescript
# coffeelint: disable
foo = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width"
bar = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width"
baz = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width"
taz = "some/huge/line/string/with/embed/#{values}.that/surpasses/the/max/column/width"
# coffeelint: enable
```
2020-04-22 11:22:51 -04:00
### coffeelint disable entire file
2020-07-21 13:08:05 -04:00
- You can encapsulate the entire file with the _code block format_ to disable an entire file from being parsed
---
2020-04-22 11:22:51 -04:00
2020-04-23 12:18:58 -04:00
## Javascript eslint
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
- [eslint ](https://eslint.org/ )
2020-04-22 11:22:51 -04:00
### Javascript eslint Config file
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
- `.github/linters/.eslintrc.yml`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.eslintrc.yml`
2020-04-22 11:22:51 -04:00
### Javascript eslint disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
```javascript
var thing = new Thing(); // eslint-disable-line no-use-before-define
thing.sayHello();
function Thing() {
2020-07-21 13:08:05 -04:00
this.sayHello = function () {
console.log("hello");
};
2020-04-23 11:38:33 -04:00
}
```
2020-04-22 11:22:51 -04:00
### Javascript eslint disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
```javascript
/*eslint-disable */
//suppress all warnings between comments
2020-07-21 13:08:05 -04:00
alert("foo");
2020-04-23 11:38:33 -04:00
/*eslint-enable */
```
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
### Javascript eslint disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
- Place at the top of the file:
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
```javascript
/* eslint-disable */
```
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
2020-04-23 12:18:58 -04:00
## Javascript standard
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
- [standard js ](https://standardjs.com/ )
2020-04-22 11:22:51 -04:00
### Javascript standard Config file
2020-07-21 13:08:05 -04:00
- There is no top level _configuration file_ available at this time
2020-04-23 11:38:33 -04:00
2020-04-22 11:22:51 -04:00
### Javascript standard disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 11:40:18 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### Javascript standard disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 11:40:18 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### Javascript standard disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 11:40:18 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
2020-04-23 12:18:58 -04:00
## Typescript eslint
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
- [eslint ](https://eslint.org/ )
### Typescript eslint Config file
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
- `.github/linters/.eslintrc.yml`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.eslintrc.yml`
2020-04-22 11:22:51 -04:00
### Typescript eslint disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
```typescript
var thing = new Thing(); // eslint-disable-line no-use-before-define
thing.sayHello();
function Thing() {
2020-07-21 13:08:05 -04:00
this.sayHello = function () {
console.log("hello");
};
2020-04-23 11:38:33 -04:00
}
```
2020-04-22 11:22:51 -04:00
### Typescript eslint disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
```typescript
/*eslint-disable */
//suppress all warnings between comments
2020-07-21 13:08:05 -04:00
alert("foo");
2020-04-23 11:38:33 -04:00
/*eslint-enable */
```
2020-07-21 13:08:05 -04:00
2020-04-22 11:22:51 -04:00
### Typescript eslint disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 11:38:33 -04:00
```typescript
/* eslint-disable */
```
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
2020-04-23 12:18:58 -04:00
## Typescript standard
2020-07-21 13:08:05 -04:00
2020-04-23 11:40:18 -04:00
- [standardjs ](https://standardjs.com/ )
2020-04-22 11:22:51 -04:00
### Typescript standard Config file
2020-07-21 13:08:05 -04:00
- There is no top level _configuration file_ available at this time
2020-04-23 11:38:33 -04:00
2020-04-22 11:22:51 -04:00
### Typescript standard disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 11:40:18 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### Typescript standard disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 11:40:18 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### Typescript standard disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 11:40:18 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
## Golang
2020-07-21 13:08:05 -04:00
2020-04-23 10:11:42 -04:00
- [golangci-lint ](https://github.com/golangci/golangci-lint )
2020-04-22 11:22:51 -04:00
### golangci-lint standard Config file
2020-07-21 13:08:05 -04:00
2020-04-23 10:11:42 -04:00
- `.github/linters/.golangci.yml`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.golangci.yml`
2020-04-22 11:22:51 -04:00
### golangci-lint disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 10:11:42 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### golangci-lint disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 10:11:42 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### golangci-lint disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 10:11:42 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-23 10:16:33 -04:00
2020-04-22 11:22:51 -04:00
## Dockerfile
2020-07-21 13:08:05 -04:00
2020-06-20 04:42:58 -04:00
- [dockerfilelint ](https://github.com/replicatedhq/dockerfilelint.git )
2020-04-23 10:01:15 -04:00
2020-04-22 11:22:51 -04:00
### Dockerfilelint standard Config file
2020-07-21 13:08:05 -04:00
2020-04-23 10:01:15 -04:00
- `.github/linters/.dockerfilelintrc`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.dockerfilelintrc`
2020-04-22 11:22:51 -04:00
### Dockerfilelint disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 10:01:15 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### Dockerfilelint disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 10:01:15 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### Dockerfilelint disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 10:01:15 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-04-22 11:22:51 -04:00
## Terraform
2020-07-21 13:08:05 -04:00
2020-04-23 10:16:33 -04:00
- [tflint ](https://github.com/terraform-linters/tflint )
2020-04-22 11:22:51 -04:00
### tflint standard Config file
2020-07-21 13:08:05 -04:00
2020-04-23 10:16:33 -04:00
- `.github/linters/.tflint.hcl`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.tflint.hcl`
2020-04-22 11:22:51 -04:00
### tflint disable single line
2020-07-21 13:08:05 -04:00
2020-04-23 10:16:33 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### tflint disable code block
2020-07-21 13:08:05 -04:00
2020-04-23 10:16:33 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
### tflint disable entire file
2020-07-21 13:08:05 -04:00
2020-04-23 10:16:33 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-04-22 11:22:51 -04:00
2020-07-21 13:08:05 -04:00
---
2020-06-18 19:40:41 -04:00
## CSS
2020-07-21 13:08:05 -04:00
2020-06-18 19:40:41 -04:00
- [stylelint ](https://stylelint.io/ )
### stylelint standard Config file
2020-07-21 13:08:05 -04:00
2020-06-18 19:40:41 -04:00
- `.github/linters/.stylelintrc.json`
### stylelint disable single line
2020-07-21 13:08:05 -04:00
2020-06-18 19:40:41 -04:00
```css
#id {
/* stylelint-disable-next-line declaration-no-important */
color: pink !important;
}
```
### stylelint disable code block
2020-07-21 13:08:05 -04:00
2020-06-18 19:40:41 -04:00
```css
/* stylelint-disable */
2020-07-21 13:08:05 -04:00
a {
}
2020-06-18 19:40:41 -04:00
/* stylelint-enable */
```
### stylelint disable entire file
2020-07-21 13:08:05 -04:00
2020-06-18 19:40:41 -04:00
- You can disable entire files with the `ignoreFiles` property in `.stylelintrc.json`
2020-07-21 13:08:05 -04:00
2020-06-18 19:40:41 -04:00
```json
{
"ignoreFiles": [
"styles/ignored/wildcards/*.css",
"styles/ignored/specific-file.css"
2020-07-21 13:08:05 -04:00
]
2020-06-18 19:40:41 -04:00
}
```
2020-06-19 13:32:07 -04:00
2020-07-21 13:08:05 -04:00
---
2020-06-19 13:32:07 -04:00
## ENV
2020-07-21 13:08:05 -04:00
2020-06-19 13:32:07 -04:00
- [dotenv-linter ](https://github.com/dotenv-linter/dotenv-linter )
### dotenv-linter Config file
2020-07-21 13:08:05 -04:00
- There is no top level _configuration file_ available at this time
2020-06-19 13:32:07 -04:00
### dotenv-linter disable single line
2020-07-21 13:08:05 -04:00
2020-06-19 13:59:06 -04:00
```env
2020-06-19 13:32:07 -04:00
# Comment line will be ignored
```
### dotenv-linter disable code block
2020-07-21 13:08:05 -04:00
2020-06-19 13:32:07 -04:00
- There is currently **No** way to disable rules inline of the file(s)
### dotenv-linter disable entire file
2020-07-21 13:08:05 -04:00
2020-06-19 13:32:07 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-06-21 03:59:18 -04:00
2020-07-21 13:08:05 -04:00
---
2020-06-21 03:59:18 -04:00
## Kotlin
2020-07-21 13:08:05 -04:00
2020-06-21 03:59:18 -04:00
- [ktlint ](https://github.com/pinterest/ktlint )
### ktlint Config file
2020-07-21 13:08:05 -04:00
- There is no top level _configuration file_ available at this time
2020-06-21 03:59:18 -04:00
### ktlint disable single line
2020-07-21 13:08:05 -04:00
2020-06-21 03:59:18 -04:00
```kotlin
import package.* // ktlint-disable no-wildcard-imports
```
### ktlint disable code block
2020-07-21 13:08:05 -04:00
2020-06-21 03:59:18 -04:00
```kotlin
/* ktlint-disable no-wildcard-imports */
import package.a.*
import package.b.*
/* ktlint-enable no-wildcard-imports */
```
### ktlint disable entire file
2020-07-21 13:08:05 -04:00
2020-06-21 03:59:18 -04:00
- There is currently **No** way to disable rules inline of the file(s)
2020-06-25 06:21:11 -04:00
2020-07-21 13:08:05 -04:00
---
2020-06-25 06:21:11 -04:00
2020-07-06 04:17:20 -04:00
## Dart
2020-07-21 13:08:05 -04:00
2020-07-06 04:17:20 -04:00
- [dartanalyzer ](https://dart.dev/tools/dartanalyzer )
### dartanalyzer standard Config file
2020-07-21 13:08:05 -04:00
2020-07-06 04:17:20 -04:00
- `.github/linters/.dart-lint.yml`
- You can pass multiple rules and overwrite default rules
- File should be located at: `.github/linters/.dart-lint.yml`
### dartanalyzer disable single line
2020-07-21 13:08:05 -04:00
2020-07-06 04:17:20 -04:00
```dart
int x = ''; // ignore: invalid_assignment
```
### dartanalyzer disable code block
2020-07-21 13:08:05 -04:00
2020-07-06 04:17:20 -04:00
- You can make [rule exceptions ](https://dart.dev/guides/language/analysis-options#excluding-code-from-analysis ) for the entire file.
2020-07-21 13:08:05 -04:00
2020-07-06 04:17:20 -04:00
```dart
// ignore_for_file: unused_import, unused_local_variable
```
### dartanalyzer disable entire file
2020-07-21 13:08:05 -04:00
2020-07-06 04:17:20 -04:00
- You can disable entire files with the `analyzer.exclude` property in `.dart-lint.yml`
2020-07-21 13:08:05 -04:00
2020-07-06 04:17:20 -04:00
```dart
analyzer:
exclude:
- file
```
2020-07-21 13:08:05 -04:00
---
2020-07-06 04:17:20 -04:00
2020-06-25 06:21:11 -04:00
## OpenAPI
2020-07-21 13:08:05 -04:00
2020-06-25 06:21:11 -04:00
- [spectral ](https://github.com/stoplightio/spectral )
### OpenAPI Config file
2020-07-21 13:08:05 -04:00
2020-06-25 06:21:11 -04:00
- `.github/linters/.openapirc.yml`
- You can add, extend, and disable rules
- Documentation at [Spectral Custom Rulesets ](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/guides/4-custom-rulesets.md )
- File should be located at: `.github/linters/.openapirc.yml`
### OpenAPI disable single line
2020-07-21 13:08:05 -04:00
2020-06-25 06:21:11 -04:00
- There is currently **No** way to disable rules inline of the file(s)
### OpenAPI disable code block
2020-07-21 13:08:05 -04:00
2020-06-25 06:21:11 -04:00
- There is currently **No** way to disable rules inline of the file(s)
### OpenAPI disable entire file
2020-07-21 13:08:05 -04:00
2020-06-25 06:21:11 -04:00
- There is currently **No** way to disable rules inline of the file(s)
- However, you can make [rule exceptions ](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/guides/6-exceptions.md?srn=gh/stoplightio/spectral/docs/guides/6-exceptions.md ) in the config for individual file(s).
2020-06-26 09:19:10 -04:00
2020-07-21 13:08:05 -04:00
---
2020-06-26 09:19:10 -04:00
2020-06-28 07:07:51 -04:00
## Protocol Buffers
- [protolint ](https://github.com/yoheimuta/protolint )
### protolint Config file
- `.github/linters/.protolintrc.yml`
- You can add, extend, and disable rules
- Documentation at [Rules ](https://github.com/yoheimuta/protolint#rules ) and [Configuring ](https://github.com/yoheimuta/protolint#configuring )
### protolint disable single line
```protobuf
enum Foo {
// protolint:disable:next ENUM_FIELD_NAMES_UPPER_SNAKE_CASE
firstValue = 0;
second_value = 1; // protolint:disable:this ENUM_FIELD_NAMES_UPPER_SNAKE_CASE
THIRD_VALUE = 2;
}
```
### protolint disable code block
```protobuf
// protolint:disable ENUM_FIELD_NAMES_UPPER_SNAKE_CASE
enum Foo {
firstValue = 0;
second_value = 1;
THIRD_VALUE = 2;
}
// protolint:enable ENUM_FIELD_NAMES_UPPER_SNAKE_CASE
```
### protolint disable entire file
- You can disable entire files with the `lint.files.exclude` property in `.protolintrc.yml`
```yaml
# Lint directives.
lint:
# Linter files to walk.
files:
# The specific files to exclude.
exclude:
- path/to/file
```
2020-06-23 09:43:29 -04:00
## Clojure
2020-07-21 13:08:05 -04:00
2020-06-23 09:43:29 -04:00
- [clj-kondo ](https://github.com/borkdude/clj-kondo )
2020-06-23 09:46:15 -04:00
- Since clj-kondo approaches static analysis in a very Clojure way, it is advised to read the [configuration docs ](https://github.com/borkdude/clj-kondo/blob/master/doc/config.md )
2020-06-23 09:43:29 -04:00
### clj-kondo standard Config file
2020-07-21 13:08:05 -04:00
2020-06-23 09:43:29 -04:00
- `.github/linters/.clj-kondo/config.edn`
### clj-kondo disable single line
2020-07-21 13:08:05 -04:00
2020-06-23 09:43:29 -04:00
- There is currently **No** way to disable rules in a single line
### clj-kondo disable code block
2020-07-21 13:08:05 -04:00
2020-06-23 09:43:29 -04:00
- There is currently **No** way to disable rules in a code block
### clj-kondo disable entire file
2020-07-21 13:08:05 -04:00
2020-07-23 08:55:56 -04:00
```clojure
2020-06-23 09:43:29 -04:00
{:output {:exclude-files ["path/to/file"]}}
2020-07-23 08:55:56 -04:00
```
2020-06-21 03:16:45 -04:00
## EDITORCONFIG-CHECKER
- [editorconfig-checker ](https://github.com/editorconfig-checker/editorconfig-checker )
### editorconfig-checker Config file
- `.github/linters/.ecrc`
- This linter will also use the [`.editorconfig` ](https://editorconfig.org/ ) of your project
### editorconfig-checker disable single line
-
```js
< LINE > // editorconfig-checker-disable-line
2020-07-21 14:22:58 -04:00
```
2020-06-21 03:16:45 -04:00
### editorconfig-checker disable code block
2020-07-21 13:08:05 -04:00
2020-06-21 03:16:45 -04:00
- There is currently **No** way to disable rules inline of the file(s)
### editorconfig-checker disable entire file
2020-07-21 13:08:05 -04:00
2020-06-21 03:16:45 -04:00
-
2020-07-21 13:08:05 -04:00
2020-06-21 03:16:45 -04:00
```js
// editorconfig-checker-disable-file
```
2020-07-21 13:08:05 -04:00
2020-06-21 03:16:45 -04:00
- You can disable entire files with the `Exclude` property in `.ecrc`
2020-07-21 13:08:05 -04:00
2020-06-21 03:16:45 -04:00
```json
{
2020-07-21 13:08:05 -04:00
"Exclude": ["path/to/file", "^regular\\/expression\\.ext$"]
2020-06-21 03:16:45 -04:00
}
2020-06-23 09:43:29 -04:00
```
2020-07-04 18:14:27 -04:00
## HTML
2020-07-21 13:08:05 -04:00
2020-07-04 18:14:27 -04:00
- [htmlhint ](https://htmlhint.com/ )
### htmlhint standard Config file
2020-07-21 13:08:05 -04:00
2020-07-04 18:14:27 -04:00
- `.github/linters/.htmlhintrc`
### htmlhint disable single line
2020-07-21 13:08:05 -04:00
2020-07-04 18:14:27 -04:00
- There is currently **No** way to disable rules in a single line
### htmlhint disable code block
2020-07-21 13:08:05 -04:00
2020-07-04 18:14:27 -04:00
- There is currently **No** way to disable rules in a code block
### htmlhint disable entire file
2020-07-21 13:08:05 -04:00
2020-07-06 15:20:04 -04:00
- There is currently **No** way to disable rules in an entire file