Skip to content

ls-lint

GitHub stars GitHub release (latest SemVer) GitHub last commit GitHub commit activity GitHub contributors

ls-lint documentation

ls-lint - GitHub

Configuration in MegaLinter

Variable Description Default value
REPOSITORY_LS_LINT_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
REPOSITORY_LS_LINT_COMMAND_REMOVE_ARGUMENTS User custom arguments to remove from command line before calling the linter
Ex: -s --foo "bar"
REPOSITORY_LS_LINT_CLI_LINT_MODE Override default CLI lint mode
⚠️ As default value is project, overriding might not work
- file: Calls the linter for each file
- list_of_files: Call the linter with the list of files as argument
- project: Call the linter from the root of the project
project
REPOSITORY_LS_LINT_PRE_COMMANDS List of bash commands to run before the linter None
REPOSITORY_LS_LINT_POST_COMMANDS List of bash commands to run after the linter None
REPOSITORY_LS_LINT_UNSECURED_ENV_VARIABLES List of env variables explicitly not filtered before calling REPOSITORY_LS_LINT and its pre/post commands None
REPOSITORY_LS_LINT_CONFIG_FILE ls-lint configuration file nameUse LINTER_DEFAULT to let the linter find it .ls-lint.yml
REPOSITORY_LS_LINT_RULES_PATH Path where to find linter configuration file Workspace folder, then MegaLinter default rules
REPOSITORY_LS_LINT_DISABLE_ERRORS Run linter but consider errors as warnings false
REPOSITORY_LS_LINT_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0
REPOSITORY_LS_LINT_CLI_EXECUTABLE Override CLI executable ['ls-lint']

MegaLinter Flavors

This linter is available in the following flavors

Flavor Description Embedded linters Info
all Default MegaLinter Flavor 124 Docker Image Size (tag) Docker Pulls
c_cpp Optimized for pure C/C++ projects 54 Docker Image Size (tag) Docker Pulls
ci_light Optimized for CI items (Dockerfile, Jenkinsfile, JSON/YAML schemas,XML 21 Docker Image Size (tag) Docker Pulls
cupcake MegaLinter for the most commonly used languages 84 Docker Image Size (tag) Docker Pulls
documentation MegaLinter for documentation projects 49 Docker Image Size (tag) Docker Pulls
dotnet Optimized for C, C++, C# or VB based projects 62 Docker Image Size (tag) Docker Pulls
dotnetweb Optimized for C, C++, C# or VB based projects with JS/TS 71 Docker Image Size (tag) Docker Pulls
go Optimized for GO based projects 51 Docker Image Size (tag) Docker Pulls
java Optimized for JAVA based projects 53 Docker Image Size (tag) Docker Pulls
javascript Optimized for JAVASCRIPT or TYPESCRIPT based projects 59 Docker Image Size (tag) Docker Pulls
php Optimized for PHP based projects 54 Docker Image Size (tag) Docker Pulls
python Optimized for PYTHON based projects 62 Docker Image Size (tag) Docker Pulls
ruby Optimized for RUBY based projects 50 Docker Image Size (tag) Docker Pulls
rust Optimized for RUST based projects 50 Docker Image Size (tag) Docker Pulls
salesforce Optimized for Salesforce based projects 54 Docker Image Size (tag) Docker Pulls
swift Optimized for SWIFT based projects 50 Docker Image Size (tag) Docker Pulls
terraform Optimized for TERRAFORM based projects 54 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • Activated only if one of these files is found: .ls-lint.yml
  • If this linter is active, all files will always be linted

How the linting is performed

ls-lint is called once on the whole project directory (project CLI lint mode)

  • filtering can not be done using MegaLinter configuration variables,it must be done using ls-lint configuration or ignore file (if existing)
  • VALIDATE_ALL_CODEBASE: false doesn't make ls-lint analyze only updated files

Example calls

ls-lint
ls-lint --workdir src

Help content

Usage of /node-deps/node_modules/@ls-lint/ls-lint/bin/ls-lint-linux-amd64:
  -config value
      ls-lint config file path(s)
  -debug
      write debug informations to stdout
  -version
      prints version information for ls-lint
  -warn
      write lint errors to stdout instead of stderr (exit 0)
  -workdir string
      change working directory before executing the given subcommand (default ".")

Installation on mega-linter Docker image