-
Notifications
You must be signed in to change notification settings - Fork 25
pre-commit: add black, isort, pyupgrade, autoflake, flake8, and misc hooks #104
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
738a247
pre-commit: add ruff hook
consideRatio 76204d8
pre-commit: replace ruff hook with jh-orgs typical
consideRatio 6ad0a31
Make executable jsonnet files function
consideRatio 01ce159
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# flake8 is used for linting Python code setup to automatically run with | ||
# pre-commit. | ||
# | ||
# ref: https://flake8.pycqa.org/en/latest/user/configuration.html | ||
# | ||
|
||
[flake8] | ||
# E: style errors | ||
# W: style warnings | ||
# C: complexity | ||
# D: docstring warnings (unused pydocstyle extension) | ||
ignore = E, C, W, D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,66 @@ | ||
# pre-commit is a tool to perform a predefined set of tasks manually and/or | ||
# automatically before git commits are made. | ||
# | ||
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level | ||
# | ||
# Common tasks | ||
# | ||
# - Run on all files: pre-commit run --all-files | ||
# - Register git hooks: pre-commit install --install-hooks | ||
# | ||
repos: | ||
- repo: https://github.com/google/go-jsonnet | ||
rev: v0.20.0 | ||
hooks: | ||
- id: jsonnet-format | ||
# jsonnet-lint hook doesn't work | ||
# - id: jsonnet-lint | ||
- repo: https://github.com/google/go-jsonnet | ||
rev: v0.20.0 | ||
hooks: | ||
- id: jsonnet-format | ||
# jsonnet-lint hook doesn't work | ||
# - id: jsonnet-lint | ||
|
||
# Autoformat: Python code, syntax patterns are modernized | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.15.2 | ||
hooks: | ||
- id: pyupgrade | ||
args: | ||
- --py38-plus | ||
|
||
# Autoformat: Python code | ||
- repo: https://github.com/PyCQA/autoflake | ||
rev: v2.3.1 | ||
hooks: | ||
- id: autoflake | ||
# args ref: https://github.com/PyCQA/autoflake#advanced-usage | ||
args: | ||
- --in-place | ||
|
||
# Autoformat: Python code | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
|
||
# Autoformat: Python code | ||
- repo: https://github.com/psf/black | ||
rev: 24.3.0 | ||
hooks: | ||
- id: black | ||
|
||
# Misc... | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
# ref: https://github.com/pre-commit/pre-commit-hooks#hooks-available | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: requirements-txt-fixer | ||
- id: check-case-conflict | ||
- id: check-executables-have-shebangs | ||
|
||
# Lint: Python code | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: "7.0.0" | ||
hooks: | ||
- id: flake8 | ||
|
||
# pre-commit.ci config reference: https://pre-commit.ci/#configuration | ||
ci: | ||
autoupdate_schedule: monthly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/usr/bin/env -S jsonnet -J ../vendor | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to ensure shebangs were added to executable files. I removed the executable flag for the libsonnet file that renders blank anyhow. |
||
// Deploys a dashboard showing information about support resources | ||
local grafana = import '../vendor/grafonnet/grafana.libsonnet'; | ||
local dashboard = grafana.dashboard; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
myst-parser[linkify] | ||
sphinx-book-theme | ||
sphinx-autobuild | ||
sphinx-book-theme |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Dashboards across all datasources | ||
|
||
Contains "global" dashboards with useful stats computed across all datasources. | ||
Contains "global" dashboards with useful stats computed across all datasources. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# autoflake is used for autoformatting Python code | ||
# | ||
# ref: https://github.com/PyCQA/autoflake#readme | ||
# | ||
[tool.autoflake] | ||
ignore-init-module-imports = true | ||
remove-all-unused-imports = true | ||
remove-duplicate-keys = true | ||
remove-unused-variables = true | ||
|
||
|
||
# black is used for autoformatting Python code | ||
# | ||
# ref: https://black.readthedocs.io/en/stable/ | ||
# | ||
[tool.black] | ||
skip-string-normalization = true | ||
# target-version should be all supported versions, see | ||
# https://github.com/psf/black/issues/751#issuecomment-473066811 | ||
target_version = [ | ||
"py38", | ||
"py39", | ||
"py310", | ||
"py311", | ||
] | ||
|
||
|
||
# isort is used for autoformatting Python code | ||
# | ||
# ref: https://pycqa.github.io/isort/ | ||
# | ||
[tool.isort] | ||
profile = "black" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to use
-S
to not have env parse the content above as a command with spaces in it.