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

Override Eslint rule only for specific code fragment

Is it possible to enable Eslint custom rule via comments for some code fragment only? Eg. I'd like to change rule setting only for single function in file (func2) and the rest should use global Eslint setting. Something like this: func1()…
chudy91
  • 408
  • 3
  • 18
1
vote
1 answer

Lint dynamic return types in PHP

I would like to be able to autocomplete when using my following code. I have looked for a solution, but just can't seem to find anything. This is about what my models look like. In the following example I would like to be able to tab example and…
ALZlper
  • 61
  • 1
  • 9
1
vote
2 answers

Is there a way to prevent usage of a specific function provided by a dependency?

My application has a compile dependency to a library A. There is a specific function in this library which I know that causes performance problems. But it is not deprecated and if you don't have this prior information you would think that it is safe…
fcs
  • 926
  • 1
  • 8
  • 14
1
vote
0 answers

Custom TSLint rule to warning on a method invocation

I want to start preventing people from invoking a method in TypeScript that I already deprecated. For that, I would like to have a custom TSLint rule to show a warning every time someone tries to use that method. I have researched on how to create…
Vicente S.
  • 31
  • 3
1
vote
1 answer

Expected type Union[str, bytes, int] but got Sequence[Union[int, float, str]]

PyCharm is showing this warning and I cannot figure out why. def record(self, *data: Sequence[Union[int, float, str]]) -> None: for field, value in zip(self.fields, data): if field.type in {1, 3}: try: value…
pstatix
  • 3,611
  • 4
  • 18
  • 40
1
vote
1 answer

I can't make my custom eslint rule to work

I'm using the AST tool to build a custom esLint rule. I want to build a rule that throws a warning whenever I use hardcoded strings in a function call. Example: var greet = 'Hello'; console.log('Hello') // throws an warning console.log(greet) //…
Manuel Abascal
  • 5,616
  • 5
  • 35
  • 68
1
vote
1 answer

Atom stylelint - how to set rules globally?

I need to set stylelint globally because it seems like unnecessary work to configure every single project alone, and I am just unable to find such guide anywhere. How to do this please?
MarkJ
  • 39
  • 6
1
vote
0 answers

Is there an android NDK linter?

I inherited an android project that has a lot of stylistically messy C++ code. I want to clean it up and enforce style consistency going forward. Ideally I'd be able to specify a list of rules or a style guide that have to be followed.
1
vote
1 answer

Rubocop: end alignment for begin blocks

I may be missing something obvious, but it seems that Rubocop skips the alignment of end when closing a begin block. Given the case: begin # Foo end I would expect the "end" to have a Layout error: Layout/EndAlignment end is not…
Rockster160
  • 1,579
  • 1
  • 15
  • 30
1
vote
1 answer

Atom: Why Linter does not highlight my errors inline with text?

I saw in tutorials that linter in atom must highlight html syntax errors inline with text and it also highlights lines with red bubbles near them like below: I installed linter-htmlhint besides of linter but it did not help and currently my atom…
VSB
  • 9,825
  • 16
  • 72
  • 145
1
vote
2 answers

getting Suspicious application of an implicit view when converting from Option(lang.Long) to Long

after adding this flag to scalacoptions : "-Xlint:option-implicit" I don't understand why am I getting this and how to resolve it Error:(47, 34) Suspicious application of an implicit view (scala.Predef.Long2long) in the argument to…
igx
  • 4,101
  • 11
  • 43
  • 88
1
vote
1 answer

Stop TSLint removing leading spaces within a HTML element

How do I configure TSLint in VSCode to not reformat my code? I don't want to disable TSLint entirely I just want to stop this one thing it does. I want to keep the leading indentation within the html tags.
John
  • 1,823
  • 2
  • 13
  • 14
1
vote
2 answers

Visual Studio Code How to lint only changed file?

Is there any configuration in visual studio code that only lint changed the file (python, javascript, CSS)?. I don't want to lint existing/unmodified file. I just to want lint the code which I have written. Note. used flake8 and eslint for linting
Ravi Gadhia
  • 490
  • 3
  • 11
1
vote
3 answers

Unable to run pylinter, set python interpreter in VS Code

I've seen a few questions opened on Stack Overflow and the dedicated VS Code Git, but all of the solutions have revolved on reinstallations and after trying this on the Python extension and VS Code itself multiple times with necessary restarts I'm…
Ben Saunders
  • 929
  • 10
  • 20
1
vote
0 answers

Where do I have to save project specific linters (linter() package in R)?

I am new to linter() package in R and I am trying to write my own project specific linters. My question is: Where do I have to save them and how can I make them visible for my linter()? I do not want to include them locally/globally to…
gdol
  • 165
  • 10