Configuration
The Bronto refactoring tool can be configured via a .brontorc file. By default a .brontorc file
will be looked for in the current working directory from which the tool is run, looking in
successive parent directories until a file by that name is found.
Alternatively, one can pass --config=/path/to/my/.brontorc to choose a configuration file
explicitly.
The .brontorc file uses the TOML file format with the following schema.
Fields
files
An ordered list of FileConstraints defining which file paths the tool is allowed to generate
edits for. Constraints are processed sequentially, meaning that the last matching constraint is the
one used. For example:
files = [
{ include = "**" }, # Match all files
{ exclude = "private/**" }, # ... but not the private ones
{ exclude = "hidden/**" }, # ... or the hidden
{ include = "hidden/important/**" }, # ... unless they're important.
]If unspecified, the default of
files = [
{ include = "**" },
]will be assumed.
clang-format
An object of type ClangFormatSpec responsible for defining how clang-format
is invoked on generated edits. Below are several examples:
# Use the GNU style
[clang-format]
executable = "path/to/clang-format"
style = "gnu"# Use my special style
[clang-format.style]
path = "path/to/my/.clang-format"# Lookup a .clang-format in an ancestor directory of each modified file,
# or use mozilla as a fallback.
[clang-format.style]
fallback = "mozilla"clang-format.executable
A string representing the path of a clang-format executable to be used to do the
formatting. If unspecified, formatting will still occur but with an unspecified clang-format
implementation.
clang-format.style
Either, a string representing a named style built in to clang-format, or an object of
type PathClangFormatStyle. The options
available for a named style are "chromium", "gnu", "google", "llvm", "microsoft", "mozilla", and "webkit".
If no style is provided, a default PathClangFormatStyle will be assumed.
clang-format.style.path
The location of YAML file used for formatting. If unspecified, for each modified file, a
file named .clang-format will be searched for in successive ancestor directories of the file
being modified until such a file is found. If no such file is found, the fallback style will be used.
clang-format.style.fallback
In the event that clang-format.style.path did not describe a valid
YAML file, this is the builtin named style that will be used for formatting. If not provided, an
unspecified default will be chosen.
Types
ClangFormatSpec
A ClangFormatSpec has two fields that control how clang-format is executed. Both are optional.
executable: A string representing the path of aclang-formatexecutable to be used to do the formatting. If unspecified, formatting will still occur but with an unspecified clang-format implementation.style: Either, a string representing a named style built in to clang-format, or an object of typePathClangFormatStyle. The options available for a named style are "chromium", "gnu", "google", "llvm", "microsoft", "mozilla", and "webkit". If no style is provided, a defaultPathClangFormatStylewill be assumed (as described in that section).
PathClangFormatStyle
An object representing a clang-format style specified via a YAML style file. This object has two
fields which are both optional: path and
fallback.
FileConstraint
A file constraint is an object that holds exactly one of the fields include or exclude. The
field is a glob determining which files should be included or excluded (respectively) from the list
of edited files.