chore(linters): Fix ruff linter issues manually#866
Conversation
…ither escaped nor raw
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe changes enhance the documentation in several CLI-related modules by updating and expanding function docstrings to clearly specify return types and function outputs. Additionally, variable names were refined for clarity, and minor formatting adjustments were applied. A commented-out test case was removed, and a regex string was updated to a raw string in one test file. No functional behavior is altered. Changes
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (4)
🪧 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 (4)
src/pre_commit_terraform/_cli.py(1 hunks)src/pre_commit_terraform/_cli_parsing.py(1 hunks)src/pre_commit_terraform/terraform_docs_replace.py(3 hunks)tests/pytest/_cli_test.py(1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
tests/pytest/_cli_test.py (1)
src/pre_commit_terraform/_errors.py (1)
PreCommitTerraformExit(15-16)
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: 🧪 Tests / pytest@🐍3.9@windows-2025
- GitHub Check: 🧪 Tests / pytest@🐍3.9@macos-13
- 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@windows-2025
- 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 (7)
src/pre_commit_terraform/_cli.py (1)
21-23: Good docstring enhancement!Adding the return type documentation improves the clarity and completeness of the function documentation, which aligns well with the PR's objective of fixing linter issues.
tests/pytest/_cli_test.py (1)
99-99: Good practice using raw string for regex pattern.Converting the regular expression to a raw string (
r'^sentinel$') is a best practice in Python, even when the pattern doesn't contain escape sequences. This change helps prevent potential issues with escape sequences in more complex patterns and improves code quality.src/pre_commit_terraform/terraform_docs_replace.py (5)
15-15: Good docstring addition.Adding a clear docstring for the function improves code documentation and readability.
51-55: Good docstring enhancement!Adding a complete docstring with return type information improves the clarity and completeness of the function documentation.
75-75: Good variable rename to avoid shadowing built-in function.Renaming the variable from
dirtodirectoryis a good practice as it avoids shadowing the built-in Pythondir()function, which could lead to confusion or subtle bugs.
77-81: Improved variable naming convention and code structure.Converting
procArgstoproc_argsfollows Python's snake_case naming convention (PEP 8). The restructured code for building the command arguments is also more readable and maintainable.
84-88: Consistent variable naming in string formatting.Updating the f-string and format string to use the renamed
directoryvariable maintains consistency throughout the function.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #866 +/- ##
=======================================
Coverage 98.44% 98.44%
=======================================
Files 28 28
Lines 578 578
Branches 17 17
=======================================
Hits 569 569
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. |
|
This PR is included in version 1.98.1 🎉 |
Description of your changes
Subset of #831
Run next and fix violations one by one
and commit as separate commits
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)