git_diff
Git diff checks for git conflicts markers in files
git_diff documentation
- Version in MegaLinter: 2.30.3
- Visit Official Web Site
Configuration in MegaLinter
- Enable git_diff by adding
GIT_GIT_DIFF
in ENABLE_LINTERS variable - Disable git_diff by adding
GIT_GIT_DIFF
in DISABLE_LINTERS variable
Variable | Description | Default value |
---|---|---|
GIT_GIT_DIFF_ARGUMENTS | User custom arguments to add in linter CLI call Ex: -s --foo "bar" |
|
GIT_GIT_DIFF_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".py", ""] |
Exclude every file |
GIT_GIT_DIFF_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 |
GIT_GIT_DIFF_PRE_COMMANDS | List of bash commands to run before the linter | None |
GIT_GIT_DIFF_POST_COMMANDS | List of bash commands to run after the linter | None |
GIT_GIT_DIFF_DISABLE_ERRORS | Run linter but consider errors as warnings | false |
GIT_GIT_DIFF_DISABLE_ERRORS_IF_LESS_THAN | Maximum number of errors allowed | 0 |
MegaLinter Flavours
This linter is available in the following flavours
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default MegaLinter Flavor | 97 | ||
ci_light | Optimized for CI items (Dockerfile, Jenkinsfile, JSON/YAML schemas,XML | 16 | ||
dart | Optimized for DART based projects | 42 | ||
documentation | MegaLinter for documentation projects | 41 | ||
dotnet | Optimized for C, C++, C# or VB based projects | 49 | ||
go | Optimized for GO based projects | 43 | ||
java | Optimized for JAVA based projects | 43 | ||
javascript | Optimized for JAVASCRIPT or TYPESCRIPT based projects | 50 | ||
php | Optimized for PHP based projects | 46 | ||
python | Optimized for PYTHON based projects | 49 | ||
ruby | Optimized for RUBY based projects | 42 | ||
rust | Optimized for RUST based projects | 42 | ||
salesforce | Optimized for Salesforce based projects | 44 | ||
scala | Optimized for SCALA based projects | 42 | ||
swift | Optimized for SWIFT based projects | 42 | ||
terraform | Optimized for TERRAFORM based projects | 47 |
Behind the scenes
How are identified applicable files
- If this linter is active, all files will always be linted
How the linting is performed
git_diff is called once on the whole project directory
- filtering can not be done using MegaLinter configuration variables,it must be done using git_diff configuration or ignore file (if existing)
VALIDATE_ALL_CODEBASE: false
does not make git_diff analyze only updated files
Example calls
git diff --check
Help content
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
restore Restore working tree files
rm Remove files from the working tree and from the index
sparse-checkout Initialize and modify the sparse-checkout
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
diff Show changes between commits, commit and working tree, etc
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
grow, mark and tweak your common history
branch List, create, or delete branches
commit Record changes to the repository
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
reset Reset current HEAD to the specified state
switch Switch branches
tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system.
Installation on mega-linter Docker image
Example success log
Results of git_diff linter (version 2.26.2)
See documentation on https://megalinter.github.io/descriptors/git_git_diff/
-----------------------------------------------
[SUCCESS] .automation/test/git_diff/good