diff --git a/.inlineplz.yml b/.inlineplz.yml index dc9ae540..6de16bb3 100644 --- a/.inlineplz.yml +++ b/.inlineplz.yml @@ -1,3 +1,4 @@ enabled_linters: - coala - prospector +autofix: true diff --git a/.stickler.yml b/.stickler.yml index 8446464f..a2e361b7 100644 --- a/.stickler.yml +++ b/.stickler.yml @@ -3,15 +3,15 @@ linters: python: 3 fixer: true max-line-length: 120 - ignore: 'E1601,W503,E501' + ignore: "E1601,W503,E501" pep8: python: 3 - ignore: 'E1601,W503,E501' + ignore: "E1601,W503,E501" max-line-length: 120 fixer: true files: ignore: - - 'bower_components/*' - - 'node_modules/*' + - "bower_components/*" + - "node_modules/*" fixers: enable: true diff --git a/.travis.yml b/.travis.yml index c0aef999..71bcfb14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,46 +1,46 @@ deploy: - on: - condition: $TRAVIS_PYTHON_VERSION == 3.6 - repo: guykisel/inline-plz - tags: true - distributions: sdist bdist_wheel - password: - - secure: >- - kaDQlskSlm33X6IScstcWCvg4q28ArHVqBDvNQ5Wky5J75qdyIGZpy3+JOiM5PrgYC4YI684DmvAau0MsryoCbvH2CBOjiE0lplXFGWXHaybhj2MWtuMB/Jy5rgw6YSs6iDRqepK74JiIe8IxApjOBs/z8WJ7ErREZmEqi99dg05+0uI/LmBq0eALVcHVewWml40ABGOPD4hfdj1Msm7oOQRgpVptys1qZ5OzKoR9misl3qAIOv49hOBKQyKpJzL1BQ7CCviVou8HWKq7Tn4ehPe5RS+HlTuNnifbOEslBHSdt12JiaJk3pSa6ye6fI4s3NUB9MI33cValOk6YzgVswGgZgpM+FjJ7Kx1XzNo/qM5dmvNR7AVnd3MiCiENUWbdiP/ZPQ4t/EkeaWJrOeu2zjgLU+CbGACcXJKt6uJAy5p1zVUV9Fsc7Hfy/VEY32SgXNaafdp9Oqab6r3gIRQGz2LrWwpkOEzGR16Je7RyELQcqAe3ZXDet+cYaoLdT8Jmp/G5/gn4WHBZc3dOcTmDVEYB+kkT1Cj3bsfMx7OAKwxT+csB6CobcuuiN6aNCza2eUAKLJiMkDvK6iN2nOU10621TvNe0fR1mwCLzf94oNVmBHUhbcZSSItdG8X43gKiNKXhZxqAJ4Y43CrvbxkAmy+sWC8lYHdJrrxziSSII= - provider: pypi - user: guykisel + on: + condition: $TRAVIS_PYTHON_VERSION == 3.6 + repo: guykisel/inline-plz + tags: true + distributions: sdist bdist_wheel + password: + - secure: >- + kaDQlskSlm33X6IScstcWCvg4q28ArHVqBDvNQ5Wky5J75qdyIGZpy3+JOiM5PrgYC4YI684DmvAau0MsryoCbvH2CBOjiE0lplXFGWXHaybhj2MWtuMB/Jy5rgw6YSs6iDRqepK74JiIe8IxApjOBs/z8WJ7ErREZmEqi99dg05+0uI/LmBq0eALVcHVewWml40ABGOPD4hfdj1Msm7oOQRgpVptys1qZ5OzKoR9misl3qAIOv49hOBKQyKpJzL1BQ7CCviVou8HWKq7Tn4ehPe5RS+HlTuNnifbOEslBHSdt12JiaJk3pSa6ye6fI4s3NUB9MI33cValOk6YzgVswGgZgpM+FjJ7Kx1XzNo/qM5dmvNR7AVnd3MiCiENUWbdiP/ZPQ4t/EkeaWJrOeu2zjgLU+CbGACcXJKt6uJAy5p1zVUV9Fsc7Hfy/VEY32SgXNaafdp9Oqab6r3gIRQGz2LrWwpkOEzGR16Je7RyELQcqAe3ZXDet+cYaoLdT8Jmp/G5/gn4WHBZc3dOcTmDVEYB+kkT1Cj3bsfMx7OAKwxT+csB6CobcuuiN6aNCza2eUAKLJiMkDvK6iN2nOU10621TvNe0fR1mwCLzf94oNVmBHUhbcZSSItdG8X43gKiNKXhZxqAJ4Y43CrvbxkAmy+sWC8lYHdJrrxziSSII= + provider: pypi + user: guykisel env: - global: - secure: >- - hJjNRzaBuateybOSFPW8nkmWfXOfP4FM1S3FtbyTTB4NAoE9L7Hoo1ZiUjt+oLDy0kAre0tO8aKjin18lKE2No0IddE67XRTZAF+ah8iiDUkBIyN7kkgDm8M7byIK+nRS0jrSdcrFcWvAGtufQHT5MN6kfMNGJIe5m2QttS0rRLOxF+nO0CjiBOF4K+YyyBbwojfk8UY4aCNDlIucH16wwxv+LjV2d3eDxb+Rh6F+h8A5y7xk3F01NPM3K853LPR+nMqlXXGGt/gkM3sFDPRnVZ6k67geOJoWXVtFovQ/0iWgI8tW+Yr58NO23YiGSt+Uq7fDfOvjf1KXjr33dOl15mcUGWy3P6i3h1xnbVWCOCmH5ld14hTIK6mcMM226AjP3iXi3T6QqNzOaSDTO6JQXAIKKEdNsvQdNKzG39rLUot+JUmfpxIAZGeWj5TwIlSFOj87UbQL8cGZKKMB/4iyMNDkdXKQvdRwJy2QOp+tssbyAfm4650EDIA1nltbTFyHn8wWPNAkcdnLMb2gF2RBqQpe7mbfqR3P04Y17MPDUEIyaeNb2zROo4Twxb6xB2uKU0ZtpOM+ksDV6AkLWOQkkMApHdMVeYjiE5xi4itSNfv1kpGYpgpKQOg/FqMIqlQZd48r4ukbLnNwUDZ7sKtR744IOd/94C7Kpt+h3stotA= + global: + secure: >- + hJjNRzaBuateybOSFPW8nkmWfXOfP4FM1S3FtbyTTB4NAoE9L7Hoo1ZiUjt+oLDy0kAre0tO8aKjin18lKE2No0IddE67XRTZAF+ah8iiDUkBIyN7kkgDm8M7byIK+nRS0jrSdcrFcWvAGtufQHT5MN6kfMNGJIe5m2QttS0rRLOxF+nO0CjiBOF4K+YyyBbwojfk8UY4aCNDlIucH16wwxv+LjV2d3eDxb+Rh6F+h8A5y7xk3F01NPM3K853LPR+nMqlXXGGt/gkM3sFDPRnVZ6k67geOJoWXVtFovQ/0iWgI8tW+Yr58NO23YiGSt+Uq7fDfOvjf1KXjr33dOl15mcUGWy3P6i3h1xnbVWCOCmH5ld14hTIK6mcMM226AjP3iXi3T6QqNzOaSDTO6JQXAIKKEdNsvQdNKzG39rLUot+JUmfpxIAZGeWj5TwIlSFOj87UbQL8cGZKKMB/4iyMNDkdXKQvdRwJy2QOp+tssbyAfm4650EDIA1nltbTFyHn8wWPNAkcdnLMb2gF2RBqQpe7mbfqR3P04Y17MPDUEIyaeNb2zROo4Twxb6xB2uKU0ZtpOM+ksDV6AkLWOQkkMApHdMVeYjiE5xi4itSNfv1kpGYpgpKQOg/FqMIqlQZd48r4ukbLnNwUDZ7sKtR744IOd/94C7Kpt+h3stotA= before_install: - - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # https://github.com/travis-ci/travis-ci/issues/8920 + - python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" # https://github.com/travis-ci/travis-ci/issues/8920 install: - - pip install -U pip - # temporarily ignore failure for installing pipx https://github.com/cs01/pipx/issues/25 - - curl https://raw.githubusercontent.com/cs01/pipx/master/get-pipx.py | python || true - - pip install tox-travis - - pip install -r requirements_dev.txt - - python setup.py develop + - pip install -U pip + # temporarily ignore failure for installing pipx https://github.com/cs01/pipx/issues/25 + - curl https://raw.githubusercontent.com/cs01/pipx/master/get-pipx.py | python || true + - pip install tox-travis + - pip install -r requirements_dev.txt + - python setup.py develop dist: xenial language: python python: - - "3.7" - - "3.6" - - "3.5" + - "3.7" + - "3.6" + - "3.5" script: - - tox - # https://stackoverflow.com/questions/34405047/how-do-you-merge-into-another-branch-using-travis-with-git-commands - - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then git config --replace-all remote.origin.fetch +refs/heads/*:refs/remotes/origin/*; fi' - - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then git fetch; fi' - - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then git fetch --tags; fi' - - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then for branch in $(git branch -r|grep -v HEAD); do git checkout -qf ${branch#origin/}; done; fi' - - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then git checkout "$TRAVIS_PULL_REQUEST_BRANCH"; fi' - - inline-plz --dryrun --autorun - - inline-plz --dryrun --autorun --config-dir=./inlineplz/linters/config - - inline-plz --autorun --delete-outdated --autofix + - tox + # https://stackoverflow.com/questions/34405047/how-do-you-merge-into-another-branch-using-travis-with-git-commands + - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then git config --replace-all remote.origin.fetch +refs/heads/*:refs/remotes/origin/*; fi' + - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then git fetch; fi' + - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then git fetch --tags; fi' + - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then for branch in $(git branch -r|grep -v HEAD); do git checkout -qf ${branch#origin/}; done; fi' + - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then git checkout "$TRAVIS_PULL_REQUEST_BRANCH"; fi' + - inline-plz --dryrun --autorun + - inline-plz --dryrun --autorun --config-dir=./inlineplz/linters/config + - inline-plz --autorun --delete-outdated --autofix cache: - pip: true - yarn: true - directories: - - node_modules # NPM packages + pip: true + yarn: true + directories: + - node_modules # NPM packages diff --git a/AUTHORS.md b/AUTHORS.md index 0deb2e36..8bc855f0 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -2,9 +2,8 @@ Credits ======= -Contributors ------------- +## Contributors -* [Guy Kisel](https://github.com/guykisel) -* [Raphael Castaneda](https://github.com/raphaelcastaneda) -* [@vsiakka] (https://github.com/vsiakka) +- [Guy Kisel](https://github.com/guykisel) +- [Raphael Castaneda](https://github.com/raphaelcastaneda) +- [@vsiakka](https://github.com/vsiakka) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 7a97cc6e..d304c8ca 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -26,19 +26,17 @@ $ tox Note: Tox will run the unit tests against python 3.5, 3.6, and 3.7. - -When you submit Pull Requests, `inline-plz` will kick off a [Travis job](blob/master/.travis.yml) that ... checks itself! Please help keep `inline-plz` linted as an shining example of what great looks like! - +When you submit Pull Requests, `inline-plz` will kick off a [Travis job](blob/master/.travis.yml) that ... checks itself! Please help keep `inline-plz` linted as an shining example of what great looks like! # Adding New Linters -You've got a new tool for helping improve code bases? Why let's get 'er supported within `inline-plz`. Here's where you'll need to look to get your awesome new tool added in with all the others: +You've got a new tool for helping improve code bases? Why let's get 'er supported within `inline-plz`. Here's where you'll need to look to get your awesome new tool added in with all the others: -`inline-plz` uses external linters, typically installed as their own command line utilities. To simplify the use of those linters by `inline-plz` users, we request that you implement an installation process in addition to adapting it's output to the format expected by `inline-plz`. +`inline-plz` uses external linters, typically installed as their own command line utilities. To simplify the use of those linters by `inline-plz` users, we request that you implement an installation process in addition to adapting it's output to the format expected by `inline-plz`. ## Configure a File Matcher -If your linter is for a file type not yet supported by `inline-plz`, you'll need to add a pattern matcher in [linters/__init__.py](blob/master/inlineplz/linters/__init__.py) (see `register_patterns`): +If your linter is for a file type not yet supported by `inline-plz`, you'll need to add a pattern matcher in [linters/**init**.py](blob/master/inlineplz/linters/__init__.py) (see `register_patterns`): ```python def register_patterns(): @@ -67,11 +65,9 @@ def register_patterns(): ``` - ## Create your Linter class and a unit test - -Create your linter class in `inlineplz/linters`, then import your linter in [linters/__init__.py](blob/master/inlineplz/linters/__init__.py). +Create your linter class in `inlineplz/linters`, then import your linter in [linters/**init**.py](blob/master/inlineplz/linters/__init__.py). Here is the tflint Linter: @@ -119,35 +115,36 @@ class TFLintParser(ParserBase): There a few things to point out here: -* When the linter being wrapped supports it we recommed having it produce machine readable output. We find Json to be *very* convienient. -* When processing Json we recommend `dirtyjson` over the standard `json` library. +- When the linter being wrapped supports it we recommed having it produce machine readable output. We find Json to be _very_ convienient. +- When processing Json we recommend `dirtyjson` over the standard `json` library. In the `@linter` annotation, the parameters are: -* `name` should be a unique name for your linter (unique among the other linters, we recommend that this is the same name as your linter's `.py` file). -* `language` this determines the file pattern matchers the linter will be called for, see `register_patterns` above. -* `install` this is a list of lists, each represents the shell commands to be run to perform installation, each will be attempted until one succeeds or all have failed -* `help` how to get help from the tool, this is also used to verify the tool can be called and is installed -* `run` this is the shell command to run your tool with out specifying a configuration file -* `rundefault` this is the shell command to run your tool with the default configuration file embedded in `inline-plz` (see `./inlineplz/linters/config/`) -* `dotfiles` this is a set of default configuration files, embedded in `inline-plz` -* `autorun` this is a boolean variable, when `True` will cause your linter to be run without having to be explicitly called -* `run_per_file` a boolean, if `True`, the linter will be shelled out and called for each file (`run_per_file=True` can be slow), if `False` the linter will be run once for the entire source tree + +- `name` should be a unique name for your linter (unique among the other linters, we recommend that this is the same name as your linter's `.py` file). +- `language` this determines the file pattern matchers the linter will be called for, see `register_patterns` above. +- `install` this is a list of lists, each represents the shell commands to be run to perform installation, each will be attempted until one succeeds or all have failed +- `help` how to get help from the tool, this is also used to verify the tool can be called and is installed +- `run` this is the shell command to run your tool with out specifying a configuration file +- `rundefault` this is the shell command to run your tool with the default configuration file embedded in `inline-plz` (see `./inlineplz/linters/config/`) +- `dotfiles` this is a set of default configuration files, embedded in `inline-plz` +- `autorun` this is a boolean variable, when `True` will cause your linter to be run without having to be explicitly called +- `run_per_file` a boolean, if `True`, the linter will be shelled out and called for each file (`run_per_file=True` can be slow), if `False` the linter will be run once for the entire source tree If your tool is common enough that `inline-plz` should try it out for ever project, consider adding it to `TRUSTED_INSTALL`. ## Optionally Create a Default Configuration -Add a default [configuration](tree/master/inlineplz/linters/config) for the your linter. This is only necessary if the tool requires a configuration or if you feel the "out of the box" defaults for the new tool should have those defaults overridden. +Add a default [configuration](tree/master/inlineplz/linters/config) for the your linter. This is only necessary if the tool requires a configuration or if you feel the "out of the box" defaults for the new tool should have those defaults overridden. ## Parser Interface Your parser will need to adapt the output of the linting tool into the structure that `inline-plz` supports. -Parsers must return a python `set()`. Entries in the set must be a 3-tuple of: +Parsers must return a python `set()`. Entries in the set must be a 3-tuple of: -* `string`: file path and name -* `number`: the line number the message refers to -* `string`: message body, the output from the linting tool that refers to this specific file+line number. +- `string`: file path and name +- `number`: the line number the message refers to +- `string`: message body, the output from the linting tool that refers to this specific file+line number. ```python ('project/supercoder.py', 1, "STRONG WARNING: author is a tool") @@ -166,4 +163,3 @@ See `/guykisel/inline-plz/tree/master/inlineplz/env` for more information. Please perform both a `dryrun` and a full `tox` run-through before committing your code. We'd like to keep the code formatting consistent, and are using the defaults from the [black](https://github.com/ambv/black) python formatting tool as our standard. - diff --git a/examples/all-the-linters-enabled.inlineplz.yml b/examples/all-the-linters-enabled.inlineplz.yml index ee9369b6..b336e0d3 100644 --- a/examples/all-the-linters-enabled.inlineplz.yml +++ b/examples/all-the-linters-enabled.inlineplz.yml @@ -1,18 +1,18 @@ # from linters/__init__.py enabled_linters: - - bandit - - dockerfile_lint - - eslint - - gherkin-lint - - gometalinter - - jscs - - jshint - - jsonlint - - markdownlint-cli - - megacheck - - prospector - - robotframework-lint - - restructuredtext_lint - - shellcheck - - stylint - - yamllint + - bandit + - dockerfile_lint + - eslint + - gherkin-lint + - gometalinter + - jscs + - jshint + - jsonlint + - markdownlint-cli + - megacheck + - prospector + - robotframework-lint + - restructuredtext_lint + - shellcheck + - stylint + - yamllint diff --git a/examples/your-standard-node-app.inlineplz.yml b/examples/your-standard-node-app.inlineplz.yml index 7a68dc07..0758a972 100644 --- a/examples/your-standard-node-app.inlineplz.yml +++ b/examples/your-standard-node-app.inlineplz.yml @@ -1,24 +1,24 @@ ignore_paths: - - node_modules - - vendors - - .tox - - .git + - node_modules + - vendors + - .tox + - .git enabled_linters: - - markdown - - eslint - - json + - markdown + - eslint + - json disabled_linters: - - bandit - - dockerfile_lint - - gherkin-lint - - gometalinter - - jscs - - jshint - - markdownlint-cli - - megacheck - - prospector - - robotframework-lint - - restructuredtext_lint - - shellcheck - - stylint - - yamllint + - bandit + - dockerfile_lint + - gherkin-lint + - gometalinter + - jscs + - jshint + - markdownlint-cli + - megacheck + - prospector + - robotframework-lint + - restructuredtext_lint + - shellcheck + - stylint + - yamllint diff --git a/inlineplz/linters/config/.eslintrc.js b/inlineplz/linters/config/.eslintrc.js index 78b1664e..8395a8c5 100644 --- a/inlineplz/linters/config/.eslintrc.js +++ b/inlineplz/linters/config/.eslintrc.js @@ -1,272 +1,277 @@ module.exports = { - // Prevent parent eslintrc from interfering - "root": true, - - // Begin with the recommended rules from eslint itself - "extends": "eslint:recommended", - - // Globals - "env": { - "browser": true, - "node": true, - "es6": true - }, - - // ES6 - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - - "rules": { - // Disallow declaring the same variable more then once - // - // Reasons: stylistic, gotcha - // See http://eslint.org/docs/rules/no-redeclare.html - "no-redeclare": 2, - - // Disallow the declaration of duplicate keys in an object - // - // Reasons: safety, gotcha - // See http://eslint.org/docs/rules/no-dupe-keys.html - "no-dupe-keys": 2, - - // Disallow use of undeclared variables unless mentioned in a /*global */ block - // - // Reasons: side-effects, safety - // See http://eslint.org/docs/rules/no-undef.html - "no-undef": 2, - - // Enforce camelCase names, but allow snake_case - // properties on objects where necessary. - // - // Best practice recommendation is camelCase always. - // - // Reasons: stylistic - // See http://eslint.org/docs/rules/camelcase - "camelcase" : [2, {"properties": "never"}], - - // Require use of === and !== to avoid problematic - // type coercion - // - // Reasons: safety, gotcha - // See http://eslint.org/docs/rules/eqeqeq - "eqeqeq": 2, - - // Require valid JSDoc comments, where JSDoc comments - // are used. You are free to not document functions, - // but when functions are documented (like your public API - - // you document that, right?) the JSDoc comments must be - // valid and match the params of the given function. - // - // Reasons: maintainability, readability - // See http://usejsdoc.org/ - // See http://eslint.org/docs/rules/valid-jsdoc - "valid-jsdoc": [2, { - "requireParamDescription": true, - "requireReturnDescription": true, - "requireReturn": true - }], - - // Require curly braces for every new block or - // scope, including single-line statements. - // - // Reasons: safety, stylistic, readability - // See http://eslint.org/docs/rules/curly - "curly" : 2, - - // Prevent extension of built-in objects. - // - // Reasons: side-effects, safety - // See http://eslint.org/docs/rules/no-extend-native - "no-extend-native": 2, - - // Prevent reassignment/shadowing of native objects - // - // Reasons: side-effects, safety - // See http://eslint.org/docs/rules/no-native-reassign - "no-native-reassign": 2, - - // Require indentation in line with most idiomatic - // Javascript style guides: two spaces, no tabs - // - // Reasons: stylistic, consistency - // See http://eslint.org/docs/rules/indent - "indent" : [2, 2], // {int} Number of spaces to use for indentation - - // Require that `new`-able objects are represented - // by a symbol with a capital letter - // - // Reasons: stylistic - // See http://eslint.org/docs/rules/new-cap - "new-cap" : 2, // true: Require capitalization of all constructor functions e.g. `new F()` - - // Require that parentheses are used when `new`-ing a - // constructor, even if the constructor has no arguments. - // - // Reasons: stylistic - // See http://eslint.org/docs/rules/new-parens - "new-parens": 2, - - // Forbid use of `new` without assigning the result - // - // Reasons: side-effects - // See http://eslint.org/docs/rules/no-new - "no-new" : 2, - - // Prevent inclusion of unused variables in final code - // - // Reasons: maintainability - // See http://eslint.org/docs/rules/no-unused-vars - "no-unused-vars": 2, - - // Fail on finding lines with trailing whitespace. - // Indicates that you may have a misconfigured text editor. - // - // Reasons: stylistic - // See http://eslint.org/docs/rules/no-trailing-spaces - "no-trailing-spaces": 2, - - // Limit arity of functions. While you may occasionally - // need to create a function with higher arity than recommended, - // these functions should be marked as exceptions with linter - // comments. - // - // Reasons: maintainability - // See http://eslint.org/docs/rules/max-params - "max-params" : [2, 5], - - // Limit block-depth of code for management of complexity - // - // Reasons: readability, maintainability - // See http://eslint.org/docs/rules/max-depth - "max-depth" : [2, 4], - - // Avoid nested callbacks wherever possible. Prefer - // promises over nesting. - // - // Reasons: readability, maintainability - // See http://eslint.org/docs/rules/max-nested-callbacks - "max-nested-callbacks": [2, 3], - - // Limit length of functions - prefer small units of - // functionality over long routines - // - // Reasons: readability, maintainability - // See http://eslint.org/docs/rules/max-statements - "max-statements" : [2, 20], - - // Limit cyclomatic complexity - // - // Reasons: readability, maintainability - // See http://eslint.org/docs/rules/complexity - "complexity" : [2, 5], - - // Limit line lengths - // - // Reasons: readability - // http://eslint.org/docs/rules/max-len - "max-len" : [2, 120], - - // Prevent mixed spaces and tabs - // - // Reasons: stylistic - // See http://eslint.org/docs/rules/no-mixed-spaces-and-tabs - "no-mixed-spaces-and-tabs": [2, true], - - // Require space after: - // if, else, for, while, do, switch, try, catch, finally, and with. - // - // Reasons: readability, stylistic - // See http://eslint.org/docs/rules/keyword-spacing - "keyword-spacing": [2], - - // Require spaces around operators - // - // Reasons: readability, stylistic - // See http://eslint.org/docs/rules/space-infix-ops - "space-infix-ops": 2, - - // Forbid spaces between function name and parens when calling - // - // Reasons: readability, stylistic - // See http://eslint.org/docs/rules/no-spaced-func - "no-spaced-func": 2, - - // Require commas at end of line, never start - // - // Reasons: readability, stylistic - // See http://eslint.org/docs/rules/comma-style - "comma-style": [2, "last"], - - // Require linefeed at end of file - // - // Reasons: scripting/concat compatibility - // See http://eslint.org/docs/rules/eol-last - "eol-last": 2, - - // Use 'self' as replacement for 'this' where necessary - // - // Reasons: readability, stylistic - // See http://eslint.org/docs/rules/consistent-this - "consistent-this": [2, "self"], - - // Require no space between function and open parenthsis - // - // Reasons: readability, stylistic - // See http://eslint.org/docs/rules/space-before-function-paren - "space-before-function-paren": [2, "never"], - - // Braces should start on the same line as the corresponidng - // statement or decleration. - // - // Reason: readability, stylistic - // See http://eslint.org/docs/rules/brace-style - "brace-style": [2, "1tbs", { "allowSingleLine": true }], - - // Require space before blocks - // - // Reason: readability, stylistic - // See: http://eslint.org/docs/rules/space-before-blocks - "space-before-blocks": [2, { "functions": "always", "keywords": "always", "classes": "always" }], - - // Disallow spaces directly after '(' and before ')' - // - // Reason: readability, stylistic - // See http://eslint.org/docs/rules/space-in-parens - "space-in-parens": [2, "never"], - - // Disallow spaces inside of curly braces in objects - // - // Reason: stylistic - // See http://eslint.org/docs/rules/object-curly-spacing - "object-curly-spacing": [2, "never"], - - // Disallow spaces inside of computed properties - // - // Reason: stylistic - // See http://eslint.org/docs/rules/computed-property-spacing - "computed-property-spacing": [2, "never"], - - // Disallow spaces inside of brackets - // - // Reason: stylistic - // See http://eslint.org/docs/rules/array-bracket-spacing - "array-bracket-spacing": [2, "never"], - - // Disallow space before comma and require space after comma - // - // Reason: readability, stylistic - // See http://eslint.org/docs/rules/comma-spacing - "comma-spacing": [2, {"before": false, "after": true}], - - // Disallow space before semicolon and require space after semicolon - // - // Reason: readability, stylistic - // http://eslint.org/docs/rules/semi-spacing - "semi-spacing": [2, {"before": false, "after": true}], - - "no-console": "warn" - } - -} + // Prevent parent eslintrc from interfering + root: true, + + // Begin with the recommended rules from eslint itself + extends: "eslint:recommended", + + // Globals + env: { + browser: true, + node: true, + es6: true + }, + + // ES6 + parserOptions: { + ecmaVersion: 6, + sourceType: "module" + }, + + rules: { + // Disallow declaring the same variable more then once + // + // Reasons: stylistic, gotcha + // See http://eslint.org/docs/rules/no-redeclare.html + "no-redeclare": 2, + + // Disallow the declaration of duplicate keys in an object + // + // Reasons: safety, gotcha + // See http://eslint.org/docs/rules/no-dupe-keys.html + "no-dupe-keys": 2, + + // Disallow use of undeclared variables unless mentioned in a /*global */ block + // + // Reasons: side-effects, safety + // See http://eslint.org/docs/rules/no-undef.html + "no-undef": 2, + + // Enforce camelCase names, but allow snake_case + // properties on objects where necessary. + // + // Best practice recommendation is camelCase always. + // + // Reasons: stylistic + // See http://eslint.org/docs/rules/camelcase + camelcase: [2, { properties: "never" }], + + // Require use of === and !== to avoid problematic + // type coercion + // + // Reasons: safety, gotcha + // See http://eslint.org/docs/rules/eqeqeq + eqeqeq: 2, + + // Require valid JSDoc comments, where JSDoc comments + // are used. You are free to not document functions, + // but when functions are documented (like your public API - + // you document that, right?) the JSDoc comments must be + // valid and match the params of the given function. + // + // Reasons: maintainability, readability + // See http://usejsdoc.org/ + // See http://eslint.org/docs/rules/valid-jsdoc + "valid-jsdoc": [ + 2, + { + requireParamDescription: true, + requireReturnDescription: true, + requireReturn: true + } + ], + + // Require curly braces for every new block or + // scope, including single-line statements. + // + // Reasons: safety, stylistic, readability + // See http://eslint.org/docs/rules/curly + curly: 2, + + // Prevent extension of built-in objects. + // + // Reasons: side-effects, safety + // See http://eslint.org/docs/rules/no-extend-native + "no-extend-native": 2, + + // Prevent reassignment/shadowing of native objects + // + // Reasons: side-effects, safety + // See http://eslint.org/docs/rules/no-native-reassign + "no-native-reassign": 2, + + // Require indentation in line with most idiomatic + // Javascript style guides: two spaces, no tabs + // + // Reasons: stylistic, consistency + // See http://eslint.org/docs/rules/indent + indent: [2, 2], // {int} Number of spaces to use for indentation + + // Require that `new`-able objects are represented + // by a symbol with a capital letter + // + // Reasons: stylistic + // See http://eslint.org/docs/rules/new-cap + "new-cap": 2, // true: Require capitalization of all constructor functions e.g. `new F()` + + // Require that parentheses are used when `new`-ing a + // constructor, even if the constructor has no arguments. + // + // Reasons: stylistic + // See http://eslint.org/docs/rules/new-parens + "new-parens": 2, + + // Forbid use of `new` without assigning the result + // + // Reasons: side-effects + // See http://eslint.org/docs/rules/no-new + "no-new": 2, + + // Prevent inclusion of unused variables in final code + // + // Reasons: maintainability + // See http://eslint.org/docs/rules/no-unused-vars + "no-unused-vars": 2, + + // Fail on finding lines with trailing whitespace. + // Indicates that you may have a misconfigured text editor. + // + // Reasons: stylistic + // See http://eslint.org/docs/rules/no-trailing-spaces + "no-trailing-spaces": 2, + + // Limit arity of functions. While you may occasionally + // need to create a function with higher arity than recommended, + // these functions should be marked as exceptions with linter + // comments. + // + // Reasons: maintainability + // See http://eslint.org/docs/rules/max-params + "max-params": [2, 5], + + // Limit block-depth of code for management of complexity + // + // Reasons: readability, maintainability + // See http://eslint.org/docs/rules/max-depth + "max-depth": [2, 4], + + // Avoid nested callbacks wherever possible. Prefer + // promises over nesting. + // + // Reasons: readability, maintainability + // See http://eslint.org/docs/rules/max-nested-callbacks + "max-nested-callbacks": [2, 3], + + // Limit length of functions - prefer small units of + // functionality over long routines + // + // Reasons: readability, maintainability + // See http://eslint.org/docs/rules/max-statements + "max-statements": [2, 20], + + // Limit cyclomatic complexity + // + // Reasons: readability, maintainability + // See http://eslint.org/docs/rules/complexity + complexity: [2, 5], + + // Limit line lengths + // + // Reasons: readability + // http://eslint.org/docs/rules/max-len + "max-len": [2, 120], + + // Prevent mixed spaces and tabs + // + // Reasons: stylistic + // See http://eslint.org/docs/rules/no-mixed-spaces-and-tabs + "no-mixed-spaces-and-tabs": [2, true], + + // Require space after: + // if, else, for, while, do, switch, try, catch, finally, and with. + // + // Reasons: readability, stylistic + // See http://eslint.org/docs/rules/keyword-spacing + "keyword-spacing": [2], + + // Require spaces around operators + // + // Reasons: readability, stylistic + // See http://eslint.org/docs/rules/space-infix-ops + "space-infix-ops": 2, + + // Forbid spaces between function name and parens when calling + // + // Reasons: readability, stylistic + // See http://eslint.org/docs/rules/no-spaced-func + "no-spaced-func": 2, + + // Require commas at end of line, never start + // + // Reasons: readability, stylistic + // See http://eslint.org/docs/rules/comma-style + "comma-style": [2, "last"], + + // Require linefeed at end of file + // + // Reasons: scripting/concat compatibility + // See http://eslint.org/docs/rules/eol-last + "eol-last": 2, + + // Use 'self' as replacement for 'this' where necessary + // + // Reasons: readability, stylistic + // See http://eslint.org/docs/rules/consistent-this + "consistent-this": [2, "self"], + + // Require no space between function and open parenthsis + // + // Reasons: readability, stylistic + // See http://eslint.org/docs/rules/space-before-function-paren + "space-before-function-paren": [2, "never"], + + // Braces should start on the same line as the corresponidng + // statement or decleration. + // + // Reason: readability, stylistic + // See http://eslint.org/docs/rules/brace-style + "brace-style": [2, "1tbs", { allowSingleLine: true }], + + // Require space before blocks + // + // Reason: readability, stylistic + // See: http://eslint.org/docs/rules/space-before-blocks + "space-before-blocks": [ + 2, + { functions: "always", keywords: "always", classes: "always" } + ], + + // Disallow spaces directly after '(' and before ')' + // + // Reason: readability, stylistic + // See http://eslint.org/docs/rules/space-in-parens + "space-in-parens": [2, "never"], + + // Disallow spaces inside of curly braces in objects + // + // Reason: stylistic + // See http://eslint.org/docs/rules/object-curly-spacing + "object-curly-spacing": [2, "never"], + + // Disallow spaces inside of computed properties + // + // Reason: stylistic + // See http://eslint.org/docs/rules/computed-property-spacing + "computed-property-spacing": [2, "never"], + + // Disallow spaces inside of brackets + // + // Reason: stylistic + // See http://eslint.org/docs/rules/array-bracket-spacing + "array-bracket-spacing": [2, "never"], + + // Disallow space before comma and require space after comma + // + // Reason: readability, stylistic + // See http://eslint.org/docs/rules/comma-spacing + "comma-spacing": [2, { before: false, after: true }], + + // Disallow space before semicolon and require space after semicolon + // + // Reason: readability, stylistic + // http://eslint.org/docs/rules/semi-spacing + "semi-spacing": [2, { before: false, after: true }], + + "no-console": "warn" + } +}; diff --git a/inlineplz/linters/config/.gometalinter.json b/inlineplz/linters/config/.gometalinter.json index 0877a4ed..48b10cad 100644 --- a/inlineplz/linters/config/.gometalinter.json +++ b/inlineplz/linters/config/.gometalinter.json @@ -1,3 +1,11 @@ { - "Enable": ["deadcode", "unconvert", "structcheck", "gotype", "gotypex", "varcheck", "megacheck"] + "Enable": [ + "deadcode", + "unconvert", + "structcheck", + "gotype", + "gotypex", + "varcheck", + "megacheck" + ] } diff --git a/inlineplz/linters/config/.htmlhintrc b/inlineplz/linters/config/.htmlhintrc index d8433a55..a4e3f9c3 100644 --- a/inlineplz/linters/config/.htmlhintrc +++ b/inlineplz/linters/config/.htmlhintrc @@ -1,25 +1,25 @@ { - "attr-value-double-quotes": true, - "doctype-first": true, - "tag-pair": true, - "spec-char-escape": true, - "id-unique": true, - "src-not-empty": true, - "attr-no-duplication": true, - "title-require": true, - "csslint": { - "display-property-grouping": true, - "known-properties": true - }, - "jshint": { - "undef": true, - "unused": true, - "node": true, - "expr": true, - "globals": {} - }, - "attr-value-not-empty": true, - "head-script-disabled": true, - "id-class-ad-disabled": true, - "alt-require": true -} \ No newline at end of file + "attr-value-double-quotes": true, + "doctype-first": true, + "tag-pair": true, + "spec-char-escape": true, + "id-unique": true, + "src-not-empty": true, + "attr-no-duplication": true, + "title-require": true, + "csslint": { + "display-property-grouping": true, + "known-properties": true + }, + "jshint": { + "undef": true, + "unused": true, + "node": true, + "expr": true, + "globals": {} + }, + "attr-value-not-empty": true, + "head-script-disabled": true, + "id-class-ad-disabled": true, + "alt-require": true +} diff --git a/inlineplz/linters/config/.jscsrc b/inlineplz/linters/config/.jscsrc index 03b659d3..08134f3d 100644 --- a/inlineplz/linters/config/.jscsrc +++ b/inlineplz/linters/config/.jscsrc @@ -1,69 +1,67 @@ { - "disallowMixedSpacesAndTabs": true, - "disallowSpaceAfterObjectKeys": true, - "disallowSpaceBeforeBinaryOperators": [ - "," - ], - "disallowSpacesInFunctionExpression": { - "beforeOpeningRoundBrace": true - }, - "disallowSpacesInsideArrayBrackets": true, - "disallowSpacesInsideParentheses": true, - "disallowTrailingWhitespace": true, - "maximumLineLength": { - "value": 110, - "allowUrlComments": true - }, - "requireCommaBeforeLineBreak": true, - "requireLineFeedAtFileEnd": true, - "requireSpaceAfterBinaryOperators": [ - "=", - ",", - "+", - "-", - "/", - "*", - "==", - "===", - "!=", - "!==", - ":", - "&&", - "||" - ], - "requireSpaceAfterKeywords": [ - "if", - "else", - "for", - "while", - "do", - "switch", - "return", - "try", - "catch" - ], - "requireSpaceBeforeBinaryOperators": [ - "=", - "+", - "-", - "/", - "*", - "==", - "===", - "!=", - "!==", - "&&", - "||" - ], - "requireSpaceBeforeBlockStatements": true, - "requireSpacesInFunctionExpression": { - "beforeOpeningCurlyBrace": true - }, - "safeContextKeyword": ["self"], - "validateQuoteMarks": { - "escape": true, - "mark": "'" - }, - "validateIndentation": 2, - "excludeFiles": ["node_modules/**", ".git/**"] + "disallowMixedSpacesAndTabs": true, + "disallowSpaceAfterObjectKeys": true, + "disallowSpaceBeforeBinaryOperators": [","], + "disallowSpacesInFunctionExpression": { + "beforeOpeningRoundBrace": true + }, + "disallowSpacesInsideArrayBrackets": true, + "disallowSpacesInsideParentheses": true, + "disallowTrailingWhitespace": true, + "maximumLineLength": { + "value": 110, + "allowUrlComments": true + }, + "requireCommaBeforeLineBreak": true, + "requireLineFeedAtFileEnd": true, + "requireSpaceAfterBinaryOperators": [ + "=", + ",", + "+", + "-", + "/", + "*", + "==", + "===", + "!=", + "!==", + ":", + "&&", + "||" + ], + "requireSpaceAfterKeywords": [ + "if", + "else", + "for", + "while", + "do", + "switch", + "return", + "try", + "catch" + ], + "requireSpaceBeforeBinaryOperators": [ + "=", + "+", + "-", + "/", + "*", + "==", + "===", + "!=", + "!==", + "&&", + "||" + ], + "requireSpaceBeforeBlockStatements": true, + "requireSpacesInFunctionExpression": { + "beforeOpeningCurlyBrace": true + }, + "safeContextKeyword": ["self"], + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + "validateIndentation": 2, + "excludeFiles": ["node_modules/**", ".git/**"] } diff --git a/inlineplz/linters/config/.jshintrc b/inlineplz/linters/config/.jshintrc index 5ab877f1..af1e1669 100644 --- a/inlineplz/linters/config/.jshintrc +++ b/inlineplz/linters/config/.jshintrc @@ -1,7 +1,7 @@ { - "undef": true, - "unused": true, - "node": true, - "expr": true, - "globals": {} -} \ No newline at end of file + "undef": true, + "unused": true, + "node": true, + "expr": true, + "globals": {} +} diff --git a/inlineplz/linters/config/bandit.yaml b/inlineplz/linters/config/bandit.yaml index 31c4d991..9294553f 100644 --- a/inlineplz/linters/config/bandit.yaml +++ b/inlineplz/linters/config/bandit.yaml @@ -1,17 +1,17 @@ exclude_dirs: - - '/node_modules/' - - '/test/' - - '/tests/' - - '/.git/' - - '/.tox/' + - "/node_modules/" + - "/test/" + - "/tests/" + - "/.git/" + - "/.tox/" - '\node_modules\' - '\test\' - '\tests\' - '\.git\' - '\.tox\' -plugin_name_pattern: '*.py' +plugin_name_pattern: "*.py" include: - - '*.py' - - '*.pyw' + - "*.py" + - "*.pyw" diff --git a/linter-examples/github.com/wata727/tflint/README.md b/linter-examples/github.com/wata727/tflint/README.md index fbd98eb5..3cd24c36 100644 --- a/linter-examples/github.com/wata727/tflint/README.md +++ b/linter-examples/github.com/wata727/tflint/README.md @@ -1,6 +1,5 @@ Sample terraform files for exercising https://github.com/wata727/tflint - ```bash $ brew tap wata727/tflint $ brew install tflint