-
-
Notifications
You must be signed in to change notification settings - Fork 654
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 lint check for C++ changes #12407
Comments
I've been involved in the integration of cppcheck before, a static analysis tool. However, I agree it would be best to have something that runs as part of the build. Ideally it would address not only style, but also detect common errors via static analysis. Some overviews of common tools:
|
CC @LeonarddeR, I think this is something to be aware of in your C++/WinRT research. Thanks.
|
Building nvda with There are options to log these to an xml file. This file could then be used to add pragma directives to ignore the pre-existing warnings. Then we can set the build to run analyze for all PR builds and fail them if there are any new warnings. The in code pragmas will highlight the warnings for developers to watch out for problems / fix as we go. |
We might also want to consider what ruleset is used: |
I don't think #12261 is relevant to C++ code. With Python, auto formatting can theoretically result into parse errors. With C++, badly linted stuff simply won't build. |
There may be confusion of terms here. Formatting of C++ is one thing, and as you say low risk, should be easy to introduce (however git blame needs the ignored revision fix). Most C++ linters / checkers warn about more serious "correctness" issues. These warnings may highlight a bug, but fixing them isn't always straightforward, and may introduce other bugs, or snowball into a very large and hard to verify change. Careful and incremental is my advice. I'd be happy for a reformat to be done automatically however, with something like ClangFormat |
I forgot about this one. @seanbudd any plans to address it in the near future? |
@LeonarddeR - it's on our roadmap on a very low priority and scheduled for late next year, so I wouldn't bet on it, but we'd like to tackle it eventually |
Is your feature request related to a problem? Please describe.
Unlinted C++ code exists on the master branch of NVDA, and PRs to master can contain unlinted C++ code. Currently reviewers must manually check if a PR introduces unlinted C++ code.
Describe the solution you'd like
It would be nice to have a lint check similar to our flake8 python check that checks if a PR introduces unlinted C++ code.
It would also be good to lint our existing C++ code base, but this may run into problems as discussed on #12261
Potential tool to use: cpplint
Describe alternatives you've considered
Manual checking and linting, other tools
The text was updated successfully, but these errors were encountered: