-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprecious-schema.json
More file actions
146 lines (146 loc) · 6.66 KB
/
precious-schema.json
File metadata and controls
146 lines (146 loc) · 6.66 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
142
143
144
145
146
{
"$schema": "https://json-schema.org/draft-04/schema",
"$id": "https://raw.githubusercontent.com/houseabsolute/precious/master/schema.json",
"title": "Precious",
"description": "One code quality tool to rule them all",
"type": "object",
"additionalProperties": false,
"properties": {
"exclude": {
"description": "Each array member is a pattern that will be matched against potential files when precious is run. These patterns are matched in the same way patterns in a gitignore file. However, you cannot have a pattern starting with a ! as you can in a gitignore file.",
"type": "array",
"items": {
"type": "string"
}
},
"commands": {
"description": "All other configuration is on a per-filter basis. A filter is something that either tidies (aka pretty prints or beautifies) or lints your code (or both). Currently all filters are defined as commands, external programs which precious will execute as needed.\nEach filter should be defined in a block named something like [commands.filter-name]. Each name after the commands. prefix must be unique. Note that you can have multiple filters defined for the same executable as long as each one has a unique name.\nFilters are run in the same order as they appear in the config file.",
"type": "object",
"additionalProperties": false,
"patternProperties": {
".*": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"description": "This must be either lint, tidy, or both. This defines what type of command this is. A command which is both must define lint_flags or tidy_flags as well.",
"type": "string",
"enum": [
"tidy",
"lint",
"both"
]
},
"include": {
"description": "Each array member is a gitignore pattern that tells precious what files this command applies to. You can use lines starting with a ! to negate the meaning of previous rules in the list, so that anything that matches is not included even if it matches previous rules.",
"type": "array",
"items": {
"type": "string"
}
},
"exclude": {
"description": "Each array member is a gitignore pattern that tells precious what files this command should not be applied to. You can use lines starting with a ! to negate the meaning of previous rules in the list, so that anything that matches is not excluded even if it matches previous rules.",
"type": "array",
"items": {
"type": "string"
}
},
"cmd": {
"description": "This is the executable to be run followed by any arguments that should always be passed.",
"type": "array",
"items": {
"type": "string"
}
},
"env": {
"description": "This key allows you to set one or more environment variables that will be set when the command is run. The values in this table must be strings.",
"type": "object",
"pattern_properties": {
".*": {
"type": "string"
}
}
},
"path_flag": {
"description": "By default, precious will pass each path being operated on to the command it executes as a final, positional, argument. However, if the command takes paths via a flag you need to specify that flag with this key.",
"type": "string"
},
"lint_flags": {
"description": "If a command is both a linter and tidier then it may take extra flags to operate in linting mode. This is how you set that flag.",
"type": "array",
"items": {
"type": "string"
}
},
"tidy_flags": {
"description": "If a command is both a linter and tidier then it may take extra flags to operate in tidying mode. This is how you set that flag.",
"type": "array",
"items": {
"type": "string"
}
},
"invoke": {
"description": "The invoke key tells precious how the command should be invoked.",
"type": "string",
"enum": [
"per-file",
"per-dir",
"once"
],
"default": "per-file"
},
"working_dir": {
"description": "The working_dir key tells precious what the working directory should be when the command is run.",
"type": "string",
"enum": [
"root",
"dir"
],
"default": "root"
},
"path_args": {
"description": "The path_args key tells precious how paths should be passed when the command is run.",
"type": "string",
"enum": [
"file",
"dir",
"none",
"dot",
"absolute-file",
"absolute-dir"
],
"default": "file"
},
"ok_exit_codes": {
"description": "Any exit code that does not indicate an abnormal exit should be here. For most commands this is just 0 but some commands may use other exit codes even for a normal exit.",
"type": "array",
"items": {
"type": "integer"
}
},
"lint_failure_exit_codes": {
"description": "If the command is a linter then these are the status codes that indicate a lint failure. These need to be specified so precious can distinguish an exit because of a lint failure versus an exit because of some unexpected issue.",
"type": "array",
"items": {
"type": "integer"
}
},
"ignore_stderr": {
"description": "By default, precious assumes that when a command sends output to stderr that indicates a failure to lint or tidy. This parameter can specify one or more regexes. These regexes will be matched against the command's stderr output. If any of the regexes match, the stderr output is ignored.",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"type",
"include",
"cmd",
"ok_exit_codes"
]
}
}
}
}
}