Skip to content

Commit 348af4e

Browse files
authored
Add extend-select = ["I"] to [tool.ruff.lint]. (#798)
* Add `extend-select = ["I"]` to `[tool.ruff.lint]`. * Add the coding style description to `CONTRIBUTING.md`. * Fix quotations in `CONTRIBUTING.md`.
1 parent 747e3dd commit 348af4e

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

CONTRIBUTING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,19 @@ Create a new git branch in your local repository, and start coding!
8686
Tests can be run with `python -m unittest discover -v -s ./comtypes/test -t comtypes\test` command.
8787

8888
When `comtypes.client.GetModule` is called, it parses the COM library, generates `.py` files under `.../comtypes/gen/...`, imports and returns `Python` modules.
89-
Those `.py` files act like caches.
89+
Those `.py` files act like "caches".
9090

9191
If there are some problems with the developing code base, partial or non-executable modules might be created in `.../comtypes/gen/...`.
9292
Importing them will cause some error.
9393
If that happens, you should run `python -m comtypes.clear_cache` to clear those caches.
9494
The command will delete the entire `.../comtypes/gen` directory.
9595
Importing `comtypes.client` will restore the directory and `__init__.py` file.
9696

97+
This project uses [Ruff](https://github.com/astral-sh/ruff/) as its linter and formatter.
98+
The CI pipeline will detect any files in pull requests that do not conform to the rules specified in `pyproject.toml`.
99+
To ensure a smooth contribution process, we recommend [installing Ruff](https://pypi.org/project/ruff/) and running `ruff check --fix comtypes/.` and `ruff format comtypes/.` before opening a PR or pushing your changes.
100+
If any style issues are found, maintainers may ask you to make modifications.
101+
97102
### Pull requests
98103
When you have resolved your issue, open a pull request in the `comtypes` repository.
99104
Please include the issue number on the PR comment.

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ requires = ["setuptools>=61.2"]
33
build-backend = "setuptools.build_meta"
44

55
[tool.ruff.lint]
6+
extend-select = ["I"]
67
ignore = ["E402"]
78

89
[tool.ruff.lint.per-file-ignores]
@@ -26,6 +27,10 @@ ignore = ["E402"]
2627
"comtypes/tools/tlbparser.py" = ["F401"]
2728
"comtypes/tools/typedesc.py" = ["F403", "F405"]
2829
"comtypes/tools/typedesc_base.py" = ["F401"]
30+
# gen directory
31+
"comtypes/gen/*" = ["E", "F", "I"]
32+
# stub
33+
"comtypes/hints.pyi" = ["I"]
2934
# tests
3035
"comtypes/test/TestDispServer.py" = ["E401"]
3136
"comtypes/test/find_memleak.py" = ["E401", "F401", "F403", "F405"]

0 commit comments

Comments
 (0)