Skip to content

Commit d203942

Browse files
authored
Update README.md
1 parent 3d142c8 commit d203942

File tree

1 file changed

+45
-31
lines changed

1 file changed

+45
-31
lines changed

README.md

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,34 @@
11
# Python Linting Action
22

3-
> ℹ️ This is an _unofficial_ tool created by Field Security Services, and is not officially supported by GitHub.
3+
> [!NOTE]
4+
> This is an _unofficial_ tool created by Field Security Services, and is not officially supported by GitHub.
45
56
This Action and Python script lets you run one of several Python linters and type checkers, and upload the results to GitHub's Code Scanning, which is part of [Advanced Security](https://docs.github.com/en/get-started/learning-about-github/about-github-advanced-security) (free for open source projects hosted on GitHub).
67

7-
## Supported linters
8+
## Supported linters and type checkers
89

9-
- [Flake8](https://flake8.pycqa.org/en/latest/)
10-
- [Pylint](https://www.pylint.org/)
11-
- [Ruff](https://beta.ruff.rs/)
12-
- [Mypy](https://mypy.readthedocs.io/en/stable/)
13-
- [Pytype](https://github.com/google/pytype/) - for Python 3.10 and below
14-
- [Pyright](https://github.com/microsoft/pyright)
15-
- [Fixit 2](https://fixit.readthedocs.io/en/stable/) - for Python 3.8 and above
16-
- [Pyre](https://pyre-check.org/)
10+
- Linters:
11+
- [Flake8](https://flake8.pycqa.org/en/latest/)
12+
- [Pylint](https://www.pylint.org/)
13+
- [Ruff](https://beta.ruff.rs/)
14+
- [Fixit 2](https://fixit.readthedocs.io/en/stable/) - for Python 3.8 and above
15+
- Type checkers:
16+
- [Mypy](https://mypy.readthedocs.io/en/stable/)
17+
- [Pytype](https://github.com/google/pytype/) - for Python 3.10 and below
18+
- [Pyright](https://github.com/microsoft/pyright)
19+
- [Pyre](https://pyre-check.org/)
1720

1821
## Requirements
1922

20-
- Python 3.7 or higher
23+
- Python 3.7 or higher (3.8 or higher for MacOS on GitHub hosted runners)
2124
- For Pytype, Python 3.10 or lower
2225
- For Fixit, Python 3.8 or higher
2326
- GitHub Actions
27+
- GitHub Advanced Security (for private repositories)
2428

2529
## Usage
2630

27-
### Command line
28-
29-
First install the Flake8 SARIF formatter, if you are using Flake8:
30-
31-
```bash
32-
python3 -m pip install flake8-sarif-formatter
33-
```
34-
35-
Then run the linter:
36-
37-
```bash
38-
python3 ./python_lint.py <linter> [<linter> ...] [<options>]
39-
```
40-
41-
The linter/type checker can be one or more of `flake8`, `pylint`, `ruff`, `mypy`, `pytype`, `pyright`, `fixit`, `pyre`.
42-
43-
### Action
31+
### Actions usage
4432

4533
#### Configure the linters
4634

@@ -111,7 +99,8 @@ jobs:
11199
112100
Pin the version of a linter, e.g. if the latest version is incompatible with this Action.
113101
114-
> ℹ️ Remember to put quotes around version strings so they are not interpreted as floating point numbers.
102+
> [!NOTE]
103+
> Remember to put quotes around version strings so they are not interpreted as floating point numbers.
115104
116105
```yaml
117106
jobs:
@@ -124,12 +113,36 @@ jobs:
124113
ruff-version: "0.0.257"
125114
```
126115
116+
### Command line usage
117+
118+
First install the Flake8 SARIF formatter, if you are using Flake8:
119+
120+
```bash
121+
python3 -m pip install flake8-sarif-formatter
122+
```
123+
124+
Then run the linter, which must already be installed in your environment:
125+
126+
```bash
127+
python3 ./python_lint.py <linter> [<linter> ...] [<options>]
128+
```
129+
130+
The linter/type checker can be one or more of `flake8`, `pylint`, `ruff`, `mypy`, `pytype`, `pyright`, `fixit`, `pyre`.
131+
127132
## FAQ
128133

129-
### Why not use the existing Python linting Actions?
134+
### Why not use existing Python linting Actions?
130135

131136
They don't all produce SARIF, and they don't upload to Code Scanning.
132137

138+
### Why not use MegaLinter or Super-linter?
139+
140+
They aggregate lots of linters, for a lot of languages, but do not focus on producing output in SARIF, nor on Python.
141+
142+
Although MegaLinter has a [SARIF output formatter](https://megalinter.io/latest/reporters/SarifReporter/), only those linters natively able to produce SARIF are usable this way.
143+
144+
This Action is specialised for useful linters for Python, and produces SARIF.
145+
133146
### Why not create N different Actions?
134147

135148
It's far more convenient to have one Action that can run all of the popular linters, so you can configure it once and then run it with different linters.
@@ -180,7 +193,8 @@ See [CODEOWNERS](CODEOWNERS) for the list of maintainers.
180193

181194
## Support
182195

183-
> ℹ️ This is an _unofficial_ tool created by Field Security Services, and is not officially supported by GitHub.
196+
> [!NOTE]
197+
> This is an _unofficial_ tool created by Field Security Services, and is not officially supported by GitHub.
184198
185199
See the [SUPPORT](SUPPORT.md) file.
186200

0 commit comments

Comments
 (0)