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

gometalinter custom linter not working #1955

Closed
pierrre opened this Issue Oct 1, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@pierrre

pierrre commented Oct 1, 2018

My config:

{
	"go.vetOnSave": "package",
	"go.lintTool": "gometalinter",
	"go.lintFlags": [
		"--disable-all",
		"--enable=deadcode",
		"--enable=gocyclo",
		"--enable=golint",
		"--enable=ineffassign",
		"--enable=misspell",
		"--enable=nakedret",
		"--enable=vet",
		"--enable=vetshadowstrict",
		"--linter='vetshadowstrict:go vet -shadow -shadowstrict:PATH:LINE:MESSAGE'",
		"--tests",
		"--vendor",
		"--deadline=30s"
	]
}

It displays this in the output:

Error while running tool: /home/pierre/go/bin/gometalinter --disable-all --enable=deadcode --enable=gocyclo --enable=golint --enable=ineffassign --enable=misspell --enable=nakedret --enable=vet --enable=vetshadowstrict --linter='vetshadowstrict:go vet -shadow -shadowstrict:PATH:LINE:MESSAGE' --tests --vendor --deadline=30s --aggregate
gometalinter: error: unknown linters: vetshadowstrict

If I run manually the command from the message above it works.

@ramya-rao-a

This comment has been minimized.

Show comment
Hide comment
@ramya-rao-a

ramya-rao-a Oct 2, 2018

Member

Are you sure vetshadowstrict is supported by gometalinter? I dont see any reference to it in the gometalinter repo. See https://github.com/alecthomas/gometalinter/search?q=vetshadowstrict&unscoped_q=vetshadowstrict

cc @alecthomas

Member

ramya-rao-a commented Oct 2, 2018

Are you sure vetshadowstrict is supported by gometalinter? I dont see any reference to it in the gometalinter repo. See https://github.com/alecthomas/gometalinter/search?q=vetshadowstrict&unscoped_q=vetshadowstrict

cc @alecthomas

@pierrre

This comment has been minimized.

Show comment
Hide comment
@pierrre

pierrre Oct 2, 2018

That's why I added "--linter='vetshadowstrict:go vet -shadow -shadowstrict:PATH:LINE:MESSAGE'", in the command line.
It allows to add custom linter command.
I don't understand why it works when I run the command manually in my terminal, but it doesn't work in vscode.

Anyway, after some thought, I decided not to use "vet shadow" in my app, because it has too many "false positive".
So it's not really a problem for me anymore.
But it could a problem for someone trying to use a custom linter command.

pierrre commented Oct 2, 2018

That's why I added "--linter='vetshadowstrict:go vet -shadow -shadowstrict:PATH:LINE:MESSAGE'", in the command line.
It allows to add custom linter command.
I don't understand why it works when I run the command manually in my terminal, but it doesn't work in vscode.

Anyway, after some thought, I decided not to use "vet shadow" in my app, because it has too many "false positive".
So it's not really a problem for me anymore.
But it could a problem for someone trying to use a custom linter command.

@pierrre

This comment has been minimized.

Show comment
Hide comment
@pierrre

pierrre Oct 2, 2018

I can simplify my problem to:

	"go.lintFlags": [
		"--disable-all",
		"--enable=mylinter",
		"--linter='mylinter:/bin/true:PATH:LINE:MESSAGE'",
	],

It prints:

Error while running tool: /home/pierre/go/bin/gometalinter --disable-all --enable=mylinter --linter='mylinter:/bin/true:PATH:LINE:MESSAGE' --aggregate
gometalinter: error: unknown linters: mylinter

If I run this command in my terminal, it works.

It seems to be an "escaping" issue, but I don't understand why.
This is working:

	"go.lintFlags": [
		"--disable-all",
		"--enable=mylinter",
		"--linter=mylinter:/bin/true:PATH:LINE:MESSAGE",
	],

I added simple quotes in my original command, because it contained spaces between the flags -shadow -shadowstrict.
But it causes an issue in vscode-go.

pierrre commented Oct 2, 2018

I can simplify my problem to:

	"go.lintFlags": [
		"--disable-all",
		"--enable=mylinter",
		"--linter='mylinter:/bin/true:PATH:LINE:MESSAGE'",
	],

It prints:

Error while running tool: /home/pierre/go/bin/gometalinter --disable-all --enable=mylinter --linter='mylinter:/bin/true:PATH:LINE:MESSAGE' --aggregate
gometalinter: error: unknown linters: mylinter

If I run this command in my terminal, it works.

It seems to be an "escaping" issue, but I don't understand why.
This is working:

	"go.lintFlags": [
		"--disable-all",
		"--enable=mylinter",
		"--linter=mylinter:/bin/true:PATH:LINE:MESSAGE",
	],

I added simple quotes in my original command, because it contained spaces between the flags -shadow -shadowstrict.
But it causes an issue in vscode-go.

@alecthomas

This comment has been minimized.

Show comment
Hide comment
@alecthomas

alecthomas Oct 2, 2018

Contributor

This is normal behaviour. Quotes are only interpreted by the shell, however most other applications (including vscode) execute subprocesses directly and treat the quotes as literals.

Contributor

alecthomas commented Oct 2, 2018

This is normal behaviour. Quotes are only interpreted by the shell, however most other applications (including vscode) execute subprocesses directly and treat the quotes as literals.

@pierrre

This comment has been minimized.

Show comment
Hide comment
@pierrre

pierrre Oct 2, 2018

OK, so it doesn't seem to be a real problem.
I'm closing the issue.
Thanks !

pierrre commented Oct 2, 2018

OK, so it doesn't seem to be a real problem.
I'm closing the issue.
Thanks !

@pierrre pierrre closed this Oct 2, 2018

@ramya-rao-a ramya-rao-a removed the help wanted label Oct 2, 2018

@ramya-rao-a

This comment has been minimized.

Show comment
Hide comment
@ramya-rao-a
Member

ramya-rao-a commented Oct 2, 2018

Thanks @alecthomas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment