Slurp up linter output and send it to a GitHub PR review.
Project description
Lintly
A Continuous Integration CLI that slurps up linter output and sends it to a GitHub PR review.
Usage
First, pip
install lintly:
$ pip install lintly
Lintly requires Python 2.7 or 3.4+.
Next, set the LINTLY_API_KEY
environment variable to your GitHub API Key:
$ export LINTLY_API_KEY="12345"
Finally, pipe the output of your linter to the lintly
script:
$ flake8 | lintly
Now you will see a review with linting errors...
...and a commit check...
...on your pull requests! Nifty! 🎉
Supported Git Services
- GitHub
Support for GitLab and Bitbucket is planned.
Supported Linters
-
$ flake8 | lintly --format=flake8
-
$ black --check | lintly --format=black
-
- For pylint you must use the
json
output format.
$ pylint . --output-format=json | lintly --format=pylint-json
- For pylint you must use the
-
$ eslint . | lintly --format=eslint
-
$ stylelint . | lintly --format=stylelint
-
$ cfn-lint template.yaml | lintly --format=cfn-lint
-
$ cfn_nag_scan --input-path cloudformation-template.yaml --output-format=json | lintly --format=cfn-nag
Additional linters can be added by modifying the lintly/parsers.py
module.
Configuration
At a minimum Lintly needs to know the following information to determine how to post the correct GitHub PR Review:
- GitHub API key (
--api-key
orLINTLY_API_KEY
env var)- Generate your own API Key here. The API key will need the following GitHub scopes:
repo:status
so that Lintly can post commit statuses on PRs.public_repo
so that Lintly can create pull request reviews on public repos.repo
so that Lintly can create pull request reviews on private repos.
- Generate your own API Key here. The API key will need the following GitHub scopes:
- GitHub repository (
--repo
orLINTLY_REPO
env var)- This is your repository in the format
grantmcconnaughey/lintly
.
Note: Most Continuous Integration platforms will provide this value automatically.
- This is your repository in the format
- Pull Request number (
--pr
orLINTLY_PR
env var)Note: Most Continuous Integration platforms will provide this value automatically.
These configuration values can be provided to Lintly via environment variables or by being passed in as arguments to the Lintly CLI. A list of all configuration values can be viewed by running lintly --help
.
Supported Continuous Integration platforms
Lintly works out of the box with all of the CI platforms supported by ci.py. To add support for new CI platforms create a PR to the ci.py repo.
When using these Continuous Integration platforms the repository, pull request number, and commit SHA will be detected automatically.
Travis CI example
To use with Lintly with Travis CI, add the following to your .travis.yml
config file:
language: python
jobs:
include:
- stage: lint
install: pip install lintly
script: flake8 | lintly --format=flake8
stages:
- lint
To-Do
- Add support for GitHub Enterprise custom GitHub URLs
- Configuration to post either a PR comment or PR review
- Link to Build URL from commit status
- Support for config file
- Auto-detect linters
- GitLab support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for lintly-0.4.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf8ace88c14cab1d38e2ff7a88c1153c0f466d09fc72df1d5b9c98c91303d5cf |
|
MD5 | f466c4e311b1135d6c91df2950ecff52 |
|
BLAKE2b-256 | 89a2ab17bc85ff2723b27df26a9f8eef4a9d2c03a6cb8dc6437d549c3dd98d1a |