From 02462f9bf58fad0e529d90c4ee1491d6c5833872 Mon Sep 17 00:00:00 2001 From: s-khechnev Date: Tue, 30 May 2023 15:23:22 +0300 Subject: [PATCH] Fix deps on ppx_show Now ppx_show is used only with tests. Remove comments. Signed-off-by: s-khechnev Fix message of parser about line in diff Signed-off-by: s-khechnev --- dune-project | 2 +- review/main.ml | 9 ++------- review/parser.ml | 5 ++++- review_tests/test1.t/run.t | 2 +- review_tests/test2.t/run.t | 2 +- reviewer.opam | 2 +- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dune-project b/dune-project index 2b2cfaf..3ee3e0e 100644 --- a/dune-project +++ b/dune-project @@ -57,7 +57,7 @@ (>= 4.14) (< 5.0))) ppx_inline_test - ppx_show + (ppx_show :with-test) ppx_expect curly stdio diff --git a/review/main.ml b/review/main.ml index 4bfacb8..f2210df 100644 --- a/review/main.ml +++ b/review/main.ml @@ -9,12 +9,6 @@ let _example () = | Error e -> Format.printf "Failed: %a" Curly.Error.pp e ;; -(* let your_token = - match Sys.getenv "TOKEN" with - | s -> s - | exception Not_found -> failwith "Setup token using env TOKEN" -;; *) - type info = { mutable commit_id : string option ; mutable pull_number : int option @@ -207,5 +201,6 @@ let () = ; "-list_reviews", Arg.Unit (fun () -> list_reviews info), " " ] (fun _ -> assert false) - "Use -owner [OWNER] -repo [REPO NAME] -pr_number [PR NUMBER] -commit [HASH] -token [READ-WRITE TOKEN] -irdjsonl [PATH] -review to create review" + "Use -owner [OWNER] -repo [REPO NAME] -pr_number [PR NUMBER] -commit [HASH] -token \ + [READ-WRITE TOKEN] -irdjsonl [PATH] -review to create review" ;; diff --git a/review/parser.ml b/review/parser.ml index f593653..7d39832 100644 --- a/review/parser.ml +++ b/review/parser.ml @@ -69,7 +69,10 @@ let () = | { file = Some file; line = Some line } -> (match Diff_parser.lookup parsed ~file ~line with | Some diff_pos -> - Format.printf "Got something. It should be at %d line in diff\n" diff_pos + Format.printf + "Got something. It should be at %d lines below from the first chunk header \ + of file in diff\n" + diff_pos | None -> Format.eprintf "Couldn't find it.\n") | _ -> Format.eprintf "File or line was not initialized\n") | Error s -> Format.eprintf "Parsing failed: %s\n" s diff --git a/review_tests/test1.t/run.t b/review_tests/test1.t/run.t index 2d55110..995c988 100644 --- a/review_tests/test1.t/run.t +++ b/review_tests/test1.t/run.t @@ -1,2 +1,2 @@ $ cat blob1.diff | ../../review/parser.exe - -f new/changed.txt -l 2 - Got something. It should be at 2 line in diff + Got something. It should be at 2 lines below from the first chunk header of file in diff diff --git a/review_tests/test2.t/run.t b/review_tests/test2.t/run.t index 4e56b56..afc3997 100644 --- a/review_tests/test2.t/run.t +++ b/review_tests/test2.t/run.t @@ -1,2 +1,2 @@ $ cat test.diff | ../../review/parser.exe - -f test.js -l 21 - Got something. It should be at 25 line in diff + Got something. It should be at 25 lines below from the first chunk header of file in diff diff --git a/reviewer.opam b/reviewer.opam index 5988046..2c7541f 100644 --- a/reviewer.opam +++ b/reviewer.opam @@ -12,7 +12,7 @@ depends: [ "dune" {>= "3.4"} "ocaml" {>= "4.14" & < "5.0"} "ppx_inline_test" - "ppx_show" + "ppx_show" {with-test} "ppx_expect" "curly" "stdio"