-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
dev-tools: run golint/reviewdog in Jenkins #3832
Changes from 6 commits
40dec92
c8f6375
fd5ebef
f27044c
21e15af
0ffc2d4
ae01b90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,11 @@ SNAPSHOT?=yes | |
PYTHON_ENV?=${BUILD_DIR}/python-env | ||
VIRTUALENV_PARAMS?= | ||
FIND=find . -type f -not -path "*/vendor/*" -not -path "*/build/*" -not -path "*/.git/*" | ||
GOLINT=golint | ||
GOLINT_REPO=github.com/golang/lint/golint | ||
REVIEWDOG=reviewdog | ||
REVIEWDOG_OPTIONS?=-diff "git diff master" | ||
REVIEWDOG_REPO=github.com/haya14busa/reviewdog/cmd/reviewdog | ||
|
||
# Runs complete testsuites (unit, system, integration) for all beats with coverage and race detection. | ||
# Also it builds the docs and the generators | ||
|
@@ -72,14 +77,19 @@ check: python-env | |
.PHONY: misspell | ||
misspell: | ||
go get github.com/client9/misspell | ||
${FIND} -name '*' -exec misspell -w {} \; | ||
$(FIND) -name '*' -exec misspell -w {} \; | ||
|
||
.PHONY: fmt | ||
fmt: python-env | ||
$(foreach var,$(PROJECTS),$(MAKE) -C $(var) fmt || exit 1;) | ||
# Cleans also python files which are not part of the beats | ||
find . -type f -name *.py -not -path "*/vendor/*" -not -path "*/build/*" -not -path "*/.git/*" -exec autopep8 --in-place --max-line-length 120 {} \; | ||
|
||
.PHONY: lint | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to be able to run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it would be nice to mimic what Jenkins does, i.e., run it on the diff. Are you suggesting running it on everything by default or having the ability to restrict it to the diff of a single beat? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm suggesting moving the implementation of the
I would still want to have the ability to run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool that makes sense, thanks! |
||
lint: | ||
@go get $(GOLINT_REPO) $(REVIEWDOG_REPO) | ||
$(REVIEWDOG) $(REVIEWDOG_OPTIONS) | ||
|
||
# Collects all dashboards and generates dashboard folder for https://github.com/elastic/beats-dashboards/tree/master/dashboards | ||
.PHONY: beats-dashboards | ||
beats-dashboards: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ type Log struct { | |
config prospectorConfig | ||
} | ||
|
||
// NewLog instantiates a new Log | ||
// NewProspectorLog instantiates a new Log | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [golint] reported by reviewdog 🐶 |
||
func NewLog(p *Prospector) (*Log, error) { | ||
|
||
prospectorer := &Log{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
runner: | ||
golint: | ||
cmd: golint $(go list ./... | grep -v /vendor/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these variables are not needed anymore here because they are in the libbeat Makefile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still have a
lint
target in this Makefile and I don't see it including the one fromlibbeat/scripts
, did I miss that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my fault, I assume this lint target calls all the other lint targets like we do for update and other things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. The reason is I didn't want to risk running it on overlapping code, nor keep track of what's a beat and what's not. So if you run it at the top level it runs on everything, if you run it inside a beat it runs only on the beat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok for me. My main worry is that we have quite a few duplicated lines and will change them in the future in one place but not the other.