Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove build from the default exclusion list #10093

Merged
merged 1 commit into from
Feb 28, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

This is a not-unpopular directory name, and it's led to tons of issues and user confusion (most recently: astral-sh/ruff-pre-commit#69). I've wanted to remove it for a long time, but we need to do so as part of a minor release.

@charliermarsh charliermarsh added this to the v0.3.0 milestone Feb 23, 2024
@charliermarsh charliermarsh added the configuration Related to settings and configuration label Feb 23, 2024
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you remember the motiviation for including build in the exclude by default?

Nit: Extend your PR summary with an example on how to change the configuration when upgrading ruff for people that rely on build being excluded.

@MichaReiser MichaReiser added the breaking Breaking API change label Feb 23, 2024
@gotmax23
Copy link

Do you remember the motiviation for including build in the exclude by default?

Doesn't setuptools use that directory for building extension modules?

@gotmax23
Copy link

Do you remember the motiviation for including build in the exclude by default?

Doesn't setuptools use that directory for building extension modules?

And sometimes, it seems bdist_wheel copies the project's actual Python files to the build/ directory. In those cases, including that directory would cause the project to be linted twice.

@charliermarsh
Copy link
Member Author

It's fine if some users need to ignore build -- we already respect the .gitignore, so if it's in there, this won't have any effect. Similarly, they can add it to extend-exclude.

Copy link
Contributor

github-actions bot commented Feb 26, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+26 -0 violations, +0 -0 fixes in 2 projects; 41 projects unchanged)

aws/aws-sam-cli (+22 -0 violations, +0 -0 fixes)

+ samcli/commands/build/build_context.py:581:46: E741 Ambiguous variable name: `l`
+ samcli/commands/build/build_context.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/commands/build/build_context.py:610:21: E741 Ambiguous variable name: `l`
+ samcli/commands/build/build_context.py:642:46: E741 Ambiguous variable name: `l`
+ samcli/commands/build/command.py:25:5: F401 [*] `samcli.commands._utils.options.terraform_plan_file_option` imported but unused
+ samcli/commands/build/command.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/commands/build/core/options.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/lib/build/app_builder.py:1003:28: PLR2004 Magic value used in comparison, consider replacing `-32601` with a constant variable
+ samcli/lib/build/app_builder.py:45:44: F401 [*] `samcli.local.docker.exceptions.ContainerNotStartableException` imported but unused
+ samcli/lib/build/app_builder.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/lib/build/app_builder.py:991:16: PLR2004 Magic value used in comparison, consider replacing `400` with a constant variable
+ samcli/lib/build/app_builder.py:991:34: PLR2004 Magic value used in comparison, consider replacing `500` with a constant variable
+ samcli/lib/build/app_builder.py:995:28: PLR2004 Magic value used in comparison, consider replacing `505` with a constant variable
+ samcli/lib/build/build_graph.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/lib/build/build_strategy.py:30:51: F401 [*] `samcli.lib.utils.architecture.ARM64` imported but unused
+ samcli/lib/build/build_strategy.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/lib/build/bundler.py:10:50: F401 [*] `samcli.commands.local.lib.exceptions.InvalidHandlerPathError` imported but unused
+ samcli/lib/build/bundler.py:7:27: F401 [*] `pathlib.PosixPath` imported but unused
+ samcli/lib/build/dependency_hash_generator.py:3:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/lib/build/utils.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/lib/build/workflow_config.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/lib/build/workflow_config.py:7:42: F401 [*] `typing.Tuple` imported but unused

pypa/pip (+4 -0 violations, +0 -0 fixes)

+ src/pip/_internal/operations/build/build_tracker.py:6:47: F401 [*] `typing.Set` imported but unused
+ src/pip/_internal/operations/build/build_tracker.py:8:39: F401 [*] `pip._internal.models.link.Link` imported but unused
+ src/pip/_internal/operations/build/wheel_legacy.py:43:15: UP032 [*] Use f-string instead of `format` call
+ src/pip/_internal/operations/build/wheel_legacy.py:49:15: UP032 [*] Use f-string instead of `format` call

Changes by rule (5 rules affected)

code total + violation - violation + fix - fix
I001 9 9 0 0 0
F401 8 8 0 0 0
PLR2004 4 4 0 0 0
E741 3 3 0 0 0
UP032 2 2 0 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+45 -0 violations, +0 -0 fixes in 2 projects; 41 projects unchanged)

