Commit Graph

7 Commits

Author SHA1 Message Date
Simon Farnsworth
920d1901f3 Fix up confusion between description and long_description in hooks
Summary:
The idea was that the short description is used for mechanical summaries of the hook failures, and the long description is used for human-readable "how to handle this" forms.

Instead, we had a mixture of styles, plus only ever returning the short description. Change this to only ever return the long description and fix hooks so that the long description is meaningful

Reviewed By: StanislavGlebik

Differential Revision: D15537580

fbshipit-source-id: 6289c1c9786862db8190b4464a3133c0620eb09c
2019-05-29 11:34:26 -07:00
Lukas Piatkowski
0e541063c1 hooks: pass configs down to Lua hooks via ctx
Reviewed By: StanislavGlebik

Differential Revision: D13896436

fbshipit-source-id: b610909cc20fdef8b91ccfd5efb7e2faed9c4d23
2019-02-01 05:52:20 -08:00
Lukas Piatkowski
adf0e95781 hooks: clean up lua hooks code to prepare for further changes
Summary:
This diff includes a bit of cleanup in hooks code, like:
- removing not used `repo_name` from `ctx.info`
- moving lua code from within `.rs` files to it's own `.lua` files
- addressing linter comments on lua code and
- reducing some copy-pasta between Changeset and File hook types

Reviewed By: StanislavGlebik

Differential Revision: D13895963

fbshipit-source-id: c867e060ad40e81fe0c81f30d14df59e75e129e6
2019-02-01 05:52:20 -08:00
Harvey Hunt
368b2119bc Add regex_match to hook functions
Summary:
Add a helper function for hooks that can be used to match a string to a regex.

Regex matching can either be called from ctx.regex_match(s, r) or file.path_regex_match(r)

This will later be used in the no_bad_filenames hook, but will be helpful for other
hooks too.

Reviewed By: purplefox

Differential Revision: D12941544

fbshipit-source-id: f8f73a767da5ae77f486c925b6adc1333a198c3f
2018-11-22 09:28:19 -08:00
Stanislau Hlebik
a5c4d15d89 mononoke: verify_reviewedby_info hook
Summary:
Quite a big hook that checks whether a commit is reviewed.
What makes it big are exceptions. They should all be covered with tests

Reviewed By: farnz

Differential Revision: D10467787

fbshipit-source-id: b9f439d540b64a5df8c8f131b3e7ba2924af4c29
2018-11-06 03:59:35 -08:00
Stanislau Hlebik
258a8a0a6a mononoke: add a function to extract Phabricator tag
Summary:
In our hooks we may need to get access to test plan, list of reviewers, summary etc.
Lua doesn't have regex, only patterns. So parsing this information in Lua is a bit tricky.
What's even worse is the fact that we can't add any unittests, so debugging and
fixing is harder. Instead let's add a rust function that would do it for us

Reviewed By: farnz

Differential Revision: D10461203

fbshipit-source-id: 328b76171d2c45ceaf5b2a1f5e1d0bd4c326c223
2018-11-06 03:59:35 -08:00
Michael Bolin
b83240eb52 Put together a doc to explain the contracts of hooks in Mononoke.
Summary:
This is based on my reading of the source code, so I may have gotten things
wrong. Feel free to editorialize!

By putting this in a doc, hopefully it makes it easier for us to reason about
the API at a high level. Obviously it would be great if we could keep this up
to date going forward.

Reviewed By: StanislavGlebik

Differential Revision: D10340604

fbshipit-source-id: 9f3e82d234842e06c52f8a8b4440f8e06c487c0b
2018-10-19 11:49:56 -07:00