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
110
votes
2 answers

Cannot fix eslint rule on indenting case statements in switch statement

Here is a screenshot of my sublime text window showing the eslint error being thrown for the switch / case statement. I want to have to indent 4 spaces, as the code shows. and here are 4 different attempts to try to allow for an indent of 4 spaces,…
Canovice
  • 9,012
  • 22
  • 93
  • 211
39
votes
6 answers

Visual Studio code with PyLint and autoPep8: How can I avoid PyLint to complain about my line length?

I recently switched to Visual Studio Code and I have to say I love it so far. I'm working on a Python project, which includes the pip packages pylint and autopep8 and I configured VSCode to format the code according to these packages. Only problem…
J. Hesters
  • 13,117
  • 31
  • 133
  • 249
38
votes
6 answers

React linter airbnb proptypes array

I have the following PropTypes: SmartTable.propTypes = { name: React.PropTypes.string.isRequired, cols: React.PropTypes.array.isRequired, rows: React.PropTypes.array.isRequired, }; but the linter says me: Prop type "array" is forbidden, how…
FacundoGFlores
  • 7,858
  • 12
  • 64
  • 94
23
votes
4 answers

How to use Pylint or other linters with Jupyter Notebooks?

Is it possible to have a linter inside of a Jupyter Notebook?
magisterbrownie
  • 233
  • 1
  • 3
  • 6
21
votes
2 answers

Ignore [clang-diagnostic-error] clang-tidy caused by 3rd party headers

I am using clang-tidy as a "linter" tool in development. I started to integrate 3rd party software into my code and when I include their header files using: -I/path/to/include tons of errors are generated, I haven't even #include the headers…
user2930353
  • 333
  • 1
  • 2
  • 6
18
votes
6 answers

Vscode "Unable to open [file]: Unable to read file" message when clicking on an error

I get this message when I click on a warning. This is a screenshot of the case. The error reads, Unable to open 'warning.cpp': Unable to read file '/Users/dimen/code/C++/Users/dimen/code/C++/warning.cpp' (Error: Unable to resolve non-existing…
Dimen
  • 391
  • 1
  • 4
  • 18
16
votes
3 answers

How to fix linter warning `Error return value is not checked`?

I'm calling the method with error type value (foo() in code example). I don't care this result. What's the rigth code style way to write? Errcheck linter makes me check this error. //for example, same method may be called from imported…
Evgeny Belyy
  • 173
  • 1
  • 1
  • 4
16
votes
1 answer

Enforce JDK8 Doclint in Eclipse

Is there a way to get Eclipse Mars JDT to enforce the new, stricter, JDK8 "doclint" standards such that error levels in Eclipse match the javadoc tool? It seems much has been written about disabling the Linter, but I want to do the opposite: leave…
Adam Lewis
  • 933
  • 7
  • 9
15
votes
1 answer

Disable specific warnings from cpplint

When running cpplint, I run into some warnings that I'd like to completely disable. Specifically the copyright message & whitespaces: range.h:0: No copyright message found. You should have a line: "Copyright [year] " [legal/copyright]…
AnilRedshift
  • 7,937
  • 7
  • 35
  • 59
14
votes
7 answers

Issues installing mypy in VSCode

I'm trying to install the mypy linter in Visual Studio Code version 1.53 on MacOS. I've never used a linter before, so I'm not sure what to expect, though I know it should be highlighting type errors and the such. I'm trying to get mypy working in…
11
votes
1 answer

Scala 2.12.2 emits a ton of useless "Warning: parameter value ... in method ... is never used" warnings. How to get rid of them?

This is a question so I don't have to traverse the entire Internet to find the answer, as scalac options are currently not published. How do I disable these warnings starting in Scala 2.12.2, when I have a global "-Xlint"?
0__
  • 66,707
  • 21
  • 171
  • 266
10
votes
2 answers

Eslint error: Value [{"disallowRedundantWrapping":true}] should NOT have more than 0 items

I'm coding on a small personal project to develop my skills in React and I'm having a lot of issues with eslint and prettier to the point that half my time on the project I'm looking at eslint stuff because it stops auto formatting my code. Usually…
Leinil
  • 113
  • 1
  • 6
10
votes
2 answers

File is not `gofmt`-ed with `-s`: why is this happening and how to resolve it?

We use a linter (for Golang) that run through a Github Actions workflow every time we open or update a Pull Request on our repository. It recently started to return the following error: File is not `gofmt`-ed with `-s` (gofmt) After what happened in…
GuiFalourd
  • 15,523
  • 8
  • 44
  • 71
10
votes
1 answer

Why is flutter analyze different from dart analyze?

I am learning Flutter and I've created a simple Android app. I want to follow the best practices, so I've also created a analysis_options.yaml: include: package:pedantic/analysis_options.yaml linter: rules: public_member_api_docs:…
madhead
  • 31,729
  • 16
  • 153
  • 201
10
votes
4 answers

Is it possible to ignore specific warnings with Visual Studio Code's linter?

Our company is thinking about switching from Sublime to Visual Studio Code. With SublimeLinter it's possible to use ignore_match statements in the preferences file to ignore specific warnings. This lets us hide false positives such as tracking tags…
user9891601
  • 101
  • 1
  • 1
  • 3
1
2 3
21 22