-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add pre-commit configuration (with codespell etc) to ensure no typos and more consistent formatting etc #11
Conversation
ah, me is yet to learn that |
- repo: https://github.com/PyCQA/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort |
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 cannot tell whether this is redundant or in conflict with the ruff
setup.
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.
as in original post TODOs - I think "yes" , we want to remove it after adding ruff formatting to pre-commit
- id: check-symlinks | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace |
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 am not sure what these check. But it would be essential for me to be able to run these checks locally, and not have to wait for the CI to tell me what is needed, and then have to rework a changeset again.
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.
this config is for local operation really. https://pre-commit.com/
in a nut-shell
pip install pre-commit
pre-commit install # installs pre-commit git hook
and you are set -- it would invoke checks etc before commit.
Then if you want to run explicitly across entire codebase
pre-commit run --all
I do not think I ever user any other command there ;)
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.0.0 | ||
hooks: | ||
- id: codespell |
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 have need instructions for running this locally somewhere.... Need to go searching.
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.
codespell
config would be added to pyproject.toml
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.
IIRC could also be via pre-commit run --all codespell
so it takes into account possible pre-commit
specific configs (excludes) and operate only on files under git control (I think)
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.
added config, made it fix one typo it found , rewrote commit messages for prior commits. Let's see what cz thinks about datalad run
;)
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.
oh, you added config already, will rebase/adjust
An alternative for CI integration has be proposed (see refs). This adds the necessary setup to configure and run this locally. Two commands are provided (both discoverable via `hatch env show`: - `codespell:check` (what would be executed by a CI) - `codespell:fix` (to apply suggested fixes to the sources) Refs: #11
An alternative for CI integration has be proposed (see refs). This adds the necessary setup to configure and run this locally. Two commands are provided (both discoverable via `hatch env show`: - `codespell:check` (what would be executed by a CI) - `codespell:fix` (to apply suggested fixes to the sources) Refs: #11
This is not a commitizen format. This tool is just used to enforce https://www.conventionalcommits.org |
f1893b1
to
14e4485
Compare
…ically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^
14e4485
to
1ef4677
Compare
skip = ".git,build,.*cache,dist" | ||
check-hidden = true | ||
# ignore-regex = '' | ||
# ignore-words-list = '' |
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.
these two are most commonly used so I prefer to keep them present/ready.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 6 6
=========================================
Hits 6 6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I am closing this PR due to inactivity. Feel free to reopen once this work is completed. |
Relates to development procedures (hence #10)
TODOs if we agree to proceed
hatch fmt
or direct invocation to ruff? see Provide a pre-commit hook forhatch fmt
pypa/hatch#1223may be
black
? (yet to compare tohatch fmt
)