Conversation
📝 WalkthroughSummary by CodeRabbit
Note: These improvements are internal and do not affect any end-user functionality or experience. WalkthroughThe changes involve formatting updates across multiple modules and test files, focusing on improving code readability. This includes reformatting single-line statements into multi-line structures, aligning method signatures and class declarations, and refining conditional statements. Additionally, f-strings are introduced for string interpolation. These modifications do not alter the functionality or logic of the code. Changes
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Note 🎁 Summarized by CodeRabbit FreeYour organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
src/pre_commit_terraform/__main__.py(1 hunks)src/pre_commit_terraform/_cli.py(1 hunks)src/pre_commit_terraform/_cli_parsing.py(1 hunks)src/pre_commit_terraform/_errors.py(1 hunks)src/pre_commit_terraform/_types.py(1 hunks)src/pre_commit_terraform/terraform_docs_replace.py(3 hunks)tests/pytest/_cli_test.py(3 hunks)tests/pytest/terraform_docs_replace_test.py(6 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
tests/pytest/_cli_test.py (4)
src/pre_commit_terraform/_cli.py (1)
invoke_cli_app(16-53)src/pre_commit_terraform/_types.py (2)
invoke_cli_app(26-28)populate_argument_parser(20-24)src/pre_commit_terraform/terraform_docs_replace.py (2)
invoke_cli_app(49-83)populate_argument_parser(14-46)src/pre_commit_terraform/_errors.py (2)
PreCommitTerraformBaseError(4-5)PreCommitTerraformExit(15-16)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: 🧪 Tests / pytest@🐍3.9@windows-2025
- GitHub Check: 🧪 Tests / pytest@🐍3.9@macos-14
- GitHub Check: 🧪 Tests / pytest@🐍3.13@windows-2025
- GitHub Check: 🧪 Tests / pytest@🐍3.13@macos-14
- GitHub Check: 🧪 Tests / pytest@🐍3.13@macos-13
- GitHub Check: 🧪 Tests / pytest@🐍3.12@macos-14
- GitHub Check: 🧪 Tests / pytest@🐍3.11@windows-2025
- GitHub Check: 🧪 Tests / pytest@🐍3.10@windows-2025
- GitHub Check: pre-commit
🔇 Additional comments (24)
src/pre_commit_terraform/__main__.py (1)
3-4: LGTM: Import statements have been split for better readability.Separating imports into individual lines follows Python best practices and makes version control diffs cleaner.
src/pre_commit_terraform/_errors.py (1)
8-11: LGTM: Improved formatting of multi-line class inheritance.The indentation style for multiple base classes is now more consistent and follows modern Python formatting practices.
src/pre_commit_terraform/_cli.py (1)
24-27: LGTM: Applied type cast fix with string literal.The change from using the actual type to using a string literal follows the recommendation in the FIXME comment. This is a common approach for handling forward references and addressing circular import issues in type annotations.
src/pre_commit_terraform/_cli_parsing.py (1)
25-27: LGTM: Function call reformatted for better readability.Breaking the function call into multiple lines with proper indentation and trailing commas improves code readability and makes future modifications easier.
src/pre_commit_terraform/_types.py (1)
20-22: Improved code readability with better method signature formatting.The parameter formatting change enhances readability by placing each parameter on its own line, which is consistent with PEP 8 style guidelines for function signatures with multiple parameters.
tests/pytest/_cli_test.py (6)
5-11: Import organization improved and uncommented needed exception.The import statements have been properly organized, and
PreCommitTerraformExitis now correctly imported instead of being commented out, which is necessary since it's used in thetest_app_exitfunction.
44-49: Improved parameter formatting in test function.The parameter formatting enhances readability by placing each parameter on its own line, following PEP 8 style guidelines for function signatures with multiple parameters.
55-58: Consistent method signature formatting.The parameter formatting in the test stub matches the formatting in the actual implementation, maintaining consistency throughout the codebase.
70-70: Assertion reordered to follow conventional pattern.Changed from
assert ReturnCode.ERROR == invoke_cli_app(['sentinel'])toassert invoke_cli_app(['sentinel']) == ReturnCode.ERROR, which follows the more common pattern of "actual == expected" in assertions.
76-79: Improved parameter formatting in test function.Similar to the other test function, this formatting change enhances readability by placing each parameter on its own line.
85-88: Consistent method signature formatting.The parameter formatting in the second test stub also matches the formatting in the actual implementation, maintaining consistency.
src/pre_commit_terraform/terraform_docs_replace.py (7)
20-24: Improved parameter formatting in add_argument call.The parameter formatting enhances readability by placing each parameter on its own line, following consistent style guidelines.
25-30: Improved parameter formatting for deprecated argument.The formatting has been improved while preserving the deprecated status of this argument.
31-35: Improved parameter formatting for argument definition.The parameter formatting enhances readability by placing each parameter on its own line, following consistent style guidelines.
59-63: Enhanced type casting and condition readability.The reformatted code explicitly casts
parsed_cli_args.filenamestolist[str]and places conditions on separate lines, improving readability.
71-71: Consistent type casting format.Changed to use string literal in
cast_to('bool', parsed_cli_args.sort)instead of a type hint for consistency.
74-78: Modernized string formatting with f-strings.Replaced string concatenation with more readable f-strings, which is a recommended practice in modern Python.
79-79: Simplified command construction with string join.Using
' '.join(procArgs)is cleaner than manual string concatenation for building the command string.tests/pytest/terraform_docs_replace_test.py (6)
8-16: Improved import organization and explicit module reference.The imports have been reorganized for clarity, and the
subprocessmodule fromterraform_docs_replaceis now explicitly imported asreplace_docs_subprocess_mod, which improves the readability of mocking calls later in the test.
29-30: Simplified regex pattern concatenation.The multiline regex pattern has been consolidated into a single line with concatenation, which maintains the same functionality while being more compact.
87-87: Assertion reordered to follow conventional pattern.Changed from
assert ReturnCode.OK == invoke_cli_app(parsed_cli_args)toassert invoke_cli_app(parsed_cli_args) == ReturnCode.OK, which follows the more common pattern of "actual == expected" in assertions.
90-91: Improved list comprehension readability.The list comprehension for extracting command arguments has been reformatted for better readability.
101-104: Improved parameter formatting in test function.The parameter formatting enhances readability by placing each parameter on its own line, following consistent style guidelines across the codebase.
122-122: Assertion reordered to follow conventional pattern.Similar to the other assertion change, this follows the more common "actual == expected" pattern in assertions.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #861 +/- ##
==========================================
+ Coverage 98.42% 98.44% +0.01%
==========================================
Files 28 28
Lines 571 578 +7
Branches 17 17
==========================================
+ Hits 562 569 +7
Misses 9 9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
webknjaz
left a comment
There was a problem hiding this comment.
You can merge this, IF this only includes output of ruff format and nothing else.
4f544c6 to
d5d1a66
Compare
webknjaz
left a comment
There was a problem hiding this comment.
autofixes
LGTM, but drop this "fixes" thing. It doesn't contain fixes, only formatting.
|
@MaxymVlasov now, make a PR introducing this file https://github.com/ansible/awx-plugins/blob/55596a6/.git-blame-ignore-revs but replace the last line with a reference to 23928fb. |
|
This PR is included in version 1.98.1 🎉 |
Subset of #831
Result of run
with same
ruff.tomlas in #831, except 2 last lines which enable ignore of deprecated hooks (https://github.com/antonbabenko/pre-commit-terraform/blob/948a36d52d36270c329028bd27f7a3e999c899ff/ruff.toml)