Coala设置¶
coala provides a common command-line interface for linting and fixing all your code, regardless of the programming languages you use.
To find out what kind of analysis coala offers for the languages you use, visit http://coala.io/languages, or run:
$ coala --show-bears --filter-by language C Python
To perform code analysis, simply specify the analysis routines (bears) and the files you want it to run on, for example:
spaceBear:
$ coala --bears SpaceConsistencyBear --files **.py
coala can also automatically fix your code:
spacePatchBear:
$ coala --bears SpaceConsistencyBear --files **.py --apply-patches
To run coala without user interaction, run the coala --non-interactive, coala --json and coala --format commands.
usage: coala [-h] [-v] [-C] [--ci] [--json] [--format [STR]] [-c FILE] [-F] [-I] [-s [FILE]] [--disable-caching] [--flush-cache] [--no-autoapply-warn] [-b NAME [NAME ...]]
[-f FILE [FILE ...]] [-i FILE [FILE ...]] [--limit-files FILE [FILE ...]] [-d DIR [DIR ...]] [-V] [-L ENUM] [-m ENUM] [-N] [-B] [-l LANG [LANG ...]]
[--filter-by FILTER_NAME FILTER_ARG [FILTER_ARG ...]] [-p LANG [LANG ...]] [-D] [--show-settings] [--show-details] [--log-json] [-o FILE] [-r [RELPATH]]
[--debug-bears [DEBUG_BEARS] | --profile [PROFILE]] [-S SETTING [SETTING ...]] [-a] [-j JOBS] [-n] [-A] [--debug]
[TARGETS ...]
Positional Arguments¶
- TARGETS
sections to be executed exclusively
Named Arguments¶
- --debug-bears
Enable bear debugging with pdb, that can help to identify and correct errors in bear code. Steps into bear code as soon as being executed. To specify which bears to debug, supply bear names as additional arguments. If used without arguments, all bears specified with --bears will be debugged (even implicit dependency bears).
- --profile
Enable bear profiling with cProfile. To specify where to dump the profiled files, supply the directory path. If specified directory does not exist it will be created. If the specified path points to an already existing file a error is raised. All bears (even implicit dependency bears) in a section will be profiled. Profiled data files will have a name format
{section.name}_{bear.name}.prof
.
Info¶
- -v, --version
show program's version number and exit
Mode¶
- -C, --non-interactive
run coala in non interactive mode
- --ci
continuous integration run, alias for --non-interactive
- --json
mode in which coala will display output as json
- --format
output results with a custom format string, e.g. "Message: {message}"; possible placeholders: id, origin, file, line, end_line, column, end_column, severity, severity_str, message, message_base, message_arguments, affected_code, source_lines
Configuration¶
- -c, --config
configuration file to be used, defaults to .coafile
- -F, --find-config
find .coafile in ancestors of the working directory
- -I, --no-config
run without using any config file
- -s, --save
save used arguments to a config file to a .coafile, the given path, or at the value of -c
- --disable-caching
run on all files even if unchanged
- --flush-cache
rebuild the file cache
- --no-autoapply-warn
turn off warning about patches not being auto applicable
Inputs¶
- -b, --bears
names of bears to use
- -f, --files
files that should be checked
- -i, --ignore
files that should be ignored
- --limit-files
filter the --files argument's matches further
- -d, --bear-dirs
additional directories which may contain bears
Outputs¶
- -V, --verbose
alias for -L DEBUG
- -L, --log-level
Possible choices: ERROR, INFO, WARNING, DEBUG
set log output level to DEBUG/INFO/WARNING/ERROR, defaults to INFO
- -m, --min-severity
Possible choices: INFO, NORMAL, MAJOR
set minimal result severity to INFO/NORMAL/MAJOR
- -N, --no-color
display output without coloring (excluding logs)
- -B, --show-bears
list all bears
- -l, --filter-by-language
filters --show-bears by the given languages
- --filter-by
filters --show-bears by the filter given as argument. Available filters: can_detect, can_fix, language, section_tags
- -p, --show-capabilities
show what coala can fix and detect for the given languages
- -D, --show-description
show bear descriptions for --show-bears
- --show-settings
show bear settings for --show-bears
- --show-details
show bear details for --show-bears
- --log-json
output logs as json along with results (must be called with --json)
- -o, --output
write results to the given file (must be called with --json)
- -r, --relpath
return relative paths for files (must be called with --json)
Miscellaneous¶
- -S, --settings
arbitrary settings in the form of section.key=value
- -a, --apply-patches
apply all patches automatically if possible
- -j, --jobs
number of jobs to use in parallel
- -n, --no-orig
don't create .orig backup files before patching
- -A, --single-action
apply a single action for all results
- --debug
run coala in debug mode, starting ipdb, which must be separately installed, on unexpected internal exceptions (implies --verbose)