package crs

  1. Overview
  2. Docs
A tool for managing inline review comments embedded in source code

Install

dune-project
 Dependency

Authors

Maintainers

Sources

crs-0.0.20260307.tbz
sha256=77f77c61e908a6716fa876f5648f662ffaf7e24be4a7889fd6b53121592311bb
sha512=5fc6252650571c4127ebb1e61fecf78c5d4ce35e2832dff47125cda1448e07ea6d4da5e3a9a28643e3491d3594b0ee8857214241f98bd0296ada2c35ea8daa4b

doc/src/crs.reviewdog/diagnostic.ml.html

Source file diagnostic.ml

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
(****************************************************************************)
(*  ocaml-reviewdog - A reviewdog diagnostics json serializer for OCaml     *)
(*  SPDX-FileCopyrightText: 2025 Mathieu Barbin <mathieu.barbin@gmail.com>  *)
(*  SPDX-License-Identifier: MIT                                            *)
(****************************************************************************)

type t =
  { message : string
  ; location : Location.t
  ; severity : Severity.t option
  ; source : Source.t option
  ; code : Code.t option
  ; suggestions : Suggestion.t list
  ; original_output : string option
  ; related_locations : Related_location.t list
  }

let to_json
      { message
      ; location
      ; severity
      ; source
      ; code
      ; suggestions
      ; original_output
      ; related_locations
      }
  : Yojson.Basic.t
  =
  `Assoc
    (List.concat
       [ [ "message", `String message ]
       ; [ "location", Location.to_json location ]
       ; (match severity with
          | None -> []
          | Some s -> [ "severity", Severity.to_json s ])
       ; (match source with
          | None -> []
          | Some s -> [ "source", Source.to_json s ])
       ; (match code with
          | None -> []
          | Some c -> [ "code", Code.to_json c ])
       ; (match suggestions with
          | [] -> []
          | _ -> [ "suggestions", `List (List.map Suggestion.to_json suggestions) ])
       ; (match original_output with
          | None -> []
          | Some o -> [ "originalOutput", `String o ])
       ; (match related_locations with
          | [] -> []
          | _ ->
            [ ( "relatedLocations"
              , `List (List.map Related_location.to_json related_locations) )
            ])
       ])
;;