ruff/resources/test/project
Charlie Marsh 92bc417e4e
Add support for glob patterns in `src` (#1225)
2022-12-12 21:35:03 -05:00
..
examples/docs Enable configuration files to "extend" other configuration files (#1219) 2022-12-12 20:28:22 -05:00
python_modules Add support for glob patterns in `src` (#1225) 2022-12-12 21:35:03 -05:00
src Add support for glob patterns in `src` (#1225) 2022-12-12 21:35:03 -05:00
README.md Add support for glob patterns in `src` (#1225) 2022-12-12 21:35:03 -05:00
pyproject.toml Add support for glob patterns in `src` (#1225) 2022-12-12 21:35:03 -05:00

README.md

project

An example multi-package Python project used to test setting resolution and other complex behaviors.

Expected behavior

Running from the repo root should pick up and enforce the appropriate settings for each package:

∴ cargo run resources/test/project/
Found 5 error(s).
resources/test/project/examples/docs/docs/file.py:1:1: I001 Import block is un-sorted or un-formatted
resources/test/project/examples/docs/docs/file.py:8:5: F841 Local variable `x` is assigned to but never used
resources/test/project/src/file.py:1:8: F401 `os` imported but unused
resources/test/project/src/file.py:5:5: F841 Local variable `x` is assigned to but never used
resources/test/project/src/import_file.py:1:1: I001 Import block is un-sorted or un-formatted
3 potentially fixable with the --fix option.

Running from the project directory itself should exhibit the same behavior:

∴ cd resources/test/project/ && cargo run .
Found 5 error(s).
examples/docs/docs/file.py:1:1: I001 Import block is un-sorted or un-formatted
examples/docs/docs/file.py:8:5: F841 Local variable `x` is assigned to but never used
src/file.py:1:8: F401 `os` imported but unused
src/file.py:5:5: F841 Local variable `x` is assigned to but never used
src/import_file.py:1:1: I001 Import block is un-sorted or un-formatted
3 potentially fixable with the --fix option.

Running from the sub-package directory should exhibit the same behavior, but omit the top-level files:

∴ cd resources/test/project/examples/docs && cargo run .
Found 2 error(s).
docs/file.py:1:1: I001 Import block is un-sorted or un-formatted
docs/file.py:8:5: F841 Local variable `x` is assigned to but never used
1 potentially fixable with the --fix option.

--config should force Ruff to use the specified pyproject.toml for all files, and resolve file paths from the current working directory:

∴ cargo run -- --config=resources/test/project/pyproject.toml resources/test/project/
Found 9 error(s).
resources/test/project/examples/docs/docs/concepts/file.py:1:8: F401 `os` imported but unused
resources/test/project/examples/docs/docs/concepts/file.py:5:5: F841 Local variable `x` is assigned to but never used
resources/test/project/examples/docs/docs/file.py:1:8: F401 `os` imported but unused
resources/test/project/examples/docs/docs/file.py:3:8: F401 `numpy` imported but unused
resources/test/project/examples/docs/docs/file.py:4:27: F401 `docs.concepts.file` imported but unused
resources/test/project/examples/docs/docs/file.py:8:5: F841 Local variable `x` is assigned to but never used
resources/test/project/src/file.py:1:8: F401 `os` imported but unused
resources/test/project/src/file.py:5:5: F841 Local variable `x` is assigned to but never used
resources/test/project/src/import_file.py:1:1: I001 Import block is un-sorted or un-formatted
6 potentially fixable with the --fix option.

Running from a parent directory should this "ignore" the exclude (hence, concepts/file.py gets included in the output):

∴ cd resources/test/project/examples && cargo run -- --config=docs/pyproject.toml .
Found 3 error(s).
docs/docs/concepts/file.py:5:5: F841 Local variable `x` is assigned to but never used
docs/docs/file.py:1:1: I001 Import block is un-sorted or un-formatted
docs/docs/file.py:8:5: F841 Local variable `x` is assigned to but never used
1 potentially fixable with the --fix option.