-
Notifications
You must be signed in to change notification settings - Fork 379
Expand file tree
/
Copy pathprecious.toml
More file actions
141 lines (131 loc) · 3.88 KB
/
precious.toml
File metadata and controls
141 lines (131 loc) · 3.88 KB
1
2
3
4
5
6
7
8
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
# When adding new tidiers, consider what labels it should have. If it's fast, set labels like this:
#
# labels = [ "default", "fast-tidy" ]
#
# "Fast" here means anything less than 0.1s. These tidiers are intended to be invoked frequently,
# for example from editors on save. Slower tidiers should only be invoked manually, either by
# running the relevant mage command or by explicitly running `precious` from the CLI.
exclude = [
".agents/**/*",
".claude/**/*",
"vendor/**/*",
]
[commands.golangci-lint]
type = "both"
include = "**/*.go"
# Based on my local testing, this seemed like a reasonable value for this option.
invoke.per-dir-or-once = 7
working-dir = "root"
path-args = "dir"
cmd = [
"$PRECIOUS_ROOT/dev-bin/golangci-lint",
"run",
"--allow-parallel-runners",
"--build-tags", "failpoints",
"--color", "always",
"--timeout", "5m",
]
tidy-flags = "--fix"
env = { "FAIL_ON_WARNINGS" = "1" }
ok-exit-codes = [0]
lint-failure-exit-codes = [1]
[commands.goimports]
type = "tidy"
include = "**/*.go"
cmd = [ "$PRECIOUS_ROOT/dev-bin/goimports", "-w" ]
ok-exit-codes = [0]
labels = [ "default", "fast-tidy" ]
[commands.golines]
type = "both"
include = "**/*.go"
invoke = "once"
working-dir = "root"
path-args = "file"
# This wrapper will tidy or lint based on the presence of the "--lint" flag.
cmd = "$PRECIOUS_ROOT/etc/golines-wrapper.sh"
lint-flags = "--lint"
ok-exit-codes = [0]
lint-failure-exit-codes = [1]
# We could run this via golangci-lint but we want to exclude more directories
# for gosec than we do for other linting. There doesn't seem to be a way to
# configure these excludes when running gosec as part of golangci-lint.
[commands.gosec]
type = "lint"
include = "**/*.go"
exclude = [
"buildscript/**/*.go",
"common/testutil/**/*.go",
"release/**/*.go",
"vendor/**/*.go",
]
invoke.per-dir-or-once = 7
working-dir = "root"
path-args = "dir"
# This wrapper lets us control the output with an env var so we can generate a
# SARIF report in Evergreen but use the default format for linting.
cmd = [
"$PRECIOUS_ROOT/etc/gosec-wrapper.sh",
# This rule complains about reading or writing to paths based on user input,
# but most of the tools exist for the purpose of reading and writing from/to
# user-provided paths.
"-exclude", "G304",
"-severity", "high",
"-terse",
]
ok_exit_codes = [0]
lint_failure_exit_codes = [1]
[commands.prettier-yaml]
type = "both"
invoke = "once"
working-dir = "root"
path-args = "file"
include = [ "**/*.yml", "**/*.yaml" ]
cmd = "$PRECIOUS_ROOT/node_modules/.bin/prettier"
lint-flags = "--check"
tidy-flags = "--write"
ok-exit-codes = [0]
lint-failure-exit-codes = [1]
ignore-stderr = ".*"
labels = [ "default", "fast-tidy" ]
[commands.prettier-md]
type = "both"
invoke = "once"
working-dir = "root"
path-args = "file"
include = [ "*.md" ]
exclude = [ "docs/superpowers/**/*.md" ]
cmd = [
"$PRECIOUS_ROOT/node_modules/.bin/prettier",
"--print-width", "100",
"--prose-wrap", "always",
]
lint-flags = "--check"
tidy-flags = "--write"
ok-exit-codes = [0]
lint-failure-exit-codes = [1]
ignore-stderr = ".*"
labels = [ "default", "fast-tidy" ]
# It'd be nice to use prettier to tidy the JS code too, but it seems to make
# changes that cause it to fail to parse with the versions of the Mongo shell
# we use.
[commands.eslint]
type = "both"
invoke = "once"
working-dir = "root"
path-args = "file"
include = "test/qa-tests/jstests/**/*.js"
cmd = "$PRECIOUS_ROOT/node_modules/.bin/eslint"
tidy-flags = "--fix"
ok-exit-codes = [0]
lint-failure-exit-codes = [1]
[commands.github-codeowners]
type = "lint"
invoke = "once"
path-args = "none"
# We need to run this whenever new files are added to make sure they have an owner, so it's easiest
# to just apply this linter to all files.
include = "**/*"
cmd = [ "$PRECIOUS_ROOT/etc/github-codeowners-wrapper.sh" ]
ok_exit_codes = 0
lint_failure_exit_codes = 1
labels = [ "default", "fast-tidy" ]