dotnet-format
dotnet-format requires a .sln
or .vbproj
file to run correctly.
dotnet-format documentation
- Version in MegaLinter: 6.0.407
- Visit Official Web Site
Configuration in MegaLinter
- Enable dotnet-format by adding
VBDOTNET_DOTNET_FORMAT
in ENABLE_LINTERS variable - Disable dotnet-format by adding
VBDOTNET_DOTNET_FORMAT
in DISABLE_LINTERS variable
- Enable auto-fixes by adding
VBDOTNET_DOTNET_FORMAT
in APPLY_FIXES variable
Variable | Description | Default value |
---|---|---|
VBDOTNET_DOTNET_FORMAT_ARGUMENTS | User custom arguments to add in linter CLI call Ex: -s --foo "bar" |
|
VBDOTNET_DOTNET_FORMAT_FILTER_REGEX_INCLUDE | Custom regex including filter Ex: (src\|lib) |
Include every file |
VBDOTNET_DOTNET_FORMAT_FILTER_REGEX_EXCLUDE | Custom regex excluding filter Ex: (test\|examples) |
Exclude no file |
VBDOTNET_DOTNET_FORMAT_CLI_LINT_MODE | Override default CLI lint mode - file : Calls the linter for each file- project : Call the linter from the root of the project |
file |
VBDOTNET_DOTNET_FORMAT_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".py", ""] |
[".vb"] |
VBDOTNET_DOTNET_FORMAT_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 |
VBDOTNET_DOTNET_FORMAT_PRE_COMMANDS | List of bash commands to run before the linter | None |
VBDOTNET_DOTNET_FORMAT_POST_COMMANDS | List of bash commands to run after the linter | None |
VBDOTNET_DOTNET_FORMAT_DISABLE_ERRORS | Run linter but consider errors as warnings | true |
VBDOTNET_DOTNET_FORMAT_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 | 114 | ||
dotnet | Optimized for C, C++, C# or VB based projects | 60 |
Behind the scenes
How are identified applicable files
- File extensions:
.vb
How the linting is performed
- dotnet-format is called one time by identified file (
file
CLI lint mode)
Example calls
dotnet format {{WORKSPACE}} --verify-no-changes
dotnet format {{WORKSPACE}}
Help content
Description:
Formats code to match editorconfig settings.
Usage:
dotnet-format [<The project or solution file to operate on. If a file is not specified, the command will search the current directory for one.>] [command] [options]
Arguments:
<The project or solution file to operate on. If a file is not specified, the command will search the current directory for one.> The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. [default: /]
Options:
--diagnostics <diagnostics> A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. []
--exclude-diagnostics <exclude-diagnostics> A space separated list of diagnostic ids to ignore when fixing code style or 3rd party issues. []
--severity <error|info|warn> The severity of diagnostics to fix. Allowed values are info, warn, and error.
--no-restore Doesn't execute an implicit restore before formatting.
--verify-no-changes Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted.
--include <include> A list of relative file or folder paths to include in formatting. All files are formatted if empty. []
--exclude <exclude> A list of relative file or folder paths to exclude from formatting. []
--include-generated Format files generated by the SDK.
-v, --verbosity <d|detailed|diag|diagnostic|m|minimal|n|normal|q|quiet> Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]
--binarylog <binary-log-path> Log all project or solution load information to a binary log file.
--report <report-path> Accepts a file path which if provided will produce a json report in the given directory.
--version Show version information
-?, -h, --help Show help and usage information
Commands:
whitespace <The project or solution file to operate on. If a file is not specified, the command will search the current directory for one.> Run whitespace formatting. [default: /]
style <The project or solution file to operate on. If a file is not specified, the command will search the current directory for one.> Run code style analyzers and apply fixes. [default: /]
analyzers <The project or solution file to operate on. If a file is not specified, the command will search the current directory for one.> Run 3rd party analyzers and apply fixes. [default: /]