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

chore(RHINENG-14059): Add Ruff ARG rule (WIP) #2181

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

kruai
Copy link
Collaborator

@kruai kruai commented Jan 14, 2025

Overview

This PR is being created to address RHINENG-14059.
Adds the ARG rule to Ruff, and fixes the code that breaks the rule.

NOTE: This PR is a collaborative work-in-progress. In order to contribute, you must do the following:

  1. In pyproject.toml, uncomment lines 21 and 38 ("ARG" and "ignore-variadic-names")
  2. Run make style
  3. Correct any errors raised by the linter
  4. Re-comment the lines from step 1
  5. Commit

When we are ready to merge the PR, we will need to uncomment the lines from step 1.

PR Checklist

  • Keep PR title short, ideally under 72 characters
  • Descriptive comments provided in complex code blocks
  • Include raw query examples in the PR description, if adding/modifying SQL query
  • Tests: validate optimal/expected output
  • Tests: validate exceptions and failure scenarios
  • Tests: edge cases
  • Recovers or fails gracefully during potential resource outages (e.g. DB, Kafka)
  • Uses type hinting, if convenient
  • Documentation, if this PR changes the way other services interact with host inventory
  • Links to related PRs

Secure Coding Practices Documentation Reference

You can find documentation on this checklist here.

Secure Coding Checklist

  • Input Validation
  • Output Encoding
  • Authentication and Password Management
  • Session Management
  • Access Control
  • Cryptographic Practices
  • Error Handling and Logging
  • Data Protection
  • Communication Security
  • System Configuration
  • Database Security
  • File Management
  • Memory Management
  • General Coding Practices

@kruai kruai requested a review from a team as a code owner January 14, 2025 14:05
@kruai kruai marked this pull request as draft January 14, 2025 14:11
@@ -103,7 +103,7 @@ def test_create_assignemnt_rule_same_group(api_create_assign_rule, db_create_gro
assert group in response_data["detail"]


def test_create_assignment_rule_RBAC_denied(subtests, mocker, api_create_assign_rule, db_create_group, enable_rbac):
def test_create_assignment_rule_RBAC_denied(subtests, mocker, api_create_assign_rule, db_create_group, _enable_rbac):
Copy link
Contributor

Choose a reason for hiding this comment

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

If a test needs to use a fixture, but it doesn't use its return value, you can decorate the test with @pytest.mark.usefixtures("fixture_name") and then you don't have to include this fixture in the test arguments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fantastic, thanks a ton for the info! I'll switch to using that, as it's simpler

@kruai
Copy link
Collaborator Author

kruai commented Jan 14, 2025

There were initially 295 lint errors; now we're down to 141 (not including the fixes that #2183 will bring)

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.

3 participants