-
Notifications
You must be signed in to change notification settings - Fork 355
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
Add cpplint to CI #400
Add cpplint to CI #400
Conversation
Codecov Report
@@ Coverage Diff @@
## master #400 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 12 12
Lines 3580 3580
=====================================
Hits 3580 3580
Continue to review full report at Codecov.
|
Command cpplint --counting=detailed --recursive examples include/CLI does not seem to be called inside the pulled docker container: azure says that command How can I change the pipeline such that this command is called inside docker, where cpplint is available? |
Hint: Notice the first line of the job step:
Does not indicate it's running through docker. Scrolling up, there's no container starting lines in previous steps either. So that should be an indicator that the container is not being used. Now I'm not sure why Azure didn't complain about the pool mapping having an extra unused key... |
Here's Azure's container docs; it's quite hard to find, IMO, since "docker" brings up things like how to build a docker image, how to host one, etc, etc, etc. Not how to run on one. https://docs.microsoft.com/en-us/azure/devops/pipelines/process/container-phases?view=azure-devops Like GitHub Actions (they are really reskinned versions of mostly the same thing), you can specify a container per-step as well. |
As suggested in code review Co-Authored-By: Henry Schreiner <HenrySchreinerIII@gmail.com>
That did the trick, thanks a lot! I will also have a look at the link such that I can do fewer [WIP]-PRs in future ;) I would like to ask your opinion on the flags that are to be discussed:
I will follow your guidance on these flags. I can include them in this PR (increasing the diff) or create separate PRs. |
At least point 4 can go in, and maybe 3 and/or 1. |
I think I would recommend waiting on 1 and 3 until after a 1.9 release. Any new header would need to be handled well in the single file generator. I think it reasonable and probably desirable but there may be reasons to wait on it until after the single file generator is updated. 3 is also probably desirable but may involve changing some of the API, which might be more appropriate in the 2.0 release. 2 I am also not sure I agree with. I sort of understand why Google does it that way but the same rational doesn't apply to most other libraries. pointers come with nullability concerns so it would require a lot of modifications that I am not sure are useful in CLI11. for 4 it is probably fine as long as it doesn't interfere with the clang-format since that has some header checks as well I believe. (at least is does on our other repos). |
Sounds very good! I'll do the following:
|
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.
The changes seem fine to me.
I should look up why cpplint does the headers in that order. I think I have always put the local headers first so they can't rely on the system headers. But maybe there is a good reason for the opposite.
Thanks for your review! Regarding your comment: you're right, and Google style guidelines recommend it as you propose for the related header (i.e. |
I'd say it encourages bad practise. With the "other project headers" after system headers it's easy to miss an include and make the header not self-contained (like you have to include vector before your project header or the thing will not compile). |
Putting the system includes before the other project headers does look odd and possibly error prone to me. Does Google explain why they recommend this? LLVM seems to do more explaining on the "why" of the recommendations. |
I don't see official explanation from Google but there https://stackoverflow.com/a/54348720 is one possible explanation (maybe not why that order but at least why they could consider it safe). It doesn't really speak to me though. |
This reverts commit bddb6a2.
I'm also unable to find a proper explanation for this in Google's C++ style guide. Also, cpplint's check |
Co-Authored-By: Henry Schreiner <HenrySchreinerIII@gmail.com>
Any file that uses the c std types needs |
Ah, thanks for reminding me of this. I read that one should use There are few more lines that need to be changed to follow this rule; I'll open a separate PR for fixing those after this PR has been merged. Ok? |
Addressing #378: add cpplint to the CI pipeline with a set of checks that require small changes (<10 lines) in existing code.
Currently, cpplint is expected to fail (solutions to these issues are already implemented, though not yet pushed). At this moment, this PR checks whether cpplint works in the azure pipeline and whether the return value of cpplint is used. Once that is verified, I'll push the code resolving the issues.
You can run cpplint on your machine by checking out this PR and executing
Please review the checks that are so far excluded in file
CPPLINT.cfg
. We can discuss those checks in this or in future PRs.Advice on integrating cpplint into CI is welcome, I'm an azure pipeline beginner. Hints on running the CI pipeline on my local machine are welcome as well :)