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

Best way to suppress mypy's "has no attribute" for global variable that is initialized later

I have read other questions on this topic - and all of them are about another level (classes, methods or function). I'm trying to find a way to suppress "has not attribute" message from mypy for a module level name. Code looks like this service:…
sashaaero
  • 2,618
  • 5
  • 23
  • 41
0
votes
0 answers

How to create a custom anomaly in SchemaSpy

I was learning about SchemaSpy lately. Was amazed with the UI representation by graphviz. But had a doubt whether we can create custom anomaly, if so how do we create custom anomalies(Step by step approach). Tried to create custom anomaly but didn't…
0
votes
0 answers

DeteKt: сheck for the use of the fragment constructor in Android

Is it possible to create DeteKt rule for checking is the Android fragment constructor used directly in the code instead newInstance? I would like to create checks that prohibit the creation of a custom constructor for a fragment as well as the…
po4yka
  • 151
  • 2
  • 7
0
votes
0 answers

Is it possible to add linter for Google Chrome extension project?

I would like to add a linter for an existing Google Chrome extension project, is there any chance to add a linter for this kind of project? Instead of package.json I have manifest.json, so when I run npm init @eslint/config, I have an error saying I…
0
votes
0 answers

Multi-language linter to find duplicate strings in multiple files

There are several linters to detect duplicate code in files (ex: CPD, JSCPD) But they are based on the number of tokens, and on text, not string (recognizable by being delimited by quotes or double quotes) I'm looking for a linter that would detect…
Nicolas Vuillamy
  • 564
  • 7
  • 14
0
votes
1 answer

React Typescript linter that replaces single quotes with double on push to git

Do any of you know a linter for React TypeScript, that replaces single quotes with double quotes on push to git. So next time someone pulls the project down, there is only double quotes.
Jonas
  • 47
  • 6
0
votes
1 answer

Type hinting for object with autospec'd dependencies

I am creating tests for some controller objects that obviously have dependencies. I want to test that it's interacting correctly with the dependencies without instantiating them for obvious reasons (database connections). So I have a class…
Lachlan
  • 165
  • 1
  • 10
0
votes
1 answer

Linter Issue with Go-MongoDB Collections Find Query

My Go code has several statements of the sort: cursor, err := collection.Find(context.TODO(), bson.D{{}}) and they work as expected but the linter complains when executing: golangci-lint run ./... && ginkgo -r -cover The linter displays the…
Foobar
  • 843
  • 1
  • 10
  • 23
0
votes
0 answers

Dart Linter: library_private_types_in_public_api

I'm new to Dart/Flutter and working on correcting some linting errors I'm getting in my code. The error library_private_types_in_public_api is flagged by the flowing line of code: _ActiveEstimateListScreenState createState() => …
0
votes
1 answer

Is there an overlap between cljfmt and clojure-kondo?

I have been using Clojure, ClojureScript, lein, shadow-cljs, re-frame, reagent, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic web app project. For the last several weeks, I have been focusing on a Continuous Integration effort. After…
Pedro Delfino
  • 2,421
  • 1
  • 15
  • 30
0
votes
0 answers

What's the point of using builders for testing and linting in Angular?

I've been working with Angular for quite a while now, I've searched the whole web without finding any answers, but I'm always wondering why we have so many builders for testing and linting out there that can be registered in angular.json, such…
Bohao LI
  • 2,123
  • 2
  • 18
  • 24
0
votes
2 answers

How to type python class factory with linter?

I have this code from abc import ABC from typing import Type class AbstractFoo(ABC): """Abstract foo.""" foo_attr: int def foo_factory(foo_attr_val: int) -> Type[AbstractFoo]: class Foo(AbstractFoo): foo_attr =…
Anonymous
  • 295
  • 2
  • 13
0
votes
1 answer

Swiftlint unused_import rule does not work

I am using swiftlint for my project with SPM I want to use unused_imports rule like this: ... analyzer_rules: - unused_import ... But it does not find any violations, even thought they are in the project I have also tried turn it on in the…
Daniel Pustotin
  • 237
  • 1
  • 9
0
votes
1 answer

Visual Studio Code is not showing alert for undefined class methods

I am using vscode with Pylance and Pylint, and it does not show an alert for undefined class methods as Pycharm does. Example: Pycharm Visual Studio Code What I tried: Used a different linter (Flake 8) Made sure there are no settings that might…
Tomer
  • 33
  • 6
0
votes
1 answer

Dependabot from Github is telling me to update the gopkg.in/yaml.v2

I currently have gopkg.in/yaml.v2 < 2.2.8. What are the commands I need to execute on the terminal to properly update gopkg.in/yaml.v2? I tried the following: go get -u gopkg.in/yaml.v2@v2.4.0 But my CI checks are failing at the linter level. The…