Skip to content

Dependabot, pre commit, and ruff configuration #73

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 4 commits into from
Jan 16, 2025

Conversation

VeckoTheGecko
Copy link

This PR adds dependabot, pre-commit and ruff configuration to the codebase. These files (ie, .github/dependabot.yml, .pre-commit-config.yaml and pyproject.toml) are the only places where manual changes have been made, all other changes in this PR are as a result of the included tools.

Let me knwo @mvdh7 if there are any tools/linting rules that you are unsure of

@VeckoTheGecko VeckoTheGecko force-pushed the dependabot-pre-commit branch from 4bee271 to fcd139f Compare January 8, 2025 17:31
Comment on lines +17 to +20
- repo: https://github.com/rbubley/mirrors-prettier # Update mirror as official mirror is deprecated
rev: v3.4.2
hooks:
- id: prettier
Copy link
Author

Choose a reason for hiding this comment

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

For formatting a bunch of files (markdown, css, yaml, etc). See list of supported files

Comment on lines +80 to +92
# TODO: These should be fixed
"B006", # Do not use mutable data structures for argument defaults
"B007", # Loop control variable `funcs` not used within loop body
"B011", # Do not `assert False`
"B028", # No explicit `stacklevel` keyword argument found
"B904", # Within an `except` clause, raise exceptions
"RUF001", # String contains ambiguous ...
"E402", # Module level import not at top of file
"E711", # Comparison to `None` should be `cond is None`
"E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks
"F401", # ... imported but unused; consider removing, adding to `__all__`, or using a redundant alias
"ICN", # import conventions
Copy link
Author

@VeckoTheGecko VeckoTheGecko Jan 8, 2025

Choose a reason for hiding this comment

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

In my opinion, these would be ones to consider fixing (not in this PR, but can be done gradually by removing from ignore and then running pre-commit). More info can be found by googling "{code} ruff". If you feel some of these aren't worth fixing, they can be moved out of the "todo" block

Btw, one can ignore a rule for a line if you want to intentionally do something. see error suppression | Ruff docs

Comment on lines +38 to +51
select = [
"D", # pydocstyle
"E", # Error
"F", # pyflakes
"I", # isort
"B", # Bugbear
"UP", # pyupgrade
"LOG", # logging
"ICN", # import conventions
"G", # logging-format
"RUF", # ruff
"ISC001", # single-line-implicit-string-concatenation
]
Copy link
Author

Choose a reason for hiding this comment

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

Core rule sets that are selected. More info in Ruff docs

@VeckoTheGecko
Copy link
Author

Regarding the other projects, perhaps you can copy these config files across to them as needed @mvdh7 ? I think that might be a better way, and allow you to select rules etc as you see fit (rather than me opening many similar PRs)

@VeckoTheGecko
Copy link
Author

Re. the PR, I have updated it so it just has the config files. So, when you want to incorporate it, all you have to do is:

  • Bring the PR up to date
  • Run pre-commit run --all-files to apply all the format changes
  • Make a commit (“Run pre-commit”)
  • Merge the PR

@mvdh7 mvdh7 merged commit 12836c3 into mvdh7:jax Jan 16, 2025
@VeckoTheGecko VeckoTheGecko deleted the dependabot-pre-commit branch January 16, 2025 17:13
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.

2 participants