Add 2 new worker types to Reviewbot. CPPlint and CPPCheck.
Review Request #3579 — Created Nov. 29, 2012 and submitted
This updates adds support for 2 new workers. Cpplint and cppcheck. This allows code style to be checked according to the cpplint rules (various configurable options available - not yet in the options). It then checks the code using the static analysis tool cppcheck. This will raise an Issue if it discovers and 'Error' otherwise just a comment. Whilst developing this I added a few patches to the core functionality. So the temp file now has a file extension (where applicable) - otherwise cpplint and cppcheck refuse to operate on the file (they want .c/.cpp/.cc etc) I also found that multiple submits was getting multiple reviews - so I now stop this. Other than that just a check in __init__.py to check these programs are installed. Have noticed %ORGANIZATION% still in the BSD headers - this needs to be changed to Ericsson Television Ltd
We have it running and seems to work ok. Could so with some of the options being broken out and made easier to configure
Description | From | Last Updated |
---|---|---|
This should be rewritten to say something like: "... and comes with the following plugins by default: ..." |
SM smacleod | |
Once cpplint is added to the install_requires, we shouldn't have to worry about these instructions. You can probably go ahead … |
SM smacleod | |
Remove trailing whitespace |
SM smacleod | |
This should be removed. |
SM smacleod | |
After removing the call to logger, this should be removed. |
SM smacleod | |
This should be removed as well. |
SM smacleod | |
I feel like this is going to be dumping way too much information to the log. Could you remove this … |
SM smacleod | |
Lets get rid of this change. I've updated Review Bot to only send a task when a new diff is … |
SM smacleod | |
Since we're no longer going to kill the review when processed_files is empty, lets remove all these changes. The base … |
SM smacleod | |
Trailing whitespace should be removed |
SM smacleod | |
This can be removed. |
SM smacleod | |
blank line between these. |
SM smacleod | |
The order should be flipped here (alphabetical) |
SM smacleod | |
2 blank lines between these. |
SM smacleod | |
This should be 'CPPCheckTool' |
SM smacleod | |
How about something like: "Checks code for errors using Cppcheck - A tool for static C/C++ code analysis" |
SM smacleod | |
Most of the calls to logger in here should probably call 'logger.debug' instead of 'logger.info'. Could you update them please. |
SM smacleod | |
It might be a good idea to handle the cases where the file extensions are upper or mixed case etc. |
SM smacleod | |
Remove trailing whitespace. |
SM smacleod | |
Remove trailing whitespace. |
SM smacleod | |
Let's remove this. |
SM smacleod | |
This may not do what is expected. Review Bot will open an issue depending on global settings configured in the … |
SM smacleod | |
Remove trailing whitespace. |
SM smacleod | |
this can be removed. |
SM smacleod | |
blank line between these |
SM smacleod | |
flip the order of these (alphabetical) |
SM smacleod | |
This should be 'CPPLintTool' |
SM smacleod | |
Why the '(Modified by E///)' part? |
SM smacleod | |
let's add 'max_value', and 'min_value' of 5 and 1 respectively. |
SM smacleod | |
Most of these should be changed to logger.debug as well. |
SM smacleod | |
might want to handle upper or mixed case as well. |
SM smacleod | |
I've added the ability for tools to specify a 'check_dependencies' method which can carry out checks like this. If the … |
SM smacleod | |
I've added an AUTHORS file to the repo where you may add your name, this should remain unchanged. |
SM smacleod | |
Can you put these in alphabetical order. |
SM smacleod | |
You should be able to add cpplint to this list, and it will be automatically installed with Review Bot. |
SM smacleod | |
Lets axe the dependency on distutils2. I've added a 'is_exe_in_path' function which you can use to check for the tools … |
SM smacleod | |
Col: 80 E501 line too long (85 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (97 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (137 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (107 > 79 characters) |
reviewbot | |
Col: 9 E303 too many blank lines (2) |
reviewbot | |
Col: 80 E501 line too long (84 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (86 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (85 > 79 characters) |
reviewbot | |
Col: 42 E261 at least two spaces before inline comment |
reviewbot | |
Col: 43 E262 inline comment should start with '# ' |
reviewbot | |
Col: 80 E501 line too long (137 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (131 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (132 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (92 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (127 > 79 characters) |
reviewbot | |
Col: 14 E111 indentation is not a multiple of four |
reviewbot | |
Col: 17 E121 continuation line indentation is not a multiple of four |
reviewbot | |
Col: 17 E121 continuation line indentation is not a multiple of four |
reviewbot | |
Col: 17 E121 continuation line indentation is not a multiple of four |
reviewbot | |
Col: 80 E501 line too long (100 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (101 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (100 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (122 > 79 characters) |
reviewbot | |
Col: 43 E262 inline comment should start with '# ' |
reviewbot | |
Col: 80 E501 line too long (88 > 79 characters) |
reviewbot | |
Col: 50 E262 inline comment should start with '# ' |
reviewbot | |
Col: 80 E501 line too long (88 > 79 characters) |
reviewbot | |
Col: 51 E262 inline comment should start with '# ' |
reviewbot | |
Col: 80 E501 line too long (88 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (85 > 79 characters) |
reviewbot |
-
Hey Dan, these look good, I'm excited to get them in. Sorry this review has taken me so long. There are mainly just some style issues, and some changes that should be made due to recent improvements to Review Bot (which will hopefully make things nicer for these tools anyway).
-
This should be rewritten to say something like: "... and comes with the following plugins by default: ..."
-
Once cpplint is added to the install_requires, we shouldn't have to worry about these instructions. You can probably go ahead and remove this.
-
-
-
-
-
-
I feel like this is going to be dumping way too much information to the log. Could you remove this please.
-
Lets get rid of this change. I've updated Review Bot to only send a task when a new diff is posted. Currently we need to show a review happened even if no files were processed, otherwise there is no way to tell if the review was actually triggered.
-
Since we're no longer going to kill the review when processed_files is empty, lets remove all these changes. The base class has changed slightly with the dependency checking as well.
-
-
-
-
-
-
-
How about something like: "Checks code for errors using Cppcheck - A tool for static C/C++ code analysis"
-
Most of the calls to logger in here should probably call 'logger.debug' instead of 'logger.info'. Could you update them please.
-
-
-
-
-
-
This may not do what is expected. Review Bot will open an issue depending on global settings configured in the admin panel. When you're passing 'issue=True' you are overriding this behaviour, and ensuring an issue is made. In the else case, you don't pass any value for issue, so you are letting Review Bot decide if an issue should be raised based on the admin configuration. If you really want to override Review Bots issue decisions, you should probably also pass 'issue=False'.
-
-
-
-
-
-
-
-
-
-
I've added the ability for tools to specify a 'check_dependencies' method which can carry out checks like this. If the method returns false, that tool won't be activated for the worker. Lets move these checks into methods on their respective tools.
-
-
-
You should be able to add cpplint to this list, and it will be automatically installed with Review Bot.
-
Lets axe the dependency on distutils2. I've added a 'is_exe_in_path' function which you can use to check for the tools you call out to.
- Change Summary:
-
This has the updates requested, the only issue is I am a git newbie. Which means that this diff shows your additions made in the mean_time. Not sure how to get around this (although I know its possible.) Sorry
-
Alright, so I took a look at your github fork of Review Bot, and it looks like the reason you're getting my changes in your review requests is because you've been committing to the master branch. I'm going to assume going forward that your local repository was cloned from the main Review Bot repository, so the origin remote refers to git://github.com/smacleod/ReviewBot.git. Also, <fork> should refer to the name you gave the remote for your github fork of Review Bot. Your development should take place on a separate branch, which I'll refer to as <feature> from this point forward. As you make changes, you should be committing to the <feature> branch. When you are ready to update your review request, you should merge the changes from master into your <feature> branch, and call post-review with <feature> checked out. ex: $ git checkout master $ git fetch origin $ git merge origin/master $ git checkout <feature> $ git merge master $ post-review -r 3579 Before this will work though, we need to fix the master branch on your repo. So, what we need to do is move your changes into a <feature> branch, and reset your master to origin/master. We'll also force push these changes to your fork. First Create the <feature> branch: $ git checkout master $ git branch <feature> Then reset your master branch: $ git reset --hard origin/master Push the changes to your fork: $ git push --force <fork> master Now, you'll want to properly base your changes off master: $ git checkout <feature> $ git rebase master You might get conflicts when rebasing here, which you'll have to resolve. After this is finished, you should be in a good state to update the review request. Let me know if you have any problems.
- Change Summary:
-
I think I have sorted the Git stuff now (not 100% sure) - GIT is all very new to me (I am used to SVN, RTC and Telelogic Synergy). These changes fix the cpplint install requires as this is now working for me - (It was not but now it has been updated easy_install works).
- Change Summary:
-
Finally had the time to get this right. Thanks for the GIT advice I think this patch now shows just my additions! Is running at my company and apart from the moaning about all the issues now being found :-) everyone is quite impressed.
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: bot/reviewbot/tasks.py bot/reviewbot/tools/cpplint.py bot/setup.py bot/reviewbot/processing/filesystem.py bot/reviewbot/tools/cppcheck.py bot/reviewbot/processing/review.py Ignored Files: README.md AUTHORS WARNING: Number of comments exceeded maximum, showing 30 of 35.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Change Summary:
-
I think this fixes all remaining pep8 issues. If I get the all clear from ReviewBot I will commit to master and republish the pull request!!