Skip to content

Conversation

@QuantamHD
Copy link
Collaborator

This commit will add clang tidy comments to PRs.
See https://github.com/marketplace/actions/clang-tidy-review for more examples.

Once adopted we should move the action into the OpenROAD Project.

@QuantamHD QuantamHD force-pushed the clang-tidy branch 2 times, most recently from 5850890 to 5e65cbb Compare February 27, 2023 08:14
@QuantamHD
Copy link
Collaborator Author

QuantamHD commented Feb 27, 2023

@maliberty This won't post any comments until it's merged in due to permission issues related to forks which is why it's currently failing.

@QuantamHD QuantamHD requested a review from maliberty February 27, 2023 08:25
This commit will add clang tidy comments to PRs.
See https://github.com/marketplace/actions/clang-tidy-review
for more examples.

Once adopted we should move the action into the OpenROAD
Project.

Signed-off-by: Ethan Mahintorabi <[email protected]>
@QuantamHD
Copy link
Collaborator Author

QuantamHD commented Feb 27, 2023

Importantly this clang-tidy only makes comments on modified lines not on the files in general.

The action doesn't fail if there are errors it just leaves comments in the PR on how to improve the code.

@QuantamHD
Copy link
Collaborator Author

Example of the output once merged on Openroad.

@cdleary

QuantamHD#2

@maliberty
Copy link
Member

Most of our code does not comply with the google naming style. This is going to produce tons of warnings on every change. I wouldn't want people to mix-and-match coding styles. We would have to convert modules and then enable it for that module. I don't think we want to just turn this on as is without it being part of a larger plan. Its a substantial effort and disruptive as well.

@QuantamHD
Copy link
Collaborator Author

How about this we split the check into two actions one for all the static analyzers that gets run over the whole project, and one that runs style checking over all modules except sub folders we opt out of?

However, this is one of those workflow things that's important to us so we need to make a plan to enable style over the whole project.

@maliberty
Copy link
Member

I agree it is good to have. Splitting it is fine but I don't see any static analyzers being run here. Is that something you plan to add? I assume that would be more of a nightly thing and not per PR.

I don't think we will ever convert abc or sta but the rest of the project is possible (rsz & dbSta are debatable). However the exclude list right now would be nearly everything.

Does Google have resources to put behind making this conversion happen?

@QuantamHD
Copy link
Collaborator Author

QuantamHD commented Feb 27, 2023

The following analyzers are running -*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*

This is definitely a PR thing. Eventually we want to make it a blocking thing. We can opt out abc and sta. Given that they're submodules they won't show up in this check though. It relies on file diffs which don't show up for submodules.

We can talk more details, but yes we should be able to allocate resources to this.

See uninit'd variable
QuantamHD#2 (comment)

@maliberty
Copy link
Member

This PR, in this form, can't be approved now. We should work out a plan for this.

@vvbandeira FYI

@QuantamHD
Copy link
Collaborator Author

@maliberty This should be good to go given what we discussed. I plan on adding the identifier naming one in a different PR.

@maliberty
Copy link
Member

Is it expected that this is failing on this PR
image
?

@vvbandeira any comments? We should put this in OpenROAD/actions rather than QuantamHD/clang-tidy-review

@QuantamHD
Copy link
Collaborator Author

QuantamHD commented Feb 28, 2023

Yes. It's failing because it's running as a forked workflow which doesn't have permission at the moment. It'll work once merged. I checked in my fork, and it's correctly passing.

Signed-off-by: Ethan Mahintorabi <[email protected]>
@QuantamHD
Copy link
Collaborator Author

@vvbandeira any comments? We should put this in OpenROAD/actions rather than QuantamHD/clang-tidy-review

This is the repo in question. I assumed we just keep the repo together for simplicity rather than trying to merge it into a larger one.

https://github.com/QuantamHD/clang-tidy-review

…ady set in the top level CMake

Signed-off-by: Ethan Mahintorabi <[email protected]>
@vvbandeira
Copy link
Member

I have forked the original repo at https://github.com/The-OpenROAD-Project/clang-tidy-review
@QuantamHD can you update the action target to be our fork? This should be enough to fix the permission problem, right?

Copy link
Contributor

@hzeller hzeller left a comment

Choose a reason for hiding this comment

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

Some clang-tidy warnings are a bit overzealous and might trigger on actually desirable code constructs or are sometimes confused.

I am using a fairly aggressive rules in Verible, but have filtered out some that felt not right. Might be a good starting point.

https://github.com/chipsalliance/verible/blob/master/.clang-tidy

@QuantamHD
Copy link
Collaborator Author

@maliberty This should be ready to go.

@maliberty
Copy link
Member

lgtm @vvbandeira any final concerns? If not go ahead and merge

@QuantamHD
Copy link
Collaborator Author

@maliberty can you merge now that @vvbandeira has approved

@vvbandeira vvbandeira merged commit 7bf99f0 into The-OpenROAD-Project:master Mar 7, 2023
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