https://github.com/justinchuby/lintrunner-action
GitHub action to run lintrunner in CI
https://github.com/justinchuby/lintrunner-action
Last synced: about 1 month ago
JSON representation
GitHub action to run lintrunner in CI
- Host: GitHub
- URL: https://github.com/justinchuby/lintrunner-action
- Owner: justinchuby
- License: mit
- Created: 2023-07-29T00:02:46.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-18T14:18:07.000Z (9 months ago)
- Last Synced: 2025-04-06T16:18:56.340Z (about 2 months ago)
- Homepage: https://github.com/marketplace/actions/lint-with-lintrunner
- Size: 21.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lintrunner-action
This action sets up and runs `lintrunner`(https://github.com/suo/lintrunner) to lint the whole repository.
`lintrunner` is a tool that runs linters with auto-fix support. It provides a uniform linting experience in CI and in local dev environments. Visit https://github.com/suo/lintrunner to learn more about `lintrunner` and https://github.com/justinchuby/lintrunner-adapters to see the list of supported linters, as well as a simple guide on how to create support for new linters.
## Usage
See [action.yml](./action.yml)
```yaml
jobs:
lint:
permissions:
security-events: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: justinchuby/lintrunner-action@main
with:
# Whether the action should upload a SARIF report of the
# lint results which will show up as a GitHub code scanning report
publish_code_scanning: true
# Disable verbose logging from lintrunner and only show lint results
quiet: true
```## Set up lintrunner
To set up `lintrunner`, create a `.lintrunner.toml` configuration file in the root of the repository. An example linter configuration looks like:
```toml
merge_base_with = 'main'[[linter]]
code = 'RUFF'
include_patterns = [
'**/*.py',
'**/*.pyi',
]
exclude_patterns = [
]
command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'ruff_linter',
'--config=pyproject.toml',
'@{{PATHSFILE}}'
]
init_command = [
'python',
'-m',
'lintrunner_adapters',
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'--requirement=requirements/lintrunner/requirements.txt',
]
is_formatter = true
```Visit https://github.com/suo/lintrunner for a complete setup guide and https://github.com/pytorch/pytorch/wiki/lintrunner for more documentation.
### Example configs
- https://github.com/justinchuby/lintrunner-adapters/blob/main/.lintrunner.toml
- https://github.com/pytorch/pytorch/blob/main/.lintrunner.toml
- https://github.com/microsoft/onnxscript/blob/main/.lintrunner.toml