Skip to content

revive

revive documentation

revive - GitHub

Configuration in Mega-Linter

Variable Description Default value
GO_REVIVE_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
GO_REVIVE_FILTER_REGEX_INCLUDE Custom regex including filter
Ex: (src|lib)
Include every file
GO_REVIVE_FILTER_REGEX_EXCLUDE Custom regex excluding filter
Ex: (test|examples)
Exclude no file
GO_REVIVE_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
[".go"]
GO_REVIVE_FILE_NAMES_REGEX File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files
Ex: ["Dockerfile(-.+)?", "Jenkinsfile"]
Include every file
GO_REVIVE_CONFIG_FILE revive configuration file name
Use LINTER_DEFAULT to let the linter find it
revive.toml
GO_REVIVE_RULES_PATH Path where to find linter configuration file Workspace folder, then Mega-Linter default rules
GO_REVIVE_DISABLE_ERRORS Run linter but consider errors as warnings false
GO_REVIVE_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0

IDE Integration

Use revive in your favorite IDE to catch errors before Mega-Linter !

IDE Extension Name Install
Atom linter-revive Visit Web Site
vim ale Visit Web Site
Visual Studio Code vscode.Go Install in VsCode

Mega-Linter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default Mega-Linter Flavor 84 Docker Image Size (tag) Docker Pulls
go Optimized for GO based projects 39 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .go

Example calls

revive myfile.go
revive -config myfile.go

Help content


 _ __ _____   _(_)__  _____
| '__/ _ \ \ / / \ \ / / _ \
| | |  __/\ V /| |\ V /  __/
|_|  \___| \_/ |_| \_/ \___|

Example:
  revive -config c.toml -formatter friendly -exclude a.go -exclude b.go ./...

Usage of revive:
  -config string
      path to the configuration TOML file, defaults to $HOME/revive.toml, if present (i.e. -config myconf.toml)
  -exclude value
      list of globs which specify files to be excluded (i.e. -exclude foo/...)
  -formatter string
      formatter to be used for the output (i.e. -formatter stylish)

Installation on mega-linter Docker image

  • Dockerfile commands :
RUN go get -u github.com/mgechev/revive