Skip to content

Commit

Permalink
use ocamldoc syntax for inline code
Browse files Browse the repository at this point in the history
  • Loading branch information
yasunariw committed Dec 3, 2021
1 parent 00852d8 commit c656828
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions lib/action.ml
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ module Action (Github_api : Api.Github) (Slack_api : Api.Slack) = struct
in
Lwt_list.iter_s notify notifications

(** `refresh_config_of_context ctx n` updates the current context if the configuration
hasn't been loaded yet, or if the incoming request `n` is a push
(** [refresh_config_of_context ctx n] updates the current context if the configuration
hasn't been loaded yet, or if the incoming request [n] is a push
notification containing commits that touched the config file. *)
let refresh_config_of_context (ctx : Context.t) notification =
let fetch_config () =
Expand Down
2 changes: 1 addition & 1 deletion lib/api_remote.ml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module Slack : Api.Slack = struct

let bearer_token_header access_token = sprintf "Authorization: Bearer %s" (Uri.pct_encode access_token)

(** `send_notification ctx msg` notifies `msg.channel` with the payload `msg`;
(** [send_notification ctx msg] notifies [msg.channel] with the payload [msg];
uses web API with access token if available, or with webhook otherwise *)
let send_notification ~(ctx : Context.t) ~(msg : Slack_t.post_message_req) =
log#info "sending to %s" msg.channel;
Expand Down
2 changes: 1 addition & 1 deletion lib/atd_adapters.ml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module Branch_filters_adapter = List_or_default_field.Make (struct
end)

(** Error detection in Slack API response. The web API communicates errors using
an `error` field rather than status codes. Note, on the other hand, that
an [error] field rather than status codes. Note, on the other hand, that
webhooks do use status codes to communicate errors. *)
module Slack_response_adapter : Atdgen_runtime.Json_adapter.S = struct
let normalize (x : Yojson.Safe.t) =
Expand Down
4 changes: 2 additions & 2 deletions lib/context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ let hook_of_channel ctx channel_name =
| Some hook -> Some hook.url
| None -> None

(** `is_pipeline_allowed ctx p` returns `true` if ctx.config.status_rules
(** [is_pipeline_allowed ctx p] returns [true] if [ctx.config.status_rules]
doesn't define a whitelist of allowed pipelines, or if the list
contains pipeline `p`; returns `false` otherwise. *)
contains pipeline [p]; returns [false] otherwise. *)
let is_pipeline_allowed ctx ~pipeline =
match ctx.config with
| None -> true
Expand Down
2 changes: 1 addition & 1 deletion lib/github.ml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type gh_link =

let gh_re = Re2.create_exn {|^(.*)/(.+)/(.+)/(commit|pull|issues)/([a-z0-9]+)/?$|}

(** `gh_link_of_string s` parses a URL string `s` to try to match a supported
(** [gh_link_of_string s] parses a URL string [s] to try to match a supported
GitHub link type, generating repository endpoints if necessary *)
let gh_link_of_string url_str =
let url = Uri.of_string url_str in
Expand Down
6 changes: 3 additions & 3 deletions lib/rule.atd
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ type status_rule = {

(* A filename matches a prefix rule with the channel name if it isn't in the ignore
list and it is in the allow list. If multiple prefix rules match for a given
file, the one to match with the longest prefix is used. Both `allow` and
`ignore` are optional. If `allow` is undefined, then the rule matches all
file, the one to match with the longest prefix is used. Both [allow] and
[ignore] are optional. If [allow] is undefined, then the rule matches all
payloads.

If a commit affects 3 files:
Expand All @@ -73,7 +73,7 @@ type prefix_rule = {
} <json adapter.ocaml="Atd_adapters.Branch_filters_adapter">

(* A payload matches a label rule with a channel name if absent from the ignore list
and present in the allow list. Both `allow` and `ignore` are optional. If `allow`
and present in the allow list. Both [allow] and [ignore] are optional. If [allow]
is undefined, then the rule matches all payloads. *)
type label_rule = {
?allow <json name="match"> : string list nullable;
Expand Down
22 changes: 11 additions & 11 deletions lib/rule.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ module Status = struct
{ trigger = [ Success ]; condition = None; policy = Allow_once };
]

(** `match_rules n rs` returns the policy declared by the first rule in `rs`
to match status notification `n` if one exists, falling back to
the default rules otherwise. A rule `r` matches `n` if `n.state` is in
`r.trigger` and `n` meets `r.condition`. *)
(** [match_rules n rs] returns the policy declared by the first rule in [rs]
to match status notification [n] if one exists, falling back to
the default rules otherwise. A rule [r] matches [n] if [n.state] is in
[r.trigger] and [n] meets [r.condition]. *)
let match_rules (notification : Github_t.status_notification) ~rules =
let match_rule rule =
let value_of_field = function
Expand Down Expand Up @@ -48,10 +48,10 @@ module Prefix = struct
| Some main_branch -> String.equal main_branch branch
| None -> distinct

(** `match_rules f rs` returns the channel name of a rule in `rs` that matches
file name `f` with the longest prefix, if one exists. A rule `r` matches
`f` with prefix length `l`, if `f` has no prefix in `r.ignore` and `l` is
the length of the longest prefix of `f` in `r.allow`. An undefined or empty
(** [match_rules f rs] returns the channel name of a rule in [rs] that matches
file name [f] with the longest prefix, if one exists. A rule [r] matches
[f] with prefix length [l], if [f] has no prefix in [r.ignore] and [l] is
the length of the longest prefix of [f] in [r.allow]. An undefined or empty
allow list is considered a prefix match of length 0. The ignore list is
evaluated before the allow list. *)
let match_rules filename ~rules =
Expand Down Expand Up @@ -91,9 +91,9 @@ module Prefix = struct
end

module Label = struct
(** `match_rules l rs` returns the channel names of the rules in `rs` that
allow label `l`, if one exists. A rule `r` matches label `l`, if `l` is
not a member of `r.ignore` and is a member of `r.allow`. The label name
(** [match_rules l rs] returns the channel names of the rules in [rs] that
allow label [l], if one exists. A rule [r] matches label [l], if [l] is
not a member of [r.ignore] and is a member of [r.allow]. The label name
comparison is case insensitive. An undefined allow list is considered a
match. The ignore list is evaluated before the allow list. *)
let match_rules (label : Github_t.label) ~rules =
Expand Down
2 changes: 1 addition & 1 deletion lib/state.atd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type 'v map_as_object <ocaml from="Common"> = abstract
(* A map from branch names to build statuses *)
type branch_statuses = status_state map_as_object

(* A map from pipeline names to `branch_statuses` maps. This tracks the
(* A map from pipeline names to [branch_statuses] maps. This tracks the
last build state matched by the status_rules for each pipeline and
branch *)
type pipeline_statuses = branch_statuses map_as_object
Expand Down

0 comments on commit c656828

Please sign in to comment.