Questions tagged [lint]

Please tag questions about static analysis tools "static-analysis" unless they're actually about the Lint utility. One of the first static analyzers was the Lint utility which appeared in 1979 as part of the Unix 7 distribution kit. Lint was originally used to analyze C source code. This command was so popular that the word "lint" has become the generic term for static analysis tools.

Introduction

The first version of Lint was developed by Stephen C. Johnson while at Bell Laboratories in an effort to detect bugs that may have otherwise gone unnoticed in C programs. The following is from the abstract for "Lint, a C Program Checker" written by Johnson in 1978.

Lint is a command which examines C source programs, detecting a number of bugs and obscurities. It enforces the type rules of C more strictly than the C compilers. It may also be used to enforce a number of portability restrictions involved in moving programs between different machines and/or operating systems. Another option detects a number of wasteful, or error prone, constructions which nevertheless are, strictly speaking, legal.

Johnson's Lint command first appeared (outside of Bell Laboratories) in 1979 as part of the Unix 7 distribution kit (see lint(1) man page). A version of the command still exists today and a description of the utility can be found in the FreeBSD 11.2 lint(1) man page:

The lint utility attempts to detect features of the named C program files that are likely to be bugs, to be non-portable, or to be wasteful. It also performs stricter type checking than does the C compiler.

Among the possible problems that are currently noted are unreachable statements, loops not entered at the top, variables declared and not used, and logical expressions with constant values. Function calls are checked for inconsistencies, such as calls to functions that return values in some places and not in others, functions called with varying numbers of arguments, function calls that pass arguments of a type other than the type the function expects to receive, functions whose values are not used, and calls to functions not returning values that use the nonexistent return value of the function.

Due primarily to the popularity of the original Lint command, the term "lint" has come to signify static analysis tools in general. A myriad of tools exist today, some of which include:

Open source:

Commercial:

Usage of the Stack Overflow "lint" tag

Only use this tag for questions involving the various Lint tools from Gimpel Software.

Please refrain from using this tag regarding general questions about static analysis. Questions in regard to the static analysis of code and the use of static analysis tools should use .

References

Karpov, Andrey, Parallel Lint: Verifying parallel programs, Dr. Dobb's The World of Software Development, 2009.

Johnson, S.C., Lint, a C Program Verifier, Bell Laboratories, Murray Hill, New Jersey, 1978.

1825 questions
28
votes
7 answers

Angular Error: 'Component 'X' is not included in a module...' when declared in a sub module

I'm trying to consolidate my dialogs into an Angular module, but I'm getting a linting error in the IDE: Component 'X' is not included in a module and will not be available inside a template. Consider adding it to an NgModule…
rawkfist0215
  • 1,445
  • 6
  • 21
  • 34
28
votes
14 answers

"auth_client_using_bad_version_title" is translated here but not found in default locale

I'm forced to use Google Play service (I need Location Service). So, after I wrote all code and tested application on device, i tried to export signed application. And all I got is Lint errors like (I even changed MissingTranslation erros in Lint…
solveMe
  • 1,866
  • 1
  • 18
  • 20
28
votes
1 answer

Error Linting URL: An internal error occurred while linting the URL

How to debug the facebook debugger? Detailed description of the problem: I use the "Open Graph Protocol In Posts and Pages" plugin to manually enter OG data for the posts on my self-hosted wordpress site. Before sharing them on Facebook, I test the…
vabsh
  • 309
  • 3
  • 4
27
votes
4 answers

Warning : Use SwitchCompat from AppCompat or SwitchMaterial from Material library

What is the difference between these 2 objects (SwitchCompat and SwitchMaterial)? I have tried them and visually they are identical. By the way, why did they remove the Switch class? Do you know which UI element is supposed to replace it in the…
27
votes
3 answers

TSLint not working in VS Code

I added TSLint to my React/TypeScript project using the tslint VSCode extension. I also installed both typescript and tslint globally according to TSLint docs npm install -g tslint typescript This is my tslint.json file: { "extends":…
blankface
  • 5,757
  • 19
  • 67
  • 114
27
votes
3 answers

Difference between running lint via Android Studio menu and gradlew command-line

When I run the following on a command line: ./gradlew -lint I get different results than if I choose the following menu option within Android Studio. Analyze->Inspect Code... Can anyone explain this? Is this normal? Should a prudent developer…
gonzobrains
  • 7,856
  • 14
  • 81
  • 132
26
votes
1 answer

What does "@extend must be used with a %placeholder" mean?

While linting the following SASS statements, I get @extend must be used with a %placeholder warning. .reg-text { color: #202226; font-family: $font-page; font-size: 17px; line-height: 25px; } .reg-text-header { @extend .reg-text; …
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
26
votes
4 answers

Ignore several warnings in Android lint

I know I can ignore a rule in Lint with attribute tools:ignore My difficulty is that I want to ignore several rules. In my case, for Google analytics ga_trackingId, I want to ignore TypographyDashes and MissingTranslation I tried with no…
rds
  • 26,253
  • 19
  • 107
  • 134
25
votes
7 answers

How do I get a Java maven build to fail for compiler warnings?

I am trying: org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 …
simbo1905
  • 6,321
  • 5
  • 58
  • 86
25
votes
4 answers

Can't fully disable python linting Pylance VSCODE

I've been searching online for quite a while now and can't seem to find a solution for my problem. I installed Pylance (the newest Microsoft interpreter for Python) and can't seem to disable linting at all. I've tried a lot of options but none…
TheNomad
  • 293
  • 1
  • 3
  • 10
25
votes
2 answers

Can Rust's clippy do autocorrection / autofix?

Is it possible to run cargo clippy with an option so it will fix warnings automatically? From the help message, it does not look like this option is supported at the moment.
Sergey Potapov
  • 3,819
  • 3
  • 27
  • 46
24
votes
5 answers

Is there a lint for Common Lisp or Chicken Scheme?

Is there a lint for Common Lisp or Chicken Scheme? Possibly something akin to C's splint, Haskell's HLint, Perl's B::Lint, etc.?
mcandre
  • 22,868
  • 20
  • 88
  • 147
24
votes
4 answers

Lint-like program for Perl?

I'm looking for a lint for Perl, something that would catch dead code and other potential problems. Any suggestions? I have use strict; use warnings; already but I'd like to have more.
Charles
  • 11,269
  • 13
  • 67
  • 105
24
votes
3 answers

Pylint not running as expected in VScode

When I am running via shell a pylint: $ pylint decorator.py No config file found, using default configuration ************* Module decorator C: 7, 0: Unnecessary parens after 'print' keyword (superfluous-parens) C: 15, 0: Unnecessary parens after…
pkaramol
  • 16,451
  • 43
  • 149
  • 324
24
votes
2 answers

Android Studio Lint check for Unnecessary Module Dependency

When running a Lint check on files in my project I often come across an error that looks like this (actual names of files redacted, but you'll get the idea): Dependency from module 'name_of_my_project' on module 'some_3rd_party_library' could be…
Jon
  • 7,941
  • 9
  • 53
  • 105