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

Exclude the reference library project folder in LINT with angular 10

I am trying to exclude the reference library project files while running the command npm run lint, but it is not working for me. In the main application, I have added these code in the angular.json Angular.json "lint": { "builder":…
San Jaisy
  • 15,327
  • 34
  • 171
  • 290
0
votes
1 answer

php 7.4 auto format typed properties in sublime text 3

I use Sublime Text 3 and CodeFormatter plugin to auto format my PHP on save. Recently I updated to PHP 7.4 which introduces typed properties: class Person { private string $name; private int $age; } Unfortunately CodeFormatter doesn't handle…
Alan P.
  • 2,898
  • 6
  • 28
  • 52
0
votes
0 answers

How to run linter on PR in GitHub?

Project is written in typescript. Pre-commit hooks are implemented with husky. (They only work if husky is installed locally) Is there a way to prevent merge of PR if lint error exists?
you_me_on
  • 61
  • 1
  • 8
0
votes
1 answer

PHPLint ERROR: property `SimpleXMLElement::$error' does not exist or not visible

All, I'm using PHPLint to evaluate a PHP script I'm writing, and it returns the following error: "ERROR: property `SimpleXMLElement::$error' does not exist or not visible". The code referred to looks like this: $this->_xmlResponse = new…
North Krimsly
  • 879
  • 4
  • 18
  • 33
0
votes
2 answers

Run ansible-lint through subdirectories within a gitlab role

I am trying to add a validation step to a gitlab repo holding a single ansible role (with no playbook). The structure of the role looks like : .gitlab-ci.yml tasks/ templates/ files/ vars/ handlers/ With the gitlab-ci looking like : stages: -…
Marvin
  • 1,650
  • 4
  • 19
  • 41
0
votes
1 answer

Lint Fix add method inside a UClass

I am currently writing a custom lint for a library I made and I've implemented most of the stuff. The thing which is bugging me is how to create quickDataFix to add a method in a UClass. So for eg: I have the following code where the LintFix will be…
kaustubhpatange
  • 442
  • 5
  • 13
0
votes
0 answers

Android lint shows UnusedIds after converting findViewById to kotlin synthetic

I converted findViewById to kotlin synthetic after I did that I get the below error. But everything works the same. I have the exact issue before in fragment. In there I solve it by accessing the id after the onCreateView() i.e onViewCreated(). here…
gouri panda
  • 312
  • 2
  • 11
0
votes
1 answer

lint issue - typescript - non arrow functions are forbidden

Following is some code and we are facing lint issues:- export function TakeUntilDestroy(destroyMethodName = 'ngOnDestroy') { return function (constructor: T) { // some code } } I am getting two…
ShareYourExp
  • 11
  • 1
  • 1
  • 5
0
votes
0 answers

Facing Linting Issue with class decorator

Refer the following code which I have taken from NET for auto subscribing: export function AutoUnsub() { return function (constructor: any) { const orig = constructor.prototype.ngOnDestroy; constructor.prototype.ngOnDestroy = function ()…
ShareYourExp
  • 11
  • 1
  • 1
  • 5
0
votes
1 answer

Unsafe use of expression any on header object

So i'm having the no-unsafe-any linting error on Typescript when trying to get a custom header from my header variable. It is defined in this interface: export interface AxiosResponse { data: T; status: number; statusText:…
JustAJavaUser
  • 89
  • 2
  • 9
0
votes
0 answers

How to fix import/order error with tslint's

I have the following imports in my file nodejs: import config from 'config'; import { PassportStatic } from 'passport'; import rootPath from './handlers/rootPath'; import SSOCallback from './handlers/SSOCallback'; import authFailure from…
0
votes
1 answer

Is there a popular way to note types of variables and function arguments in Lua?

I'm finding a way to note types variables and function arguments in Lua. Is there a way? And any LINT-like tool to check those types?
eonil
  • 83,476
  • 81
  • 317
  • 516
0
votes
2 answers

how do I know what version of gjslint I have installed?

This may be a dumb question, but I cannot figure it out. Doing gjslint --help does not provide the answer, and --version is not a valid flag. Any ideas?
pocketfullofcheese
  • 8,427
  • 9
  • 41
  • 57
0
votes
1 answer

StandardJS not recognising array.push() as reassignment

I've declared an empty array before a loop that then gets populated as the loop runs. My code works fine but when I lint using StandardJS it tells me that the array is never reassigned and should be declared as a const. If i did this then I wouldn't…
LucasGracia
  • 125
  • 11
0
votes
0 answers

YamlDotNet linter validation when importing

I am importing a yaml file from my system directory. I want to validate for linter issues before Deserializing the yaml. Is there any nuget which i can use to perform the lint validation?? Does YamlDotNet provide a lint validator
Vinay
  • 259
  • 4
  • 19
1 2 3
99
100