Skip to main content

pre_commit_config/
pre_commit_elements.rs

1use super::*;
2
3#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
4#[cfg_attr(feature = "schemars", derive(JsonSchema))]
5#[serde(rename_all = "snake_case")]
6pub enum Language {
7	Conda,
8	Coursier,
9	Dart,
10	Docker,
11	DockerImage,
12	Dotnet,
13	Fail,
14	Golang,
15	Lua,
16	Node,
17	Perl,
18	Python,
19	PythonVenv,
20	R,
21	Ruby,
22	Rust,
23	Swift,
24	Pygrep,
25	Script,
26	System,
27}
28
29#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
30#[cfg_attr(feature = "schemars", derive(JsonSchema))]
31#[serde(rename_all = "kebab-case")]
32pub enum Stage {
33	Commit,
34	MergeCommit,
35	Push,
36	PrepareCommitMsg,
37	CommitMsg,
38	PostCheckout,
39	PostCommit,
40	PostMerge,
41	PostRewrite,
42	PreCommit,
43	PreMergeCommit,
44	PrePush,
45	PreRebase,
46	Manual,
47}
48
49#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, PartialOrd, Ord, Eq)]
50#[cfg_attr(feature = "schemars", derive(JsonSchema))]
51#[serde(rename_all = "kebab-case")]
52pub enum FileType {
53	AdobeIllustrator,
54	Alpm,
55	Apinotes,
56	Asar,
57	Asciidor,
58	Ash,
59	Asm,
60	Aspectj,
61	Audio,
62	Avif,
63	Awk,
64	Babelrc,
65	Bash,
66	Batch,
67	Bats,
68	Bazel,
69	Bazelrc,
70	Bib,
71	Binary,
72	Bitmap,
73	Bowerrc,
74	Browserslistrc,
75	Bzip2,
76	C,
77	#[serde(rename = "c#")]
78	CSharp,
79	#[serde(rename = "c++")]
80	#[allow(clippy::upper_case_acronyms)]
81	CPP,
82	C2hd,
83	Cbsd,
84	Clojure,
85	Clojurescript,
86	Cmake,
87	Codespellrc,
88	Coffee,
89	Coveragerc,
90	Crystal,
91	Csh,
92	Cson,
93	Csproj,
94	Css,
95	Csslintrc,
96	Csv,
97	Cuda,
98	Cython,
99	Dart,
100	Dash,
101	Def,
102	Diff,
103	Directory,
104	Dockerfile,
105	Dotenv,
106	Dtd,
107	EditorConfig,
108	Edn,
109	Ejs,
110	Eot,
111	Eps,
112	Erb,
113	Executable,
114	Expect,
115	File,
116	Fish,
117	Flake8,
118	Gdscript,
119	Geojson,
120	Gherkin,
121	Gif,
122	Gitattributes,
123	Gitconfig,
124	Gitignore,
125	Gitlint,
126	Gitmodules,
127	Go,
128	GoMod,
129	GoSum,
130	Gotimpl,
131	Gpx,
132	Graphql,
133	Gyb,
134	Gyp,
135	Gzip,
136	Handlebars,
137	Haskell,
138	Hcl,
139	Header,
140	Hgrc,
141	Html,
142	Icalendar,
143	Icns,
144	Icon,
145	Idl,
146	Idris,
147	Image,
148	Inc,
149	Ini,
150	Inl,
151	Ino,
152	Inx,
153	Jade,
154	Jar,
155	Java,
156	JavaProperties,
157	Javascript,
158	Jenkins,
159	Jinja,
160	Jpeg,
161	Jshintrc,
162	Json,
163	Json5,
164	Jsonnet,
165	Jsx,
166	Jupyter,
167	Kml,
168	Kotlin,
169	Ksh,
170	Lean,
171	Lektor,
172	Lektorproject,
173	Less,
174	Liquid,
175	LiterateHaskell,
176	Lua,
177	Mailmap,
178	Makefile,
179	Manifest,
180	Map,
181	Markdown,
182	Mdx,
183	MentionBot,
184	Meson,
185	Mib,
186	Modulemap,
187	Musescore,
188	Myst,
189	Ngdoc,
190	Nim,
191	Nimble,
192	Nix,
193	NonExecutable,
194	Npmignore,
195	Nunjucks,
196	ObjectiveC,
197	#[serde(rename = "objective-c++")]
198	ObjectiveCPP,
199	Ocaml,
200	Otf,
201	P12,
202	Pdbrc,
203	Pdf,
204	Pem,
205	Perl,
206	Php,
207	Pkgbuild,
208	PlainText,
209	Plantuml,
210	Plist,
211	Png,
212	Pofile,
213	Powershell,
214	Prettierignore,
215	Prisma,
216	Proto,
217	Puppet,
218	Purescript,
219	Pyi,
220	Pylintrc,
221	Pypirc,
222	Pyproj,
223	Python,
224	Python2,
225	Python3,
226	Pyz,
227	Qml,
228	R,
229	RelaxNg,
230	Rst,
231	Ruby,
232	Rust,
233	Salt,
234	Sass,
235	Sbt,
236	Scala,
237	Scheme,
238	Scss,
239	Sh,
240	Shell,
241	Sln,
242	Socket,
243	Solidity,
244	Spec,
245	Sql,
246	Stylus,
247	Svelte,
248	Svg,
249	Swf,
250	Swift,
251	Swiftdeps,
252	Symlink,
253	SystemVerilog,
254	Tar,
255	Tcsh,
256	Terraform,
257	Tex,
258	Text,
259	Thrift,
260	Tiff,
261	Toml,
262	Ts,
263	Tsv,
264	Tsx,
265	Ttf,
266	Twig,
267	Twisted,
268	Tsxprofile,
269	Urdf,
270	Vb,
271	Vbproj,
272	Vcxproj,
273	Vdx,
274	Verilog,
275	Vhdl,
276	Vim,
277	Vtl,
278	Vue,
279	Wav,
280	Webp,
281	Wheel,
282	Wky,
283	Woff,
284	Woff2,
285	Wsgi,
286	Xhtml,
287	Xml,
288	Xquery,
289	Xsd,
290	Xsl,
291	Yaml,
292	Yamllint,
293	Yang,
294	Yin,
295	Zcml,
296	Zig,
297	Zip,
298	Zpt,
299	Zsh,
300}
301
302#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
303#[cfg_attr(feature = "schemars", derive(JsonSchema))]
304#[serde(rename_all = "lowercase")]
305pub enum AutoUpdateSchedule {
306	Weekly,
307	Monthly,
308	Quarterly,
309}
310
311/// pre-commit.ci specific settings https://pre-commit.ci/#configuration
312#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Default)]
313#[cfg_attr(feature = "schemars", derive(JsonSchema))]
314#[serde(default)]
315#[serde(deny_unknown_fields)]
316pub struct CiSettings {
317	/// A commit message for pull request autofixes https://pre-commit.ci/#configuration
318	#[serde(skip_serializing_if = "Option::is_none")]
319	pub autofix_commit_msg: Option<String>,
320
321	/// Whether to autofix pull requests https://pre-commit.ci/#configuration
322	#[serde(skip_serializing_if = "Option::is_none")]
323	pub autofix_prs: Option<bool>,
324
325	/// A branch to send pull request's autoupdate to https://pre-commit.ci/#configuration
326	#[serde(skip_serializing_if = "Option::is_none")]
327	pub autoupdate_branch: Option<String>,
328
329	/// A commit message for autoupdate pull requests https://pre-commit.ci/#configuration
330	#[serde(skip_serializing_if = "Option::is_none")]
331	pub autoupdate_commit_msg: Option<String>,
332
333	/// An autoupdate frequency https://pre-commit.ci/#configuration
334	#[serde(skip_serializing_if = "Option::is_none")]
335	pub autoupdate_schedule: Option<AutoUpdateSchedule>,
336
337	/// List of skipped hook's ids https://pre-commit.ci/#configuration
338	#[serde(skip_serializing_if = "Option::is_none")]
339	pub skip: Option<BTreeSet<String>>,
340
341	/// Whether to recursively check out submodules https://pre-commit.ci/#configuration
342	#[serde(skip_serializing_if = "Option::is_none")]
343	pub submodules: Option<bool>,
344}