4141 * Changes: ...
4242 *
4343 * - Remove dependency to [Core] and [Async].
44- * - Remove the [Stable] module - unversion the code.
44+ * - Remove the [Stable] module - remove the versioning of the code.
4545 * - Replace [Relpath] by [Vcs.Path_in_repo].
4646 * - Remove [of_sexp] constructs.
4747 * - Remove [Cr_comment_format].
5757 * - Remove support for attributes.
5858 * - Remove assignee computation (left as external work).
5959 * - Do not export [Raw].
60- * - Remove special type for cr soons. Return all CRs parsed.
6160 * - Rename [Processed] to [Header].
62- * - Remove support for printing crs without their content.
61+ * - Remove support for printing CRs without their content.
6362 * - Compute positions and offsets with [Loc].
6463*)
6564
65+ (* * Code review comments embedded in source code.
66+
67+ This module provides the core types and functions for representing and
68+ manipulating code review comments (CRs) embedded directly in source code
69+ using a special syntax. A CR captures actionable feedback, metadata, and
70+ assignment information, supporting workflows for tracking, resolving, and
71+ managing code review discussions within the codebase. *)
72+
6673module Kind : sig
74+ (* * The [Kind.t] type distinguishes between active and resolved code review
75+ comments.
76+ - [CR]: An active code review comment.
77+ - [XCR]: A resolved code review comment. *)
6778 type t =
6879 | CR
6980 | XCR
7081 [@@ deriving compare , equal , sexp_of ]
7182end
7283
7384module Due : sig
85+ (* * The [Due.t] type represents an optional urgency or priority class that can
86+ be attached to a code review comment (CR) using the CR syntax. This
87+ classification is a general convenience provided by the library to help
88+ organize and filter CRs, but the exact workflow and expectations
89+ associated with each class — such as when a [Soon] or [Someday] comment
90+ should be addressed — are intentionally left undefined here.
91+
92+ It is up to higher-level tools or code review systems built on top of CRs
93+ to define and enforce specific policies or behaviors around these classes.
94+
95+ As a rule of thumb:
96+ - [Now]: Should be addressed promptly.
97+ - [Soon]: Should be addressed in the near future.
98+ - [Someday]: Can be deferred until later.
99+
100+ These categories are intended to be flexible and adaptable to the needs of
101+ various development process. *)
74102 type t =
75103 | Now
76104 | Soon
@@ -91,8 +119,9 @@ module Header : sig
91119 (* * [reported_by] is [user] in [CR user...]. *)
92120 val reported_by : t -> Vcs.User_handle .t
93121
94- (* * [for_] is [user2] in [CR user1 for user2: ...]. It is none since the part
95- with the [for user2] is optional. *)
122+ (* * [for_] is [user2] in [CR user1 for user2: ...]. Assigning CRs to
123+ particular users is optional. This returns [None] if that part is left
124+ out, such as in [CR user1: Comment]. *)
96125 val for_ : t -> Vcs.User_handle .t option
97126
98127 val kind : t -> Kind .t
@@ -104,14 +133,14 @@ module Header : sig
104133 module With_loc : sig
105134 (* * These getters allows you to access the position of each elements of the
106135 CR header. This is meant for tools processing CRs automatically, such
107- as CR comment rewriters. *)
136+ as CRs rewriters. *)
108137
109138 (* * The location includes the entire reporter username, without the
110139 surrounding spaces. *)
111140 val reported_by : t -> Vcs.User_handle .t Loc.Txt .t
112141
113142 (* * The location includes the entire assignee username, if it is present,
114- without the surround spaces. In particular, the location does not
143+ without the surrounding spaces. In particular, the location does not
115144 include the ["for"] keyword itself. *)
116145 val for_ : t -> Vcs.User_handle .t Loc.Txt .t option
117146
@@ -123,21 +152,23 @@ module Header : sig
123152 (* * When the CR is due [Soon] or [Someday], the location returned starts
124153 right after the dash separator (but does not include it), and contains
125154 the entire due keyword. For example, the location will include
126- ["soon"] for a [CR-soon]. When the cr is due [Now], there is no
155+ ["soon"] for a [CR-soon]. When the CR is due [Now], there is no
127156 keyword to attach a location to : conventionally, we return instead
128- the location of the cr [kind] in this case. *)
157+ the location of the CR [kind] in this case. *)
129158 val due : t -> Due .t Loc.Txt .t
130159 end
131160end
132161
162+ (* * A [Cr_comment.t] is an immutable value holding the information and metadata
163+ about a CR that was parsed from a file. *)
133164type t [@@deriving equal, sexp_of]
134165
135166(* * {1 Getters} *)
136167
137168val path : t -> Vcs.Path_in_repo .t
138169
139170(* * [content] is the text of the CR with comment markers removed from the
140- beginning and end (if applicable). *)
171+ beginning and end (if applicable). See also {!reindented_content}. *)
141172val content : t -> string
142173
143174(* * [whole_loc] is suitable for removal of the entire CR comment. It includes
@@ -146,12 +177,19 @@ val whole_loc : t -> Loc.t
146177
147178val header : t -> Header .t Or_error .t
148179val kind : t -> Kind .t
180+
181+ (* * [due t] is a convenience wrapper to get the [due] property of the CR
182+ header. This returns [Now] when parsing the header resulted in an error. *)
149183val due : t -> Due .t
184+
185+ (* * [work_on t] represents the expectation as to when work on the CR is meant to
186+ happen. Is it similar to [due t] except that XCRs are meant to be worked
187+ on [Now]. *)
150188val work_on : t -> Due .t
151189
152190(* * This digest is computed such that changes in positions in a file, or changes
153191 in whitespaces are ignored. It is used by downstream systems to detect
154- that two crs are equivalent, which in turn may affect when a cr is
192+ that two CRs are equivalent, which in turn may affect when a CR is
155193 active. *)
156194val digest_ignoring_minor_text_changes : t -> Digest_hex .t
157195
@@ -160,13 +198,12 @@ val digest_ignoring_minor_text_changes : t -> Digest_hex.t
160198(* * Show the CR with a line showing the file position. *)
161199val to_string : t -> string
162200
163- (* * [reindented_content t] is similar to {!content}, but reseting the
164- indentation of the actual CR to a normalized amount, to print multiple CRs
165- together in a more unified fashion. This is used by [crs grep] for
166- example. *)
201+ (* * [reindented_content t] returns the content of the CR with leading
202+ indentation removed or normalized. This is useful for displaying multiple
203+ CRs together in a unified format, such as in [crs grep]. *)
167204val reindented_content : t -> string
168205
169- (* * Sorts the supplied list of crs and outputs it to the supplied out channel,
206+ (* * Sorts the supplied list of CRs and outputs it to the supplied out channel,
170207 separated by newline characters. *)
171208val output_list : t list -> oc :Out_channel .t -> unit
172209
@@ -185,11 +222,11 @@ val sort : t list -> t list
185222
186223 This module is exported to be used by libraries with strong ties to
187224 [cr_comment]. Its signature may change in breaking ways at any time without
188- prior notice, and outside of the guidelines set by semver.
225+ prior notice, and outside the guidelines set by semver.
189226
190- In particular, the intention here is that cr comments may only be created
191- using dedicated helpers libraries that are defined in this project, parsing
192- comments from files in vcs trees. *)
227+ In particular, the intention here is that CRs may only be created using
228+ dedicated helpers libraries that are defined in this project, parsing them
229+ from files in vcs trees. *)
193230
194231module Private : sig
195232 type header : = Header .t
0 commit comments