Update clang analyzer for new tool support, Python 3, and error fixes.

Review Request #11553 — Created March 25, 2021 and submitted — Latest diff uploaded

Information

ReviewBot
release-3.0.x

Reviewers

This updates ClangTool to subclass the newer BaseTool, and to use
the newer features it offers (dependencies, improved centralized base
command building, and standardized error code/column output).

It also adds Python 3 support. The plistlib module changed
substantially between Python 2 and 3, and we didn't have working clang
support in Review Bot 2.0 for Python 3.

Some fixes were put in place for handling clang results when
encountering a compiler error. Previously, these would just fail, as the
generated plist file wouldn't exist, and we assumed it did. Now, such
errors are turned directly into comments on a file, showing the error
output.

Along with that, line ranges are corrected, correctly commenting on the
exact number of lines that an error spans.

Unit tests were added for both simulated and actual runs of clang, using
the same datasets and expectations for both, to help catch regressions
down the road.

All unit tests pass on Python 2.7 and 3.x.

Diff Revision 2

This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.

orig
1
2
3

Commits

First Last Summary ID Author
Update clang analyzer for new tool support, Python 3, and error fixes.
This updates `ClangTool` to subclass the newer `BaseTool`, and to use the newer features it offers (dependencies, improved centralized base command building, and standardized error code/column output). It also adds Python 3 support. The `plistlib` module changed substantially between Python 2 and 3, and we didn't have working clang support in Review Bot 2.0 for Python 3. Some fixes were put in place for handling clang results when encountering a compiler error. Previously, these would just fail, as the generated plist file wouldn't exist, and we assumed it did. Now, such errors are turned directly into comments on a file, showing the error output. Along with that, line ranges are corrected, correctly commenting on the exact number of lines that an error spans. Unit tests were added for both simulated and actual runs of clang, using the same datasets and expectations for both, to help catch regressions down the road.
6f2d60f738d6684a79d8562dc8fcb0f2dc1c90c9 Christian Hammond
bot/reviewbot/testing/testcases.py
bot/reviewbot/tools/clang.py
bot/reviewbot/tools/base/mixins.py
bot/reviewbot/tools/tests/test_clang.py
Loading...