File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ trim_trailing_whitespace = true
1010[* .py ]
1111indent_style = space
1212indent_size = 4
13+ max_line_length = 88
1314
1415[Makefile ]
1516indent_style = tab
Original file line number Diff line number Diff line change 4040 uses : codecov/codecov-action@v2
4141
4242 python-code-quality :
43- # Run flake8 for linting
43+ # Run ruff for linting and formatting
4444 runs-on : ubuntu-latest
4545
4646 steps :
5050 - name : Install python packages
5151 run : pip install -r requirements.txt
5252
53- - name : Run flake8
54- run : flake8 .
53+ - name : Run ruff
54+ run : |
55+ ruff check .
56+ ruff format --check .
Original file line number Diff line number Diff line change @@ -48,10 +48,11 @@ Ready to contribute? Here's how to set up `pywikitools` for local development.
4848
4949 Now you can make your changes locally.
5050
51- 5 . When you're done making changes, check that all tests are passing and that
52- ` flake8 ` has nothing to complain:
51+ 5 . When you're done making changes, run ` make format ` and check that all tests
52+ are passing and that ` make lint ` has nothing to complain:
5353
5454 ``` shell
55+ $ make format
5556 $ make test
5657 $ make lint
5758 ```
@@ -70,7 +71,7 @@ Ready to contribute? Here's how to set up `pywikitools` for local development.
7071
7172* Please write good and readable code with meaningful documentation.
7273* We do our best to follow the PEP 8 style guide ([ PEP 8] ( https://pep8.org/ ) )
73- with the exception that lines can have up to ` 120 characters` .
74+ with a maximum line length of ` 88 characters` (enforced by Ruff) .
7475* Every script should print documentation on arguments when run without or with
7576 incorrect arguments.
7677
Original file line number Diff line number Diff line change 1- .PHONY : help test lint coverage clean clean-pyc clean-test
1+ .PHONY : help test lint format coverage clean clean-pyc clean-test
22
33.DEFAULT_GOAL := help
44
55PYTHON ?= ./env/bin/python
6- FLAKE8 ?= ./env/bin/flake8
6+ RUFF ?= ./env/bin/ruff
77COVERAGE ?= ./env/bin/coverage
88
99define BROWSER_PYSCRIPT
@@ -34,8 +34,12 @@ help: ## show this help
3434test : # # run the test suite
3535 $(PYTHON ) -m unittest discover -s pywikitools/test
3636
37- lint : # # check style with flake8
38- $(FLAKE8 ) .
37+ lint : # # check style with ruff
38+ $(RUFF ) check .
39+ $(RUFF ) format --check .
40+
41+ format : # # auto-format code with ruff
42+ $(RUFF ) format .
3943
4044coverage : # # run tests with coverage report and open HTML in browser
4145 $(COVERAGE ) run --source=pywikitools/,pywikitools/correctbot/ --omit=pywikitools/user-config.py -m unittest discover -s pywikitools/test
Original file line number Diff line number Diff line change @@ -97,15 +97,17 @@ From your base pywikitools path (with the virtual environment set up):
9797
9898```shell
9999$ make test # run the test suite
100- $ make lint # check style with flake8
100+ $ make lint # check style with ruff
101+ $ make format # auto-format code with ruff
101102$ make coverage # coverage report; opens htmlcov/ in your browser
102103```
103104
104105The same commands without `make`:
105106
106107```shell
107108$ python -m unittest discover -s pywikitools/test
108- $ flake8 .
109+ $ ruff check .
110+ $ ruff format --check .
109111```
110112
111113With `GitHub Actions` tests and linting run automatically on every push or pull
Original file line number Diff line number Diff line change 1+ [tool .ruff ]
2+ line-length = 88
3+ exclude = [
4+ " env" ,
5+ " pywikitools/user-config.py" ,
6+ " pywikitools/correctbot/user-config.py" ,
7+ ]
8+
9+ [tool .ruff .format ]
10+ # defaults (Black-compatible) are sufficient
Original file line number Diff line number Diff line change 1- flake8 >= 7.3 .0
1+ ruff >= 0.8 .0
22coverage >= 7.3.2
33wikitextparser >= 0.54.0
44pywikibot >= 8.4.0
Load diff This file was deleted.
You can’t perform that action at this time.
0 commit comments