Project

General

Profile

Feature #5087

CI: gerrit-verifications: run clang static analyzer and syntax check on patches

Added by osmith about 1 month ago. Updated 29 days ago.

Status:
New
Priority:
Normal
Assignee:
Category:
jenkins
Target version:
-
Start date:
03/23/2021
Due date:
% Done:

0%

Spec Reference:

Description

As discussed yesterday: it would be useful to run clang in the gerrit-verifications job, before and after the patch has been applied, and report (-> let gerrit verifications fail) if there is something in the diff.

The idea is to prevent the need for pointing out trivial syntax errors in code review, and to have the static analyzer find bugs automatically.

We would only run it on the diff, so we don't need to adjust the whole code base of each project.

History

#1 Updated by fixeria 29 days ago

#2 Updated by laforge 29 days ago

On Wed, Mar 24, 2021 at 03:10:08PM +0000, fixeria [REDMINE] wrote:

Here is a script that is used in srsLTE: https://github.com/srsLTE/srsLTE/blob/master/run-clang-format-diff.sh

I think that's the first shell script under AGPLv3 that I consciously notice :)

I also wonder what that "python3 -c 'data = open(0).read(); print(data); exit(1 if data else 0)')" script is really for? Checking if stdout is of non-zero length?

#3 Updated by osmith 29 days ago

Thanks for posting the script, fixeria!

laforge wrote:

I also wonder what that "python3 -c 'data = open(0).read(); print(data); exit(1 if data else 0)')" script is really for? Checking if stdout is of non-zero length?

Yes, exit with 1 if clang-format-diff output is not a zero-length string.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)