m ci celt¶
Process a compiler or linter output to determine if the cli should stop.
Examples¶
~$ m ci celt -t eslint -c @config.json < <(eslint [dir] -f json)
~$ eslint [...options] > tmp.json
~$ m ci celt -t eslint @tmp.json -c '{"allowedEslintRules":{"semi":1}}'
Depending on the tool that is chosen the configuration should have an
entry of the form "allowed[ToolName]Rules"
or "ignored[ToolName]Rules"
.
Only the first letter of the tool should be capitalized to conform to
the camel case style.
The entry should define a map of rule ids to the number of allowed
violations. In the case of ignored[ToolName]Rules
we may define
the rule id and assign an explanation as to why its being ignored.
In the examples above we use @config.json
. This means it
will read the file config.json
. You can use any file that you want.
One option is to use eslintrc.json or create a brand new file called
allowed_errors.json
.
Tools¶
Each tool may provide have different outputs
eslint¶
Should be called with the -f json
option.
pycodestyle¶
Should be called with the --format=default
option.
flake8¶
Expects default output.
pylint¶
Should be called with the -f json
option.
typescript¶
Should be called with the --pretty false
option.
ruff¶
Should be called with the --format json
option.
Source code in m/cli/commands/ci/celt.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
Required arguments¶
-t
, --tool
¶
name of a supported compiler/linter
Options¶
-c
, --config
¶
- default:
'{}'
config data: @filename (file), string
-m
, --max-lines
¶
- default:
5
max number of error lines to print, use -1 for all
-r
, --file-regex
¶
regex expression to filter files
-p
, --file-prefix
¶
replace file prefix with 'old1|old2:new'
-i
, --ignore-error-allowance
¶
- default:
false
set every error allowance to 0
-s
, --stats-only
¶
- default:
false
display a dictionary with current total violations
-f
, --full-message
¶
- default:
false
display the full error message
--traceback
¶
- default:
false
display the exception traceback if available
Positional arguments¶
payload
¶
- default:
'@-'
Output of a compiler or linter. A file may be specified by prefixing
a filename with @
. To read from stdin use @-
.
Summary: @-
(stdin), @filename
(file), string
.