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
0
votes
0 answers

How do I stop Android Studio from warning about null checks on @NonNull parameters?

I usually code stuff like this: public void myMethod(@NonNull String sName) { //noinspection ConstantConditions if (sName == null) { throw new IllegalArgumentException("Name argument cannot be null"); } [...] } I want…
Reaper
  • 486
  • 3
  • 12
0
votes
1 answer

Does Android Studio have an option to automatically scan inactive tabs for errors/warnings/lint etc?

I would like to be able to have all tabs to automatically scan lint and other warnings while they are inactive. Currently, only the active tab will load. But I prefer Android Studio to load all the tabs while I am away alt tabbed or doing other…
poetryrocksalot
  • 697
  • 2
  • 10
  • 19
0
votes
1 answer

'babel-eslint' was not found. Error: ESLint configuration of processor in '.eslintrc.json#overrides[0]' is invalid

I have a eslint config file .eslintrc.json (could be .eslintrc) like this: { "env": { "browser": true, "es6": true }, "extends": [ "eslint:recommended", "plugin:react/recommended", …
Roman
  • 19,236
  • 15
  • 93
  • 97
0
votes
0 answers

Android Lint not detect UnusedAttribute

In an empty project(create from new project),Android Studio can not detect lint issue "UnusedAttribute", neither code editor display hint or run Ananlyze manually(the item is checked). And there is no lint.xml or lint config in build.gradle file in…
0
votes
0 answers

jshint --version command not be found by proc_open

I have been figuring out the installation of archanist with linters on my Windows 8.2 (64 bit) system. I ran into problem during arc diff, when it said (over git bash, I was using): EXCEPTION: (PhutilAggregateException) Some linters failed: -…
Shashish Chandra
  • 489
  • 2
  • 5
  • 20
0
votes
0 answers

FAILURE when trying to Build APK

I'm trying to build an APK (unsigned). Each time i get the following error FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'Project Name'. > Could not resolve all artifacts for…
petrrr33
  • 583
  • 9
  • 24
0
votes
1 answer

es lint --fix only supresses the error and doesnt fix

Trying to solve linting issues installed npm eslint in vs code editor ,then tried eslint --fix but es lint --fix only supresses the error and doesnt fix it completely,is there any npm command or a way to fix all the linting errors ,apart from…
Puja
  • 101
  • 3
  • 14
0
votes
1 answer

Angular 8 - ng lint: Error in Maximum call stack size exceeded

I have a problem with linting my project. Everytime I use "ng lint" following error appears: $ ng lint Linting "app"... An unhandled exception occurred: Maximum call stack size exceeded See…
0
votes
0 answers

Android: "Unchecked or unsafe operations" Lint warning

Android Lint is giving a warning as "Uses unchecked or unsafe operations" and I can't understand why and how to get rid of it without suppressing warnings. In this next piece of code ... AppSettings appSettings = AppSettings.getInstance(); int…
Diego Perez
  • 2,188
  • 2
  • 30
  • 58
0
votes
1 answer

img onError event returns linting warning 'Non-interactive elements should not be assigned mouse or keyboard event listeners'

I keep the receiving an linting warning when using the 'onerror' event on img. Any thoughts on how to resolve this? Error: Non-interactive elements should not be assigned mouse or keyboard event listeners jsx: const handlerErrorNoImage = (event) =>…
user992731
  • 3,400
  • 9
  • 53
  • 83
0
votes
0 answers

eslint role for empty line in start of function or arrow function

There are a lot of options in the padding-line-between-statements role, but I can't find a role that forces this code: const app = express() app.use('/', (req, res) => { const x = req.body return x }) To be with an empty line after…
baruchiro
  • 5,088
  • 5
  • 44
  • 66
0
votes
1 answer

What is wrong with my eslintrc parser options? SyntaxError: Unexpected token ':'

{ "parserOptions" : { "ecmaVersion": 2017 }, "env": { "browser": true, "node": true, "es6": true }, } module.exports = { "extends": "plugin:prettier/recommended" }; When I try eslint test.js I got…
Richard Rublev
  • 7,718
  • 16
  • 77
  • 121
0
votes
1 answer

Android Studio is not marking the use of unavailable methods for the minSdkVersion as an error (Issue id: NewApi)

Possibly relevant info: NewApi lint rule is enabled and marked as error as shown below minSdkVersion is set to 21 Android Gradle Plugin version is 3.6.3 Android Studio version is 3.6.3 Project uses Kotlin I expect the IDE to mark the usage of an…
0
votes
1 answer

ESLint Double Quotes in double quotes

I am using ESLint to format my Javascript code. There I have the following piece of code: '
user1728
  • 103
  • 2
0
votes
1 answer

tslint and prettier conflict use tslint rules

I have prettier and tslint configured. However it seems prettier overrides the tslint rules. I can disable some of the rules using .prettierrc. However I'm still having issues. I want the tslint.json /exceptions to take precedence over…
MonteCristo
  • 1,471
  • 2
  • 20
  • 41
1 2 3
99
100