Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .inlineplz.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
enabled_linters:
- coala
- prospector
autofix: true
8 changes: 4 additions & 4 deletions .stickler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
74 changes: 37 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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+oLDy0kAre0tO8aKjin18lKE2No0Idd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dXKQvdRwJy2QOp+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
9 changes: 4 additions & 5 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
48 changes: 22 additions & 26 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[inline-plz]:

proselint: 105: typography.symbols.ellipsis '...' is an approximation, use the ellipsis symbol '…'.
proselint: 121: leonard.exclamation.30ppm More than 30 ppm of exclamations. Keep them under control.


# 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():
Expand Down Expand Up @@ -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:

Expand Down Expand Up @@ -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")
Expand All @@ -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.

32 changes: 16 additions & 16 deletions examples/all-the-linters-enabled.inlineplz.yml
Original file line number Diff line number Diff line change
@@ -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
42 changes: 21 additions & 21 deletions examples/your-standard-node-app.inlineplz.yml
Original file line number Diff line number Diff line change
@@ -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
Loading