You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Todd Lipcon (Code Review)" <ge...@cloudera.org> on 2016/09/12 05:25:02 UTC

[kudu-CR] WIP: script to run clang-tidy against a patch

Todd Lipcon has uploaded a new change for review.

  http://gerrit.cloudera.org:8080/4381

Change subject: WIP: script to run clang-tidy against a patch
......................................................................

WIP: script to run clang-tidy against a patch

This is some WIP tooling which runs clang-tidy against a given patch,
and formats the resulting warnings in a form that can be consumed by the
gerrit API[1]

I'm hoping that, with a bit of tweaking, we can get this to be a useful
first-pass review to handle a lot of the more 'mechanical' things we
check.

Note if you want to try this you need clang-tidy on your path

[1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review

Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
---
A build-support/clang_tidy_gerrit.py
A src/kudu/.clang-tidy
2 files changed, 120 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/81/4381/1
-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>

[kudu-CR] Add script to run clang-tidy against a patch

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Adar Dembo, Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/4381

to look at the new patch set (#3).

Change subject: Add script to run clang-tidy against a patch
......................................................................

Add script to run clang-tidy against a patch

This tooling runs clang-tidy against a given patch, and formats the
resulting warnings in a form that can be consumed by the gerrit API[1]

This has been running out of a private branch for a couple weeks and
proven generally useful. This patch also updates .clang-tidy based on
the configuration that has been running.

[1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review

Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
---
M .ycm_extra_conf.py
A build-support/clang_tidy_gerrit.py
A build-support/compile_flags.py
M src/kudu/.clang-tidy
4 files changed, 246 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/81/4381/3
-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot

[kudu-CR] Add script to run clang-tidy against a patch

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change.

Change subject: Add script to run clang-tidy against a patch
......................................................................


Patch Set 3:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/4381/3/build-support/compile_flags.py
File build-support/compile_flags.py:

PS3, Line 29:     TODO(todd) it would be nicer to somehow grab these from CMake, but it's
            :     not clear how to do so.
> yea, though I was thinking we could run cmake with a standard (non-san, etc
You could pick your favorite test, find its flags.make, and concatenate CXX_FLAGS, CXX_DEFINES, and CXX_INCLUDES together. For example:

  adar@adar-ThinkPad-T540p:~/Source/kudu/build/debug$ cat src/kudu/tserver/CMakeFiles/tserver_test_util.dir/flags.make
  # CMAKE generated file: DO NOT EDIT!
  # Generated by "Unix Makefiles" Generator, CMake Version 3.5

  # compile CXX with /usr/lib/ccache/c++
  CXX_FLAGS = -msse4.2 -Wall -Wno-sign-compare -Wno-deprecated -pthread -fno-strict-aliasing -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG -ggdb -std=c++11 -g -fPIC   -fPIC

  CXX_DEFINES = -DKUDU_HEADERS_NO_STUBS=1 -DKUDU_HEADERS_USE_RICH_SLICE=1 -DKUDU_HEADERS_USE_SHORT_STATUS_MACROS=1 -DKUDU_STATIC_DEFINE -D__STDC_FORMAT_MACROS -Dtserver_test_util_EXPORTS

  CXX_INCLUDES = -I/home/adar/Source/kudu/build/debug/src -I/home/adar/Source/kudu/src -isystem /home/adar/Source/kudu/thirdparty/installed/common/include -isystem /home/adar/Source/kudu/thirdparty/installed/uninstrumented/include


-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes

[kudu-CR] Add script to run clang-tidy against a patch

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change.

Change subject: Add script to run clang-tidy against a patch
......................................................................


Patch Set 3:

(6 comments)

http://gerrit.cloudera.org:8080/#/c/4381/3/build-support/clang_tidy_gerrit.py
File build-support/clang_tidy_gerrit.py:

PS3, Line 34: CLANG_TIDY_DIFF = os.path.join(
            :     ROOT, "thirdparty/installed/uninstrumented/share/clang/clang-tidy-diff.py")
            : CLANG_TIDY = os.path.join(
            :     ROOT, "thirdparty/installed/uninstrumented/bin/clang-tidy")
Can we use paths to clang-toolchain here instead?


Line 39: GIT="git"
Not used?


Line 67:             print "l", l
Unreachable code?


Line 128: class TestClangTidyGerrit(unittest.TestCase):
Still want to keep this?


http://gerrit.cloudera.org:8080/#/c/4381/3/build-support/compile_flags.py
File build-support/compile_flags.py:

PS3, Line 29:     TODO(todd) it would be nicer to somehow grab these from CMake, but it's
            :     not clear how to do so.
I don't see how that would be possible given that cmake's list of flags is dependent on context (i.e. build type, sanitizer in use, etc.).


Line 39:         '-Dintegration_tests_EXPORTS',
This one is odd; do you know why it's included? CMake doesn't explicitly set it.


-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: Yes

[kudu-CR] WIP: script to run clang-tidy against a patch

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/4381

to look at the new patch set (#2).

Change subject: WIP: script to run clang-tidy against a patch
......................................................................

WIP: script to run clang-tidy against a patch

This is some WIP tooling which runs clang-tidy against a given patch,
and formats the resulting warnings in a form that can be consumed by the
gerrit API[1]

I'm hoping that, with a bit of tweaking, we can get this to be a useful
first-pass review to handle a lot of the more 'mechanical' things we
check.

Note if you want to try this you need clang-tidy on your path

[1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review

Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
---
A build-support/clang_tidy_gerrit.py
A src/kudu/.clang-tidy
2 files changed, 178 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/81/4381/2
-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot

[kudu-CR] Add script to run clang-tidy against a patch

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change.

Change subject: Add script to run clang-tidy against a patch
......................................................................


Patch Set 4: Code-Review+2

-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 4
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] Add script to run clang-tidy against a patch

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: Add script to run clang-tidy against a patch
......................................................................


Patch Set 3:

(6 comments)

> Forgot to ask: how is clang_tidy_gerrit.py invoked?

There's a jenkins job here: http://104.196.14.100/job/kudu-tidy-bot/
It's currently pointed at my personal git repo but once this is committed I'll update it to use master.

http://gerrit.cloudera.org:8080/#/c/4381/3/build-support/clang_tidy_gerrit.py
File build-support/clang_tidy_gerrit.py:

PS3, Line 34: CLANG_TIDY_DIFF = os.path.join(
            :     ROOT, "thirdparty/installed/uninstrumented/share/clang/clang-tidy-diff.py")
            : CLANG_TIDY = os.path.join(
            :     ROOT, "thirdparty/installed/uninstrumented/bin/clang-tidy")
> Can we use paths to clang-toolchain here instead?
Only for bin/. The python script doesn't end up installed.


Line 39: GIT="git"
> Not used?
Done


Line 67:             print "l", l
> Unreachable code?
Done


Line 128: class TestClangTidyGerrit(unittest.TestCase):
> Still want to keep this?
sure. I know it doesn't get run by any CI, but it was a useful test during dev, and will be useful if we need to tweak the parsing at some point.


http://gerrit.cloudera.org:8080/#/c/4381/3/build-support/compile_flags.py
File build-support/compile_flags.py:

PS3, Line 29:     TODO(todd) it would be nicer to somehow grab these from CMake, but it's
            :     not clear how to do so.
> I don't see how that would be possible given that cmake's list of flags is 
yea, though I was thinking we could run cmake with a standard (non-san, etc) build, and somehow get it to export the flags into a file somewhere as part of running 'cmake'. I couldn't figure out how to do that, though.


Line 39:         '-Dintegration_tests_EXPORTS',
> This one is odd; do you know why it's included? CMake doesn't explicitly se
hrm, no... my clang must have set it at some point whenever I copied this from some compilation string. Removed.


-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes

[kudu-CR] Add script to run clang-tidy against a patch

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/4381

to look at the new patch set (#4).

Change subject: Add script to run clang-tidy against a patch
......................................................................

Add script to run clang-tidy against a patch

This tooling runs clang-tidy against a given patch, and formats the
resulting warnings in a form that can be consumed by the gerrit API[1]

This has been running out of a private branch for many months and
proven generally useful. This patch also updates .clang-tidy based on
the configuration that has been running.

[1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review

Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
---
M .ycm_extra_conf.py
A build-support/clang_tidy_gerrit.py
A build-support/compile_flags.py
M src/kudu/.clang-tidy
4 files changed, 241 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/81/4381/4
-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 4
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] Add script to run clang-tidy against a patch

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change.

Change subject: Add script to run clang-tidy against a patch
......................................................................


Patch Set 3:

Forgot to ask: how is clang_tidy_gerrit.py invoked?

-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: No

[kudu-CR] WIP: script to run clang-tidy against a patch

Posted by "Kudu Jenkins (Code Review)" <ge...@cloudera.org>.
Kudu Jenkins has posted comments on this change.

Change subject: WIP: script to run clang-tidy against a patch
......................................................................


Patch Set 1:

Build Started http://104.196.14.100/job/kudu-gerrit/3366/

-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-HasComments: No

[kudu-CR] WIP: script to run clang-tidy against a patch

Posted by "Tidy Bot (Code Review)" <ge...@cloudera.org>.
Tidy Bot has posted comments on this change.

Change subject: WIP: script to run clang-tidy against a patch
......................................................................


Patch Set 1:

(1 comment)

Test posting via curl

http://gerrit.cloudera.org:8080/#/c/4381/1/src/kudu/.clang-tidy
File src/kudu/.clang-tidy:

Line 1: ---
hello world


-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: Yes

[kudu-CR] WIP: script to run clang-tidy against a patch

Posted by "Kudu Jenkins (Code Review)" <ge...@cloudera.org>.
Kudu Jenkins has posted comments on this change.

Change subject: WIP: script to run clang-tidy against a patch
......................................................................


Patch Set 2:

Build Started http://104.196.14.100/job/kudu-gerrit/3429/

-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: No

[kudu-CR] WIP: script to run clang-tidy against a patch

Posted by "Tidy Bot (Code Review)" <ge...@cloudera.org>.
Tidy Bot has posted comments on this change.

Change subject: WIP: script to run clang-tidy against a patch
......................................................................


Patch Set 1:

(1 comment)

Test posting via curl

http://gerrit.cloudera.org:8080/#/c/4381/1/src/kudu/.clang-tidy
File src/kudu/.clang-tidy:

Line 1: ---
hello world


-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-HasComments: Yes

[kudu-CR] Add script to run clang-tidy against a patch

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: Add script to run clang-tidy against a patch
......................................................................


Patch Set 3:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/4381/3/build-support/compile_flags.py
File build-support/compile_flags.py:

PS3, Line 29:     TODO(todd) it would be nicer to somehow grab these from CMake, but it's
            :     not clear how to do so.
> You could pick your favorite test, find its flags.make, and concatenate CXX
good idea.. I'm a bit lazy to do it now, though, and I guess you are OK cuz you gave it a +2


-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes

[kudu-CR] Add script to run clang-tidy against a patch

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has submitted this change and it was merged.

Change subject: Add script to run clang-tidy against a patch
......................................................................


Add script to run clang-tidy against a patch

This tooling runs clang-tidy against a given patch, and formats the
resulting warnings in a form that can be consumed by the gerrit API[1]

This has been running out of a private branch for many months and
proven generally useful. This patch also updates .clang-tidy based on
the configuration that has been running.

[1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review

Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Reviewed-on: http://gerrit.cloudera.org:8080/4381
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins
---
M .ycm_extra_conf.py
A build-support/clang_tidy_gerrit.py
A build-support/compile_flags.py
M src/kudu/.clang-tidy
4 files changed, 241 insertions(+), 33 deletions(-)

Approvals:
  Adar Dembo: Looks good to me, approved
  Kudu Jenkins: Verified



-- 
To view, visit http://gerrit.cloudera.org:8080/4381
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6c6246f4691b0ca143eea4aa8fb6a4b23099ce4e
Gerrit-PatchSet: 5
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <mp...@apache.org>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>