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
2
votes
1 answer

ruff : E999 SyntaxError on match/case syntax

I got a strange issue with ruff (0.0.209) and python 3.10.9 interpreter when I use match/case syntax. For instance, this simple code : from http import HTTPStatus http_status = HTTPStatus.OK match http_status: case HTTPStatus.OK: …
Romain
  • 334
  • 4
  • 10
2
votes
0 answers

Python linter (pyright in neovim) doesn't recognize imports

I'm trying to learn how to use imports in python properly, but my linter pyright in neovim is giving me error messages despite being able to run the code. I have this structure in a python 3 test project. directory…
dekuShrub
  • 466
  • 4
  • 20
2
votes
2 answers

Disable errors in .pylintrc doesn't work in VS Code

I met strange behavior of pylint in VS Code. '.pylintrc' doesn't recognize after recreating. My steps: Install pylint in VS Code Set pylint as linter using 'Python: Select linter' command Add '.pylint' with disabling some of warnings: [MESSAGES…
sergzemsk
  • 164
  • 3
  • 12
2
votes
1 answer

Why does typescript break in components with spread?

Why does typescript break if you send props to a component with a spread statement? Example code type SomeComponentProps = Readonly<{ someTitle: string }> const SomeComponent = ({ someTitle }: SomeComponentProps) => { return…
Timur Zakirov
  • 381
  • 2
  • 8
2
votes
0 answers

JavaScript Code Linting tool to find Variables which are initialised but might not be used due to condition

I have the following JavaScript code, var foo = { company: "ABC", name: "John" }; var att = ""; function test(ob, i) { var m = JSON.stringify(ob); if (i < 10) { att = att + m; } } test(foo, 20); In above code, var m =…
dnsh
  • 3,516
  • 2
  • 22
  • 47
2
votes
1 answer

How to disable in VSCode the linters of variables names with camelCase (when using R)?

Most of the people I work with use the camelCase notation and every time I open an R file get a swarm of linters, which are annoying. How can I disable them? I always get something of the kind: Variable and function name style should be…
leplata
  • 123
  • 5
2
votes
0 answers

My linter does not detect none reference error

One of my junior colleague wrote the following code File: a.py s = None for i in range(10): s.startswith('hello') s = "" Line 3 for sure throws none reference error but he didn't notice. I'm shocked that PyCharm does not warn this, and…
Gqqnbig
  • 5,845
  • 10
  • 45
  • 86
2
votes
0 answers

mypy mix of stub files and in-line

can one use a mix of stub files and inline type annotation in mypy ? We have a large stub .pyi file and we thought to transfer it in parts. We took several functions and have removed them from .pyi and declared in code. However, now mypy is…
Beliaev Maksim
  • 968
  • 12
  • 21
2
votes
2 answers

eslint issue with jsx-a11y/media-has-caption

I have an audio file that im querying from contentful but instead of display the data I keep getting this eslintrule pop, It's an audio file so it has no captions. Is there a way of disabling this or correctly disabling it ? this is the…
someone
  • 661
  • 1
  • 9
  • 26
2
votes
0 answers

Flutter linter rules and structure in analysis_options.yaml file

I have been looking off and on for a few days now and I'm trying to customize the rules for linting my flutter project. I'd like to turn off the obvious warnings like unused local variables. Yet when I enter it into the rules section it doesn't work…
Technorocker
  • 103
  • 14
2
votes
1 answer

VS Code flags System.out.print

I'm a beginner programmer and It bothers me - why VS Code continues to flag my System.out.print statements and suggests using logger when in most places and tutorials they tell you to use out.print as a basic output stream? Problem with System out…
LinLee
  • 31
  • 4
2
votes
0 answers

Unable to activate Lizard analyzer [vscode]

Installing the C/C++ Advanced Lint extension in vscode offers supported Static Analyzers. lizard is amongst the list. I have lizard installed successfully via pip install lizard. But I still get the following error The options in settings related…
G Dube
  • 127
  • 7
2
votes
2 answers

Dart/Flutter linter rule: the type to index a map should be the key type of map?

For example, I have Map m;. Then I can write down m['hello'] without any compile-time error, but of course, cannot find any element at runtime. I hope it will produce an error (or warning) at compile-time or lint time. This is a big…
ch271828n
  • 15,854
  • 5
  • 53
  • 88
2
votes
1 answer

Custom type range/value check compile-time, real-time

When we define a variable of a built-in type too large to parse, Compiler/IDE (I'm using Visual Studio 2019) warns right away that the range has been violated, even before compiling the project - "integer constant is too large" if we're defining an…
Arman
  • 5,136
  • 3
  • 34
  • 36
2
votes
0 answers

Setting up a path for Haskell-Linter in VS Code on windows 10

I am trying to make haskell-linter to work on VS Code on my windows 10 machine. Apparently you need to add a path to the .exe file for it to work. I get this error message. Cannot hlint the haskell file. The hlint program was not found. Use the…
ExOster
  • 182
  • 1
  • 11