alecthomas / gometalinter

DEPRECATED: Use https://github.com/golangci/golangci-lint
MIT License
3.51k stars 267 forks source link

Setting cyclomatic complexity within VSCode #493

Closed majelbstoat closed 6 years ago

majelbstoat commented 6 years ago

I can't figure out if this is a VSCode thing or a gometalinter thing, so apologies if this is the wrong place.

I want to set the minimum cyclo complexity to 15. On the command line, this works:

gometalinter --fast --cyclo-over=15

However, in VSCode, using the standard Go extension:

  "go.lintFlags": [
    "--fast",
    "--cyclo-over=15",
  ],
  "go.lintTool": "gometalinter",

doesn't work. By this I mean, a cyclomatic complexity of 11 is still reported as a problem.

What's surprising is, --fast is taking effect, but --cyclo-over isn't. I've also tried:

  "go.lintFlags": [
    "--fast",
    "--cyclo-over 15",
  ],

and:

  "go.lintFlags": [
    "--fast",
    "--cyclo-over",
    "15",
  ],

without success.

majelbstoat commented 6 years ago

Ugh, turns out it was neither, and PEBKAC. There was a workspace setting that was taking precedence, which set --fast but not --cyclo-over. Apologies for noise.