argparse icon indicating copy to clipboard operation
argparse copied to clipboard

Add GitHub Action to run static analysis for PR

Open skrobinson opened this issue 4 years ago • 6 comments

@p-ranav,

I am interested in adding the static analysis action you mentioned in #128. Do you have a clang-tidy config file you want me to use?

skrobinson avatar Sep 14 '21 14:09 skrobinson

I don't have one, no. For naming-related checks, e.g., readability-identifier-naming.VariableCase, it's probably worth our time to also address #133 where we can first change the coding style of the project.

p-ranav avatar Sep 15 '21 15:09 p-ranav

Do you know of a project using the StaticAnalysis Action? I've had few results and would like to learn from a working example.

skrobinson avatar Sep 20 '21 20:09 skrobinson

I use a variation of that action in some private projects for work.

Here's my fork of the action with some changes I wanted.

And here is an example project I just cooked up that uses the action. The PR shows the action commenting with error and style issues that were discovered.

p-ranav avatar Sep 20 '21 21:09 p-ranav

I'm getting closer to a working SA report... The checks are running, errors are found (in the action log), but the SA Action reports everything is fine.

I have a running testbed at skrobinson/argparse#2

Do you have any ideas why?

skrobinson avatar Sep 21 '21 17:09 skrobinson

@p-ranav

My prototype PR Action to run StaticAnalysis (SA) is working at skrobinson/argparse#2. The commit history is a mess, but the SA reporting is what I expect. Now it's time to make some implementation decisions. I'm open to your decisions and here are my recommendations.

  1. Configure SA to match current style practices.
  2. With SA reporting 100% success, merge the Action commits.
  3. Begin a process of changing one clang-tidy check and updating argparse to meet the new check. A tidy change and source update would appear in the same commit. Repeat this process with occasional merges until argparse has been converted. I anticipate around 12 commits finish the style conversion.

I like this plan because it does not require replacing every line in a single commit and each changed line is for the same general reason. It does mean some lines may change more than once as corrections are made for different checks.

This plan also allows for delayed decision making. Pick the low-hanging fruit early and see how our thinking changes.

When I have a better idea of our direction, I'll make a clean branch and submit a PR.

skrobinson avatar Nov 04 '21 19:11 skrobinson

I like the plan and I agree with you - We can start small, from the current style and make incremental updates. I see what you have here and It's what I was hoping for!

p-ranav avatar Nov 04 '21 23:11 p-ranav

With #215, the overall idea is complete and clang-tidy checks are run on PR. I'll keep watching for clang-format and cppcheck actions.

skrobinson avatar Oct 13 '22 19:10 skrobinson