aws/aws-sam-cli (+41 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ samcli/commands/build/build_context.py:53:1: PLR0904 Too many public methods (26 > 20)
+ samcli/commands/build/build_context.py:54:9: PLR0917 Too many positional arguments (26/5)
+ samcli/commands/build/build_context.py:581:46: E741 Ambiguous variable name: `l`
+ samcli/commands/build/build_context.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/commands/build/build_context.py:610:21: E741 Ambiguous variable name: `l`
+ samcli/commands/build/build_context.py:642:46: E741 Ambiguous variable name: `l`
+ samcli/commands/build/command.py:139:5: PLR0917 Too many positional arguments (25/5)
+ samcli/commands/build/command.py:200:5: PLR0917 Too many positional arguments (22/5)
+ samcli/commands/build/command.py:228:5: PLC0415 `import` should be at the top-level of a file
+ samcli/commands/build/command.py:25:5: F401 [*] `samcli.commands._utils.options.terraform_plan_file_option` imported but unused
+ samcli/commands/build/command.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/commands/build/core/options.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/lib/build/app_builder.py:1003:28: PLR2004 Magic value used in comparison, consider replacing `-32601` with a constant variable
+ samcli/lib/build/app_builder.py:458:9: PLR0917 Too many positional arguments (10/5)
+ samcli/lib/build/app_builder.py:45:44: F401 [*] `samcli.local.docker.exceptions.ContainerNotStartableException` imported but unused
+ samcli/lib/build/app_builder.py:593:9: PLR0917 Too many positional arguments (11/5)
+ samcli/lib/build/app_builder.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/lib/build/app_builder.py:732:9: PLR0917 Too many positional arguments (8/5)
... 7 additional changes omitted for rule PLR0917
+ samcli/lib/build/app_builder.py:991:16: PLR2004 Magic value used in comparison, consider replacing `400` with a constant variable
+ samcli/lib/build/app_builder.py:991:34: PLR2004 Magic value used in comparison, consider replacing `500` with a constant variable
+ samcli/lib/build/app_builder.py:995:28: PLR2004 Magic value used in comparison, consider replacing `505` with a constant variable
+ samcli/lib/build/build_graph.py:379:13: PLW1514 `open` in text mode without explicit `encoding` argument
+ samcli/lib/build/build_graph.py:471:13: PLW1514 `open` in text mode without explicit `encoding` argument
+ samcli/lib/build/build_graph.py:515:7: PLW1641 Object does not implement `__hash__` method
+ samcli/lib/build/build_graph.py:579:7: PLW1641 Object does not implement `__hash__` method
+ samcli/lib/build/build_graph.py:5:1: I001 [*] Import block is un-sorted or un-formatted
+ samcli/lib/build/build_strategy.py:30:51: F401 [*] `samcli.lib.utils.architecture.ARM64` imported but unused
+ samcli/lib/build/build_strategy.py:5:1: I001 [*] Import block is un-sorted or un-formatted
... 4 additional changes omitted for rule I001
+ samcli/lib/build/bundler.py:10:50: F401 [*] `samcli.commands.local.lib.exceptions.InvalidHandlerPathError` imported but unused
+ samcli/lib/build/bundler.py:7:27: F401 [*] `pathlib.PosixPath` imported but unused
+ samcli/lib/build/utils.py:17:28: PLR6201 Use a `set` literal when testing for membership
+ samcli/lib/build/workflow_config.py:7:42: F401 [*] `typing.Tuple` imported but unused
... 1 additional changes omitted for rule F401

pypa/pip (+4 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ src/pip/_internal/operations/build/build_tracker.py:6:47: F401 [*] `typing.Set` imported but unused
+ src/pip/_internal/operations/build/build_tracker.py:8:39: F401 [*] `pip._internal.models.link.Link` imported but unused
+ src/pip/_internal/operations/build/wheel_legacy.py:43:15: UP032 [*] Use f-string instead of `format` call
+ src/pip/_internal/operations/build/wheel_legacy.py:49:15: UP032 [*] Use f-string instead of `format` call

Changes by rule (11 rules affected)

code total + violation - violation + fix - fix
PLR0917 12 12 0 0 0
I001 9 9 0 0 0
F401 8 8 0 0 0
PLR2004 4 4 0 0 0
E741 3 3 0 0 0
PLW1514 2 2 0 0 0
PLW1641 2 2 0 0 0
UP032 2 2 0 0 0
PLR0904 1 1 0 0 0
PLC0415 1 1 0 0 0
PLR6201 1 1 0 0 0

@MichaReiser
Copy link
Member

@charliermarsh
Copy link
Member Author

@MichaReiser - I'll do it now and merge this.

@charliermarsh charliermarsh enabled auto-merge (squash) February 28, 2024 16:23
@charliermarsh charliermarsh merged commit 317d2e4 into main Feb 28, 2024
17 checks passed
@charliermarsh charliermarsh deleted the charlie/build branch February 28, 2024 16:30
AlexWaygood added a commit that referenced this pull request Feb 28, 2024
We need to bump the number of files we expect to have formatting violations following #10093
nkxxll pushed a commit to nkxxll/ruff that referenced this pull request Mar 10, 2024
## Summary

This is a not-unpopular directory name, and it's led to tons of issues
and user confusion (most recently:
astral-sh/ruff-pre-commit#69). I've wanted to
remove it for a long time, but we need to do so as part of a minor
release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking API change configuration Related to settings and configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants