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
1
vote
0 answers

Add Linter Rule: to localize magic strings - Flutter

I am basically looking for linter rule to recommend the team to localize the magic string in flutter. I am using Visual Code. Do you guys know anything about this? Can I do that? I surfed a-lot but didn't find the rule yet. And, I am new to flutter…
UGandhi
  • 518
  • 1
  • 8
  • 28
1
vote
1 answer

/../usr/local/go/src/runtime/cgo/cgo.go:34:8: could not import C (cgo preprocessing failed) (typecheck)

Note: current version of Go - 1.17.13 current version of golangci-lint - 1.45.2 I am getting the same error `could not import C (cgo preprocessing failed) (typecheck) no matter which version of golangci-lint I use while I am running…
Komron
  • 19
  • 4
1
vote
1 answer

Is there any tools for detecting files and lines that is using c++17 features?

Question Is there any tools for detecting files and lines that is using c++17 features? Background I'm developing some software with c++17. Recentlty a customer requested us to list files and lines that is using c++17 features. The reason is that…
mng
  • 17
  • 4
1
vote
1 answer

How can I fix linter constructor error in react project?

I'm trying to reopen my react project and I have this following error message when I restart my application. I tried to restart the project several times and try to understand what is a linter. How can i fix this error? Where is my error coming…
taf
  • 43
  • 4
1
vote
1 answer

Why are unused parameters only greyed out but not reported?

I use VS Code and the unused parameters of functions are only greyed out, but never reported. How to report those greyed out warning in the problem explorer? Currently, thanks to the parameter reportUnusedVariable in pyright, we can report unused…
1
vote
0 answers

Browserify eslint require(...).pathToFileURL is not a function

I am trying to bundle the code below using browserify const { ESLint } = require('eslint'); console.log(ESLint); And when I include the generated bundle in a html file, I get this error. Uncaught TypeError: require(...).pathToFileURL is not a…
1
vote
1 answer

Pylint gives warnings for centralised imports

In a python project I would like to globber imports into a single file called common_imports.py in order to reduce number of import statements in python files. Instead of writing file1.py import foo import bar import baz [...] file2.py import foo…
1
vote
0 answers

vs code phpcs only works sometimes

Sometimes I open a php file in VS Code and no linting occurs until I open the linting console from the bottom, switch over to the terminal pane where a dialog shows up that asks me if I trust the authors of this workspace. If I say yes then linting…
ubsd
  • 35
  • 6
1
vote
1 answer

C# linter add custom warning if cancellation token is not used (IDE: Rider)

I'm wishing to add a warning if cancellation token is not used, for example: var content = await File.ReadAllTextAsync(path) since in our case, cancellation token should be used, as follows: var content = await File.ReadAllTextAsync(path,…
Or Yaacov
  • 3,597
  • 5
  • 25
  • 49
1
vote
0 answers

Removing useless lines in vs code

I use Vs code for my coding.However I am getting weird lines in my code. Happens only when I am editing a .c file and not with .py file. Does anyone know a quick fix for this? Thanks.
eyah
  • 111
  • 1
  • 8
1
vote
2 answers

Is there a way to define keymap shortcuts for external tools depending on the file type, in PyCharm?

One use case would be to have the black code formatter for python files, and the sqlfluff code formatter for SQL files, and to use the same keyboard shortcut for both tools. Currently, both are set up in Preferences -> Tools -> External Tools,…
alxthm
  • 57
  • 1
  • 6
1
vote
0 answers

Python - Capture all possible code paths from one function to another function

Let's say in a python project there are 2 functions func_a() and func_b(). The 2 functions may not be in the same file or same folder (but are a part of the same project). What we want to find out is all possible ways using which we can call…
Nishant
  • 409
  • 6
  • 16
1
vote
0 answers

How to use hooks in workspaces with husky in root package.json?

I have to run a command which validates schema during pre-commit using husky hooks. Husky is included in package.json of root directory like this: "workspaces": { "packages": [ "apps", "vendors/*" ], …
Code Geek
  • 33
  • 1
  • 5
1
vote
1 answer

PyLint AttributeError

Receving this error while running pylint on my py file AttributeError: 'Import' object has no attribute 'infer_name_module' Full trace: $ pylint some_file.py Traceback (most recent call last): File "\lib\runpy.py", line 197, in…
David Meu
  • 1,527
  • 9
  • 14
1
vote
0 answers

Python Black Formatter - stop working with "color = true" in pyproject.toml

I have an issue with Black Python formatter in VSCode. It works perfectly with the VSCode parameters and now I work on a shared repository with a pyproject.toml configuration file. This file includes a few configs for Black so we all share the same…
Ssayan
  • 938
  • 5
  • 12