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

Use pre-commit for clang-format #175

Merged
merged 3 commits into from
Sep 8, 2023
Merged

Conversation

fmauch
Copy link
Collaborator

@fmauch fmauch commented Sep 4, 2023

It has bothered be for quite a while that we have so many "code formatting" commit inside our PRs. Using pre-commit enables us to check formatting before we actually push something.

@codecov
Copy link

codecov bot commented Sep 4, 2023

Codecov Report

Patch has no changes to coverable lines.

📢 Thoughts on this report? Let us know!.

@fmauch fmauch marked this pull request as ready for review September 4, 2023 10:19
@fmauch fmauch requested review from urmahp and urrsk September 4, 2023 10:19
Copy link
Collaborator

@urmahp urmahp left a comment

Choose a reason for hiding this comment

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

LGTM, but before merging I think we should add some documentation on how to use the pre-commit when you are developing, similar to what we have in the ROS2 Driver

@urmahp urmahp mentioned this pull request Sep 6, 2023
@fmauch
Copy link
Collaborator Author

fmauch commented Sep 6, 2023

@urmahp I've updated things a bit together with a contributor guideline.

@fmauch fmauch requested a review from urmahp September 6, 2023 11:24
Copy link
Collaborator

@urmahp urmahp left a comment

Choose a reason for hiding this comment

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

LGTM. Just added small suggestion regarding installing clang-format-14

* This repo supports [pre-commit](https://pre-commit.com/) e.g. for automatic code formatting. TLDR:
This will prevent you from committing falsely formatted code:
```
pipx install pre-commit
Copy link
Collaborator

@urmahp urmahp Sep 7, 2023

Choose a reason for hiding this comment

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

I think we should state which clang format to install as well.

```suggestion
  pipx install pre-commit 
  sudo apt install clang-format-14

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The clang-format version is specified in the pre-commit job. That's the main reason I switched to pre-commit: clang-format is installed in a python virtualenv with the respective version, so developers (and CI maintainers) don't have to manually install a specific version.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wasn't aware of that, nice solution :)

@fmauch fmauch merged commit 479a197 into UniversalRobots:master Sep 8, 2023
19 checks passed
@fmauch fmauch deleted the pre-commit branch September 8, 2023 18:57
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.

None yet

2 participants