Skip to content
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

chore: lock in nph version and add pre-commit hook #2938

Merged
merged 3 commits into from
Aug 20, 2024
Merged

Conversation

fryorcraken
Copy link
Collaborator

@fryorcraken fryorcraken commented Jul 26, 2024

Description

  • Lock in nph version to v0.5.1 by bringing it as a submodule
  • Add convenient make tasks to build and run nph
  • Add convenient make task to install hook that will format nim files at commit time.

@fryorcraken fryorcraken requested a review from a team July 26, 2024 11:18
Copy link

github-actions bot commented Jul 26, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2938

Built from b1b7420

Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

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

Awesome!
I think we need to eforce explicit nph version.
current one we use is v0.5.1-0-gde5cd48

@fryorcraken
Copy link
Collaborator Author

Awesome! I think we need to eforce explicit nph version. current one we use is v0.5.1-0-gde5cd48

ok, I should be able to do that. Will update.

Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

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

That's awesome! Thanks so much for it!
I just added some comments that I hope you find useful

Makefile Outdated
Comment on lines 264 to 265
check_nph_installed:
ifeq (, $(shell which nph 2> /dev/null))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is nice indeed! Nevertheless, I think it is better to have this check implicit when the developer performs any make command. I mean, this is a pre-condition that should always be met and I think it will be more secure to enforce that in a generic manner.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would disagree with that. If I am a user that just want to build wakunode2 because I want latest master or testing a branch, the presence of nph should not block me to proceed.

README.md Outdated
Comment on lines 90 to 104
You can install a convenient pre-commit git hook with the following command:

```
make install_nph_prehook
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

Considering that the hook will always be triggered, we don't need the developer to explicitly do make install_nph_prehook. In case my other comment makes sense of course :)

Suggested change
You can install a convenient pre-commit git hook with the following command:
```
make install_nph_prehook
```

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think we should install pre-hooks nilly-willy, especially if a dev has already their own prehooks in place. Which is why I set it up as separate step.

@fryorcraken

This comment was marked as resolved.

@fryorcraken fryorcraken changed the title chore: enable installing git pre-commit hook to format files chore: lock in nph version and add pre-commit hook Aug 15, 2024
Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for it! 💯
I just added a nitpick comment that hope you find useful :)


Nim files are expected to be formatted using the [`nph`](https://github.com/arnetheduck/nph) version present in `vendor/nph`.

You can easily format file with the `make nph/<relative path to nim> file` command.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shall we have an example of how to format a particular file? That would help to understand the command :)

( maybe it sounds more natural having make nph <relative-path-to-nim-file> )

@gabrielmer gabrielmer self-requested a review August 19, 2024 08:00
Copy link
Contributor

@gabrielmer gabrielmer left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@fryorcraken fryorcraken force-pushed the nph-githook branch 4 times, most recently from 4fe7f48 to 73170f1 Compare August 20, 2024 03:12
@fryorcraken fryorcraken merged commit d63e343 into master Aug 20, 2024
9 of 11 checks passed
@fryorcraken fryorcraken deleted the nph-githook branch August 20, 2024 05:14
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.

4 participants