Skip to content

dotnet-format

dotnet-format documentation

format - GitHub

Configuration in Mega-Linter

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_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".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_DISABLE_ERRORS Run linter but consider errors as warnings true

Mega-Linter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default Mega-Linter Flavor 83 Docker Image Size (tag) Docker Pulls
dotnet Optimized for C, C++, C# or VB based projects 42 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .vb

Example calls

dotnet-format --folder --check --exclude / --include myfile.vb
dotnet-format --folder --exclude / --include myfile.vb

Help content

dotnet-format:

  dotnet-format

Usage:

  dotnet-format
  [options]
  [<project>]

Arguments:
  <project>
               The
               solution
               or
               project
               file
               to
               operate
               on.
               If
               a
               file
               is
               not
               specified,
               the
               command
               will
               search
               the
               current
               directory
               for
               one.

Options:
  -f, --folder <folder>
                                  Whether
                                  to
                                  treat
                                  the
                                  `<project>`
                                  path
                                  as
                                  a
                                  folder
                                  of
                                  files.
                                  [default:
                                  ]
  --files, --include <include>
                                  A
                                  list
                                  of
                                  relative
                                  file
                                  or
                                  folder
                                  paths
                                  to
                                  include
                                  in
                                  formatting.
                                  All
                                  files
                                  are
                                  formatted
                                  if
                                  empty.
                                  [default:
                                  System.String[]]
  --exclude <exclude>
                                  A
                                  list
                                  of
                                  relative
                                  file
                                  or
                                  folder
                                  paths
                                  to
                                  exclude
                                  from
                                  formatting.
                                  [default:
                                  System.String[]]
  --check, --dry-run
                                  Formats
                                  files
                                  without
                                  saving
                                  changes
                                  to
                                  disk.
                                  Terminates
                                  with
                                  a
                                  non-zero
                                  exit
                                  code
                                  if
                                  any
                                  files
                                  were
                                  formatted.
  --report <report>
                                  Accepts
                                  a
                                  file
                                  path,
                                  which
                                  if
                                  provided,
                                  will
                                  produce
                                  a
                                  json
                                  report
                                  in
                                  the
                                  given
                                  directory.
                                  [default:
                                  ]
  -v, --verbosity <verbosity>
                                  Set
                                  the
                                  verbosity
                                  level.
                                  Allowed
                                  values
                                  are
                                  q[uiet],
                                  m[inimal],
                                  n[ormal],
                                  d[etailed],
                                  and
                                  diag[nostic]
  --version
                                  Show
                                  version
                                  information
  -?, -h, --help
                                  Show
                                  help
                                  and
                                  usage
                                  information

Installation on mega-linter Docker image

None

Example success log

Results of dotnet-format linter (version 4.1.131201)
See documentation on https://nvuillam.github.io/mega-linter/descriptors/vbdotnet_dotnet_format/
-----------------------------------------------

[SUCCESS] .automation/test/vbdotnet/vbdotnet_good_1.vb
      Formatting code files in workspace '.automation/test/vbdotnet'.
      Format complete in 1063ms.

Example error log

Results of dotnet-format linter (version 4.1.131201)
See documentation on https://nvuillam.github.io/mega-linter/descriptors/vbdotnet_dotnet_format/
-----------------------------------------------

[ERROR] .automation/test/vbdotnet/vbdotnet_bad_1.vb
      Formatting code files in workspace '.automation/test/vbdotnet'.
      vbdotnet/vbdotnet_bad_1.vb(4,4): Fix whitespace formatting.
      vbdotnet/vbdotnet_bad_1.vb(4,20): Fix whitespace formatting.
      vbdotnet/vbdotnet_bad_1.vb(5,7): Fix whitespace formatting.
      Formatted code file '.automation/test/vbdotnet/vbdotnet_bad_1.vb'.
      Format complete in 1188ms.