-
Notifications
You must be signed in to change notification settings - Fork 20
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
Introducing pre-commit and markdownlint-cli2 #701
base: master
Are you sure you want to change the base?
Conversation
Closes #700 Adds [pre-commit](https://pre-commit.com) to the repository (and configures but doesn't yet enable [pre-commit.ci](https://pre-commit.ci)). Some basic `pre-commit` hooks are included but the meat of the linting is done via [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) which is configured via `.markdownlint-cli2.yaml`. Retrospective linting of the `.md` and `.sh` files included in this PR has been undertaken (mostly line-length issues, but a typo has been corrected in `_posts/2022-12-22-git-blame.md` too). `README.md` has a new section on setting up and using `pre-commit` for this work and includes details of why retrospective linting has not been applied more widely (basically I didn't want to break any pages) and how to ignore revisions should anyone wish to undertake this task. `markdownlint-cli2` does have an option to `fix: true` which will where possible fix things automatically, but I had a go at doing this and it wasn't applying things very well (e.g. line lengths weren't being sorted). I have written a short script ([`wrap`](https://gitlab.com/nshephard/dotfiles/-/blob/master/bin/wrap)) that uses `fmt` to sensibly wrap lines for all files of a particular type at a specified length (and in parallel too) if anyone wanted to have a go at sorting things out. One thing to discuss would be whether we enable [pre-commit.ci](https://pre-commit.ci/). I didn't want to foist this upon people without consensus being reached.
This table is written in html with custom CSS because the website's theme does not show table borders. Should be corrected tbh.
|
One of the external images linked by Hacktoberfest 2018 was 404, so replace with image from the bottom of the page and removed the bottom image. Resolved missing alt-text in assets dir, but this directory should probably be ignored.
These are 3rd party.
Most cases where console output, so marked as text, others I attempted to specify the most suitable language.
Could it not be re-written as
...which makes more sense to me since its...
...and doesn't require another level of heading. |
Shall we merge this and use the linting going forward and leave the older posts as is? |
🤷♂️ |
It doesn't require that old code be linted unless a file is touched/modified and included in a commit since It would of course require contributors to have pre-commit installed locally though (no need to install the |
Any love for this? Should I spend time resolving the conflicts that have arisen? I guess the main question is whether people would use the hooks locally (which provide a much quicker feedback loop). |
Closes #852 More than just those changes though as I still have [pre-commit](https://pre-commit.com) configured and so linted the page with [Markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) (see #701).
Closes #700
Adds pre-commit to the repository (and configures but doesn't yet enable pre-commit.ci). Some basic
pre-commit
hooks are included but the meat of the linting is done via markdownlint-cli2 which is configured via.markdownlint-cli2.yaml
.Retrospective linting of the
.md
and.sh
files included in this PR has been undertaken (mostly line-length issues, but a typo has been corrected in_posts/2022-12-22-git-blame.md
too).README.md
has a new section on setting up and usingpre-commit
for this work and includes details of why retrospective linting has not been applied more widely (basically I didn't want to break any pages) and how to ignore revisions should anyone wish to undertake this task.markdownlint-cli2
does have an option tofix: true
which will where possible fix things automatically. I had a go at doing this and fixing all existing code withpre-commit run --all-files
but found it wasn't applying things very well (e.g. line lengths weren't being corrected[1]) and I was very wary of messing up the site.One thing to discuss would be whether we enable pre-commit.ci. I didn't want to foist this upon people without consensus being reached.
[1] This led me to writing a short script (
wrap
) that usesfmt
to sensibly wrap lines for all files of a particular type at a specified length (and in parallel too) if anyone wanted to have a go at sorting things out.