Skip to content

chore: add ruff linter and code formatter #166

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

Merged
merged 1 commit into from
Feb 3, 2025
Merged

chore: add ruff linter and code formatter #166

merged 1 commit into from
Feb 3, 2025

Conversation

evansims
Copy link
Member

Description

This pull request does not include any functionality changes. It introduces a faster and more streamlined linter and code formatted tool and applies some suggested code formatting rules.

Changes include:

  • Updates the linter and code formatting tools used.

    • Adds the ruff linter and code formatted tool.
    • Removes the (now redundant) pyupgrade, isort, autoflake and black tools.
    • Replaces the previous setup.cfg file with a modern pyproject.toml equivalent.
  • Applies improvements suggested by the tool:

    • Whitespace improvements.
    • Removal of unused imports.
    • Adds __all__ definitions to the __init__.py files as a best practice for exposing the SDK's public API to developer IDEs.
  • Fixes a few minor issues in the examples and unit tests I identified while working on updating things:

    • Fixes the examples' setup.py files using incorrect header comment blocks.
    • Fixes minor issues identified in the example apps, like unused variable assignments.
    • Fixes a duplicately named unit test in api_test, which may have caused test_500_error_retry not to be run as intended.
  • Ensures the partial_header block is imported in all Python source files.

References

Please review DXAZT-368 for additional context.

Generated from: openfga/sdk-generator#478

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@evansims evansims added the styling Issues related to code styling/best practices label Jan 28, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.58%. Comparing base (28945cb) to head (2ec56b1).

Files with missing lines Patch % Lines
openfga_sdk/exceptions.py 0.00% 1 Missing ⚠️

❌ Your project status has failed because the head coverage (69.58%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #166      +/-   ##
==========================================
+ Coverage   69.56%   69.58%   +0.01%     
==========================================
  Files         135      135              
  Lines       10857    10864       +7     
==========================================
+ Hits         7553     7560       +7     
  Misses       3304     3304              

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

@evansims evansims marked this pull request as ready for review January 28, 2025 01:52
@evansims evansims requested a review from a team as a code owner January 28, 2025 01:52
@evansims evansims added this pull request to the merge queue Feb 3, 2025
Merged via the queue into main with commit c1339ea Feb 3, 2025
17 checks passed
@evansims evansims deleted the chore/add-ruff branch February 3, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
styling Issues related to code styling/best practices
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants