Questions tagged [linter]

NOTE: It is recommend to use the tag static-analysis instead. "Linter" is slang for static analyzer, a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs at compile-time. The slang "linter" originates from the specific product PC Lint.

"Linter" is slang for static analyzer, a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs at compile-time. Whereas a dynamic analyzer is a tool that performs similar analysis in run-time.

The slang "linter" originates from the specific product PC Lint, though there are many other such tools for various programming languages and coding standards.

The first linter was written by Stephen C. Johnson in 1978 while working in the Unix operating system at Bell Labs. After that, many other linters have appeared for different purposes and languages, not only C.


Tag usage

Since "linter is slang and not a formal term, it is recommend to use the tag instead. Always use that tag in combination with tags for the specific language, standard and tool used.

Tag usage example: .

Also include versions of the programming language, coding standard and tool where applicable.

326 questions
3
votes
2 answers

Linter complains about empty dependency array in React Native hooks

In a React Native useEffect it is acceptable to use an empty dependency array (and this is often done intentionally for legitimate reasons). In useEffect, what's the difference between providing no dependency array and an empty one? Yet Linter keeps…
ahron
  • 803
  • 6
  • 29
3
votes
1 answer

How to make goclangci-lint show all errors at once?

I'm linting my Go project with the following command using the golangci-lint tool like this: > golangci-lint run There are numerous files in this project. So there are dozens (maybe over 100?) linter errors. But something annoying keeps happening.…
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
3
votes
3 answers

VSCode adds spaces inside HTML tags inside React code

Starting to learn React from ground when I saved the code below VS Code formatted it as in the image. ReactDOM.render(

Hi there {name}

your lucky number is {num}

, …
bbgo
  • 31
  • 4
3
votes
1 answer

How to configure VIM Ale to use the Tidy linter for HTML?

I'm trying to configure the vim Ale plugin to use Tidy to lint HTML code. I added to my .vimrc file: let g:ale_linters = { \ 'css': ['csslint'], \ 'html': ['tidy'], \ 'javascript': ['eslint'], \ 'php': [''], \ 'python': ['flake8'], …
burke
  • 89
  • 2
  • 2
  • 10
3
votes
1 answer

go lint tools range closure detection

Been trying to use gonnel for some tunnels. Tried to open 2 tunnels, and then when they got closed, I noticed that the log package is saying that is trying to close the same tunnel twice. From looking at the code, it seems that (one of) the problems…
Geo
  • 93,257
  • 117
  • 344
  • 520
3
votes
0 answers

How can I identify all unsafe operators in Swift?

I'm aware of the following Swift syntax forms which, when they fail, cause a runtime error / illegal instruction: var x: Foo! // implicit unsafe unwrap x as! y // unsafe downcast optionalValue! // explicit unsafe unwrap I want to…
jameshfisher
  • 34,029
  • 31
  • 121
  • 167
3
votes
3 answers

Are there PHP linter rules to prevent obvious comments?

I work on a multi-language software codebase (python, JS, java, PHP, C) where my previous colleagues commented everything. However, the vast majority of comments is completely unuseful. Ex : /** * Get warning file info */ function…
Kiruahxh
  • 1,276
  • 13
  • 30
3
votes
1 answer

VSCode / Python / Pep8 works only when save file

I write in Visual Studio Code 1.29.1 some code in Python 3 and I'd like to have it check to be ok with Pep8. So I have selected pep8 liter option and it works but is it possible to be more responsive? Right now it checks the code when I press CTRL +…
Artur Jarosz
  • 81
  • 4
  • 14
3
votes
2 answers

TS Lint in Visual Studio Code suddenly indicates wrong lint errors

I haven't touched VS Code or my computer for 5 weeks (vacation) and now suddenly out of nowhere the TS lint started wildly showing lint errors that are completely incorrect. They aren't even close to being correct and it shows it in files that…
Mikael
  • 97
  • 1
  • 7
3
votes
2 answers

Verify whether a method parameter is used in the method body

I have an interface which looks like the following interface Evaluator { boolean requiresP2(); EvalResult evaluate(Param1 p1, Param2 p2, Param3 p3); // some more methods } This interface is implemented by several classes. The parameter…
lakshayg
  • 2,053
  • 2
  • 20
  • 34
3
votes
1 answer

goconst warnings from linter

I'm using Atom to develop my Go app. The Linter in Atom is reporting an odd warning, and I don't see how it's a problem. Should I forever ignore the warning, or is there an alternate method I can implement? Error: Warning goconst 3 other…
Kalnode
  • 9,386
  • 3
  • 34
  • 62
3
votes
1 answer

Python warning print expression is assigned to nothing

I'm using Syntastic in vim as a linter for Python3. I have a few warnings that my print statements are expressions that are not assigned to anything: [expression-not-assigned] Expression "(print(('Authenticated for Twitter user ') +…
Alex Waibel
  • 103
  • 1
  • 8
3
votes
0 answers

Linter for Unity ShaderLab Syntax?

Is there a linter available for Unity ShaderLab Syntax? The closest I found is Glslang but it doesn't support .shader extension. It would be great to have a linter to ensure clean code just like having cpplint for C++ code.
user3667089
  • 2,996
  • 5
  • 30
  • 56
3
votes
1 answer

ESLint not detecting imported React Components

I am having an issue with ESLint not detecting imported React components with a 'no-unused-vars' rule. My components are imported: import MediaQuery from 'react-responsive'; and the component is used further down in the file: render() { return ( …
bgmaster
  • 2,313
  • 4
  • 28
  • 41
3
votes
2 answers

How to use .csslintrc in Atom's CSSLint to ignore rules?

I'm using Linter with Linter-CSSlint in Atom (windows) and I want to prevent some warnings globally (like "ids"). In CSSlint's readme says that it supports .csslintrc but I can't find info of where should I put this .csslintrc file. I saw a…
distante
  • 6,438
  • 6
  • 48
  • 90