-
Notifications
You must be signed in to change notification settings - Fork 26
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
style: nph formatting #1067
base: master
Are you sure you want to change the base?
style: nph formatting #1067
Conversation
db6bd63
to
ab566e7
Compare
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.
It seems to have a precommit hook and a workflow checking step. Even if the style itself isn't perfect, I think this is still a very good thing to have.
Yes we know you just want to have your name amongst the contributors with the most lines added/deleted, @AuHau ... |
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.
On a more serious note: I'm happy to have nph, but I think we need to make sure versions match locally and in CI.
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.
LGTM
see https://github.com/arnetheduck/nph/blob/master/format-git-repo.sh#L12 for how to not become the target of future |
That is a super cool tip! Thanks will employ it ;-) |
e0eceb4
to
1bf6dd1
Compare
something to be mindful of: when you merge this with the usual non-fast-forward squash merge, the commit hashes will change invalidating git-blame-ignore-revs - better merge manually or create ignore-revs separately |
If you are setting up fresh setup, in order to get `nph` run `make build-nph`. | ||
In order to format files run `make nph/<file/folder you want to format>`. | ||
If you want you can install Git pre-commit hook using `make install-nph-commit`, which will format modified files prior commiting them. | ||
If you are using VSCode and the NimLang extension you can enable "Format On Save" that will format the files using `nph`. |
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.
Is this "Format On Save" or is it nim.lintOnSave
? There is also editor.formatOnSave
option, and perhaps it also has to be set to true
, but formatOnSave
is just a generic VSCode option if I remember correctly.
Also, you could consider adding a link to the NimLang to remove any doubts about the extension.
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.
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.
Ok, I did some tests. So it looks like nim.lintOnSave
is actually depreciated and nim.formatOnSave
does exist on NimLang extension. Setting either editor.formatOnSave
or nim.formatOnSave
does the job (one of them need to be set to true
, the order does not seem to matter).
This PR implements code formatting using
nph
of folderscodex/
andtests/
.It is enforced on CI level using https://github.com/arnetheduck/nph-action. Nice thing it can suggest formatting changes in case somebody forgets to format its PR before submitting it.
More details on how to use it can be found in README: https://github.com/codex-storage/nim-codex/pull/1067/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R60
This work is based on
nwaku
implementation ofnph
- so kudos to them!