Skip to content

Commit

Permalink
Add extend-select = ["I"] to [tool.ruff.lint]. (#798)
Browse files Browse the repository at this point in the history
* Add `extend-select = ["I"]` to `[tool.ruff.lint]`.

* Add the coding style description to `CONTRIBUTING.md`.

* Fix quotations in `CONTRIBUTING.md`.
  • Loading branch information
junkmd authored Feb 5, 2025
1 parent 747e3dd commit 348af4e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,19 @@ Create a new git branch in your local repository, and start coding!
Tests can be run with `python -m unittest discover -v -s ./comtypes/test -t comtypes\test` command.

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

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

This project uses [Ruff](https://github.com/astral-sh/ruff/) as its linter and formatter.
The CI pipeline will detect any files in pull requests that do not conform to the rules specified in `pyproject.toml`.
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.
If any style issues are found, maintainers may ask you to make modifications.

### Pull requests
When you have resolved your issue, open a pull request in the `comtypes` repository.
Please include the issue number on the PR comment.
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ requires = ["setuptools>=61.2"]
build-backend = "setuptools.build_meta"

[tool.ruff.lint]
extend-select = ["I"]
ignore = ["E402"]

[tool.ruff.lint.per-file-ignores]
Expand All @@ -26,6 +27,10 @@ ignore = ["E402"]
"comtypes/tools/tlbparser.py" = ["F401"]
"comtypes/tools/typedesc.py" = ["F403", "F405"]
"comtypes/tools/typedesc_base.py" = ["F401"]
# gen directory
"comtypes/gen/*" = ["E", "F", "I"]
# stub
"comtypes/hints.pyi" = ["I"]
# tests
"comtypes/test/TestDispServer.py" = ["E401"]
"comtypes/test/find_memleak.py" = ["E401", "F401", "F403", "F405"]
Expand Down

0 comments on commit 348af4e

Please # to comment.