Skip to content

chore(liners): Suppress ruff rules which shouldn't be fixed#869

Merged
MaxymVlasov merged 1 commit intomasterfrom
ruff_noqa
Apr 3, 2025
Merged

chore(liners): Suppress ruff rules which shouldn't be fixed#869
MaxymVlasov merged 1 commit intomasterfrom
ruff_noqa

Conversation

@MaxymVlasov
Copy link
Copy Markdown
Collaborator

Subset of #831

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Chores

    • Refined inline documentation and internal comments to clarify future improvements and usage recommendations.
    • Adjusted naming conventions in error handling for greater consistency with standard behavior.
  • Tests

    • Enhanced test commentary to underscore security considerations and deprecated practices.

All changes preserve current functionality while improving code clarity and maintainability.

Walkthrough

The pull request introduces modifications to inline comments and lint suppression directives across several modules in the pre_commit_terraform project. In the CLI module, comment adjustments and # noqa tags were added to suppress lint warnings in exception handling. The exit class in the errors module was renamed to better align with the semantics of SystemExit and now includes a # noqa: N818 directive. Additional clarifications were added in the terraform_docs_replace module and its corresponding tests to explain the retention of deprecated approaches and insecure practices. No functional or control flow changes were made.

Changes

File(s) Change Summary
src/pre_commit_terraform/_cli.py Updated inline comments in invoke_cli_app and added # noqa: T201 directives on print statements within exception handling to suppress lint warnings.
src/pre_commit_terraform/_errors.py Renamed the exit class to remove the "Error" suffix and added # noqa: N818 to align naming with SystemExit; behavioral logic remains unchanged.
src/pre_commit_terraform/terraform_docs_replace.py
tests/pytest/terraform_docs_replace_test.py
Added comments detailing the rationale for retaining deprecated practices (e.g., use of shell=True) and insecure calls, ensuring that functionality remains intact.

Suggested reviewers

  • antonbabenko
  • webknjaz
  • yermulnik

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 8d38688 and b6149d6.

📒 Files selected for processing (4)
  • src/pre_commit_terraform/_cli.py (1 hunks)
  • src/pre_commit_terraform/_errors.py (1 hunks)
  • src/pre_commit_terraform/terraform_docs_replace.py (2 hunks)
  • tests/pytest/terraform_docs_replace_test.py (1 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@MaxymVlasov MaxymVlasov changed the title chore(liners): Suppress ruff rulles which shoudn't be fixed chore(liners): Suppress ruff rules which shouldn't be fixed Apr 3, 2025
return invoke_cli_app(parsed_cli_args)
except PreCommitTerraformExit as exit_err:
print(f'App exiting: {exit_err !s}', file=sys.stderr)
# T201 - FIXME here and below - we will replace 'print' with logging later
Copy link
Copy Markdown
Collaborator Author

@MaxymVlasov MaxymVlasov Apr 3, 2025

Choose a reason for hiding this comment

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

We do not need issue for it, as logging already implemented in different branch, so it will be set right after we finally add all ruff-related changes

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.44%. Comparing base (8d38688) to head (b6149d6).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #869   +/-   ##
=======================================
  Coverage   98.44%   98.44%           
=======================================
  Files          28       28           
  Lines         578      578           
  Branches       17       17           
=======================================
  Hits          569      569           
  Misses          9        9           
Flag Coverage Δ
CI-GHA 98.44% <100.00%> (ø)
MyPy 91.43% <90.00%> (ø)
OS-Linux 94.71% <90.00%> (ø)
OS-Windows 100.00% <100.00%> (ø)
OS-macOS 100.00% <ø> (ø)
Py-3.10.11 100.00% <100.00%> (ø)
Py-3.10.16 100.00% <ø> (ø)
Py-3.11.11 100.00% <ø> (ø)
Py-3.11.9 100.00% <100.00%> (ø)
Py-3.12.9 100.00% <100.00%> (ø)
Py-3.13.2 98.44% <100.00%> (ø)
Py-3.9.13 100.00% <100.00%> (ø)
Py-3.9.21 100.00% <ø> (ø)
VM-macos-13 100.00% <ø> (ø)
VM-macos-14 100.00% <ø> (ø)
VM-ubuntu-24.04 100.00% <ø> (ø)
VM-ubuntu-latest 91.43% <90.00%> (ø)
VM-windows-2025 100.00% <100.00%> (ø)
pytest 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MaxymVlasov MaxymVlasov marked this pull request as ready for review April 3, 2025 21:31
@MaxymVlasov MaxymVlasov merged commit e41252b into master Apr 3, 2025
47 of 48 checks passed
@MaxymVlasov MaxymVlasov deleted the ruff_noqa branch April 3, 2025 21:43
@antonbabenko
Copy link
Copy Markdown
Owner

This PR is included in version 1.98.1 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants