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

Added a pre-commit configuration to enable automatic linting with ruff #1105

Merged
merged 5 commits into from
Aug 20, 2024

Conversation

swryan
Copy link
Contributor

@swryan swryan commented Aug 20, 2024

Summary

Added a pre-commit configuration to enable automatic linting with ruff.

  • pre-commit has been added as a [test] dependency.
  • a pre-commit configuration file has been added to run the ruff linter
  • developers can enable automatic ruff linting when making a commit by issuing the pre-commit install command in their development environment
    • after doing the install step, pre-commit will automatically run a ruff check on git commit
    • the pre-commit hook can also be run manually on changed files via pre-commit run
    • the pre-commit hook can also be run manually on all files via pre-commit run --all
    • see documentation at https://pre-commit.com/
  • the ruff version is necessarily fixed and should be updated periodically via pre-commit autoupdate
    • a ruff check has been added to the GitHub tests workflow that will install and run the latest version of ruff
    • if an issue is flagged on GitHub that was not flagged on commit, then the autoupdate command should be used

Also:

  • a ruff check has been performed and changes made to allow the check to pass:
    • #noqa flags added when deemed appropriate
    • f flags removed from strings that didn't need to be f-strings
    • removed some unused imports and variables
    • removed extraneous semi-colons in notebooks
    • some docs imported a class that overrode what was defined on the page, the import was removed (ensuring the displayed definition is used)
    • added a missing import
    • changed some lambdas that were assigned to a variable to be defined functions
    • added Exception to some naked excepts
    • renamed some test functions that were obscuring other test functions
    • changed some ambiguous variable names (e.g. 'l' to 'el')
    • removed duplicate test
    • commented some unused assignments that might have documentation value (rather than deleting them)
    • added missing assert_partials to test

Related Issues

  • Resolves #

Backwards incompatibilities

None

New Dependencies

None

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@coveralls
Copy link

Coverage Status

coverage: 93.852% (-0.1%) from 93.981%
when pulling 66d2827 on swryan:ruff
into e90f587 on OpenMDAO:master.

@robfalck robfalck merged commit 5d5255f into OpenMDAO:master Aug 20, 2024
10 checks passed
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