Skip to content

Commit 1c37d48

Browse files
authored
Merge pull request #112 from divarvel/typos
nit: fix typos in comments and log messages
2 parents 47a89ad + fddb7cb commit 1c37d48

File tree

9 files changed

+79
-75
lines changed

9 files changed

+79
-75
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### unreleased
2+
3+
- Fix typos and improve logs display (by [clementd](https://clementd.wtf))
4+
15
### v2.8.0 2025-12-17 Nantes (France)
26

37
#### Yocaml

lib/core/data.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ module Validation : sig
410410
-> (t -> 'a validated_value)
411411
-> 'a validated_record
412412
(** [optional_or ~default assoc field validator] optional [field] of [assoc],
413-
validated by [validator]. If the field does not exists, it return default.
413+
validated by [validator]. If the field does not exist, it returns default.
414414
([default] is not validated) *)
415415

416416
val field :

lib/core/eff.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ let erase_file ~on path =
216216
if file then perform @@ Yocaml_erase_file (on, path)
217217
else
218218
logf ~src:yocaml_log_src ~level:`Warning
219-
"%a is not a file (or does not exists)" Path.pp path
219+
"%a is not a file (or does not exist)" Path.pp path
220220

221221
let read_directory ~on ?(only = `Both) ?(where = fun _ -> true) path =
222222
let* is_dir = is_directory ~on path in
@@ -237,7 +237,7 @@ let read_directory ~on ?(only = `Both) ?(where = fun _ -> true) path =
237237
List.filter_map predicate children
238238
else
239239
let+ () =
240-
logf ~src:yocaml_log_src ~level:`Warning "%a does not exists" Path.pp path
240+
logf ~src:yocaml_log_src ~level:`Warning "%a does not exist" Path.pp path
241241
in
242242
[]
243243

lib/core/eff.mli

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,10 @@ val run : ('b, 'c) Effect.Deep.handler -> ('a -> 'b t) -> 'a -> 'c
289289
Exception that can be propagated by the performance of effects. *)
290290

291291
exception File_not_exists of filesystem * Path.t
292-
(** Exception raised when a file does not exists. *)
292+
(** Exception raised when a file does not exist. *)
293293

294294
exception Invalid_path of filesystem * Path.t
295-
(** Exception raised when a file does not has a basename. *)
295+
(** Exception raised when a file does not have a basename. *)
296296

297297
exception File_is_a_directory of filesystem * Path.t
298298
(** Exception raised when we try to use a directory as a regular file. *)
@@ -358,7 +358,7 @@ val file_exists : on:filesystem -> Path.t -> bool t
358358
val read_file : ?snapshot:bool -> on:filesystem -> Path.t -> string t
359359
(** [read_file ?snapshot ~on path] perform the effect [Yocaml_read_file] with a
360360
given [path] and try to read it. Perform [Yocaml_failwith] with
361-
{!exception:File_not_exists} if the file does not exists. [snapshot] is used
361+
{!exception:File_not_exists} if the file does not exist. [snapshot] is used
362362
to perform a snapshot of the file. *)
363363

364364
val read_file_as_metadata :
@@ -392,7 +392,7 @@ val read_file_with_metadata :
392392
val mtime : on:filesystem -> Path.t -> int t
393393
(** [mtime ~on path] perform the effect [Yocaml_source_get_mtime] with a given
394394
[path] and try to get the modification time. Perform [Yocaml_failwith] with
395-
{!exception:File_not_exists} if the file does not exists.
395+
{!exception:File_not_exists} if the file does not exist.
396396
397397
The logic of [mtime] differs slightly from that of Unix. If a directory is
398398
given as an argument, the function will return the largest [mtime]

lib/core/lexicon.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ let unknown_error ppf exn =
9393
(Printexc.to_string exn)
9494

9595
let file_not_exists source path ppf () =
96-
Format.fprintf ppf "The file `%a` (on `%a`) does not exists" Path.pp path
96+
Format.fprintf ppf "The file `%a` (on `%a`) does not exist" Path.pp path
9797
pp_filesystem source
9898

9999
let invalid_path source path ppf () =
@@ -114,6 +114,6 @@ let directory_is_a_file source path ppf () =
114114

115115
let directory_not_exists source path ppf () =
116116
Format.fprintf ppf
117-
"The following directory: `%a` (on `%a`) does not exists (or is maybe a \
117+
"The following directory: `%a` (on `%a`) does not exist (or is maybe a \
118118
file and not a directory)"
119119
Path.pp path pp_filesystem source

lib/runtime/log.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let level_to_logs = function
2525

2626
let msg ?src level message =
2727
let level = level_to_logs level in
28-
Logs.msg ?src level (fun print -> print "%s" message)
28+
Logs.msg ?src level (fun print -> print " %s" message)
2929

3030
let setup ?level () =
3131
match level with

test/e2e/run.t

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
Run the generator
22
$ ./bin/gen.exe
33
./bin/gen.exe
4-
[DEBUG]Trigger in ./
5-
[DEBUG]Cache initiated in `./_www/.cache`
6-
[DEBUG]`./_www/style.css` will be written
7-
[INFO]`./_www/style.css` has been written
8-
[DEBUG]`./_www/articles/first_article.html` will be written
9-
[INFO]`./_www/articles/first_article.html` has been written
10-
[DEBUG]./content/templates/article.html already stored
11-
[DEBUG]./content/templates/layout.html already stored
12-
[DEBUG]`./_www/articles/second_article.html` will be written
13-
[INFO]`./_www/articles/second_article.html` has been written
14-
[DEBUG]./content/templates/article.html already stored
15-
[DEBUG]./content/templates/layout.html already stored
16-
[DEBUG]`./_www/articles-with-applicative-read/first_article.html` will be written
17-
[INFO]`./_www/articles-with-applicative-read/first_article.html` has been written
18-
[DEBUG]./content/templates/article.html already stored
19-
[DEBUG]./content/templates/layout.html already stored
20-
[DEBUG]`./_www/articles-with-applicative-read/second_article.html` will be written
21-
[INFO]`./_www/articles-with-applicative-read/second_article.html` has been written
22-
[DEBUG]./content/templates/article.html already stored
23-
[DEBUG]./content/templates/layout.html already stored
24-
[DEBUG]`./_www/articles-with-applicative-read-2/first_article.html` will be written
25-
[INFO]`./_www/articles-with-applicative-read-2/first_article.html` has been written
26-
[DEBUG]./content/templates/article.html already stored
27-
[DEBUG]./content/templates/layout.html already stored
28-
[DEBUG]`./_www/articles-with-applicative-read-2/second_article.html` will be written
29-
[INFO]`./_www/articles-with-applicative-read-2/second_article.html` has been written
30-
[DEBUG]Cache stored in `./_www/.cache`
4+
[DEBUG] Trigger in ./
5+
[DEBUG] Cache initiated in `./_www/.cache`
6+
[DEBUG] `./_www/style.css` will be written
7+
[INFO] `./_www/style.css` has been written
8+
[DEBUG] `./_www/articles/first_article.html` will be written
9+
[INFO] `./_www/articles/first_article.html` has been written
10+
[DEBUG] ./content/templates/article.html already stored
11+
[DEBUG] ./content/templates/layout.html already stored
12+
[DEBUG] `./_www/articles/second_article.html` will be written
13+
[INFO] `./_www/articles/second_article.html` has been written
14+
[DEBUG] ./content/templates/article.html already stored
15+
[DEBUG] ./content/templates/layout.html already stored
16+
[DEBUG] `./_www/articles-with-applicative-read/first_article.html` will be written
17+
[INFO] `./_www/articles-with-applicative-read/first_article.html` has been written
18+
[DEBUG] ./content/templates/article.html already stored
19+
[DEBUG] ./content/templates/layout.html already stored
20+
[DEBUG] `./_www/articles-with-applicative-read/second_article.html` will be written
21+
[INFO] `./_www/articles-with-applicative-read/second_article.html` has been written
22+
[DEBUG] ./content/templates/article.html already stored
23+
[DEBUG] ./content/templates/layout.html already stored
24+
[DEBUG] `./_www/articles-with-applicative-read-2/first_article.html` will be written
25+
[INFO] `./_www/articles-with-applicative-read-2/first_article.html` has been written
26+
[DEBUG] ./content/templates/article.html already stored
27+
[DEBUG] ./content/templates/layout.html already stored
28+
[DEBUG] `./_www/articles-with-applicative-read-2/second_article.html` will be written
29+
[INFO] `./_www/articles-with-applicative-read-2/second_article.html` has been written
30+
[DEBUG] Cache stored in `./_www/.cache`
3131

3232
Inspect tree
3333
$ tree _www
@@ -204,15 +204,15 @@ Inspect Second Applicative read (same content of article)
204204
Run the Liquid generator
205205
$ ./bin/gen_liquid.exe
206206
./bin/gen_liquid.exe
207-
[DEBUG]Trigger in ./
208-
[DEBUG]Cache restored from `./_www/.cache`
209-
[DEBUG]`./_www/liquid-articles/first_article.html` will be written
210-
[INFO]`./_www/liquid-articles/first_article.html` has been written
211-
[DEBUG]./content/templates/article.liquid already stored
212-
[DEBUG]./content/templates/layout.liquid already stored
213-
[DEBUG]`./_www/liquid-articles/second_article.html` will be written
214-
[INFO]`./_www/liquid-articles/second_article.html` has been written
215-
[DEBUG]Cache stored in `./_www/.cache`
207+
[DEBUG] Trigger in ./
208+
[DEBUG] Cache restored from `./_www/.cache`
209+
[DEBUG] `./_www/liquid-articles/first_article.html` will be written
210+
[INFO] `./_www/liquid-articles/first_article.html` has been written
211+
[DEBUG] ./content/templates/article.liquid already stored
212+
[DEBUG] ./content/templates/layout.liquid already stored
213+
[DEBUG] `./_www/liquid-articles/second_article.html` will be written
214+
[INFO] `./_www/liquid-articles/second_article.html` has been written
215+
[DEBUG] Cache stored in `./_www/.cache`
216216
Inspect tree after Liquid generation
217217
$ tree _www
218218
_www
@@ -278,17 +278,17 @@ Inspect Liquid Second Article
278278
Observe Residual Removing
279279
$ ./bin/gen_residuals.exe
280280
./bin/gen_residuals.exe
281-
[DEBUG]Cache initiated in `./residuals_build/cache`
282-
[DEBUG]`./residuals_build/1.txt` will be written
283-
[INFO]`./residuals_build/1.txt` has been written
284-
[DEBUG]`./residuals_build/2.txt` will be written
285-
[INFO]`./residuals_build/2.txt` has been written
286-
[DEBUG]`./residuals_build/3.txt` will be written
287-
[INFO]`./residuals_build/3.txt` has been written
288-
[INFO]Remove residuals for ./residuals_build
289-
[INFO]./residuals_build/4.txt deleted!
290-
[INFO]./residuals_build/5.txt deleted!
291-
[DEBUG]Cache stored in `./residuals_build/cache`
281+
[DEBUG] Cache initiated in `./residuals_build/cache`
282+
[DEBUG] `./residuals_build/1.txt` will be written
283+
[INFO] `./residuals_build/1.txt` has been written
284+
[DEBUG] `./residuals_build/2.txt` will be written
285+
[INFO] `./residuals_build/2.txt` has been written
286+
[DEBUG] `./residuals_build/3.txt` will be written
287+
[INFO] `./residuals_build/3.txt` has been written
288+
[INFO] Remove residuals for ./residuals_build
289+
[INFO] ./residuals_build/4.txt deleted!
290+
[INFO] ./residuals_build/5.txt deleted!
291+
[DEBUG] Cache stored in `./residuals_build/cache`
292292

293293
$ ls residuals_build
294294
1.txt
@@ -298,12 +298,12 @@ Observe Residual Removing
298298

299299
$ ./bin/gen_residuals.exe
300300
./bin/gen_residuals.exe
301-
[DEBUG]Cache restored from `./residuals_build/cache`
302-
[DEBUG]`./residuals_build/1.txt` always has the same hash as in the cache, already up-to-date
303-
[DEBUG]`./residuals_build/2.txt` always has the same hash as in the cache, already up-to-date
304-
[DEBUG]`./residuals_build/3.txt` always has the same hash as in the cache, already up-to-date
305-
[INFO]Remove residuals for ./residuals_build
306-
[DEBUG]Cache stored in `./residuals_build/cache`
301+
[DEBUG] Cache restored from `./residuals_build/cache`
302+
[DEBUG] `./residuals_build/1.txt` always has the same hash as in the cache, already up-to-date
303+
[DEBUG] `./residuals_build/2.txt` always has the same hash as in the cache, already up-to-date
304+
[DEBUG] `./residuals_build/3.txt` always has the same hash as in the cache, already up-to-date
305+
[INFO] Remove residuals for ./residuals_build
306+
[DEBUG] Cache stored in `./residuals_build/cache`
307307

308308
$ ls residuals_build
309309
1.txt

test/lib/fs.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ let run ~trace program input =
366366
match get !trace.system path with
367367
| Some (Dir _) -> true
368368
| _ -> false
369-
(* We suppose that if a file does not exists,
369+
(* We suppose that if a file does not exist,
370370
it is not a directory... *)
371371
in
372372
continue k res)
@@ -379,7 +379,7 @@ let run ~trace program input =
379379
match get !trace.system path with
380380
| Some (File _) -> true
381381
| _ -> false
382-
(* We suppose that if a file does not exists,
382+
(* We suppose that if a file does not exist,
383383
it is not a file... *)
384384
in
385385
continue k res)

test/lib/gen.ml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
let csexp =
1818
let open QCheck2.Gen in
19-
let atom = small_string ~gen:printable |> map Yocaml.Sexp.atom in
20-
let node self n = small_list (self (n / 10)) |> map Yocaml.Sexp.node in
19+
let atom = string_small |> map Yocaml.Sexp.atom in
20+
let node self n = list_small (self (n / 10)) |> map Yocaml.Sexp.node in
2121
fix (fun self -> function
2222
| 0 -> atom
23-
| n -> frequency [ (1, atom); (5, node self n) ])
23+
| n -> oneof_weighted [ (1, atom); (5, node self n) ])
2424
|> sized
2525

2626
let alphanumeric =
@@ -32,20 +32,20 @@ let sexp =
3232
let atom =
3333
string_size ~gen:alphanumeric (int_range 1 100) |> map Yocaml.Sexp.atom
3434
in
35-
let node self n = small_list (self (n / 10)) |> map Yocaml.Sexp.node in
35+
let node self n = list_small (self (n / 10)) |> map Yocaml.Sexp.node in
3636
fix (fun self -> function
3737
| 0 -> atom
38-
| n -> frequency [ (1, atom); (5, node self n) ])
38+
| n -> oneof_weighted [ (1, atom); (5, node self n) ])
3939
|> sized
4040

4141
let path =
4242
let open QCheck2.Gen in
4343
let fragment =
44-
string_size ~gen:(char_range 'a' 'z') (int_range 1 10) |> small_list
44+
string_size ~gen:(char_range 'a' 'z') (int_range 1 10) |> list_small
4545
in
4646
let rel = fragment |> map Yocaml.Path.rel in
4747
let abs = fragment |> map Yocaml.Path.abs in
48-
frequency [ (5, rel); (5, abs) ]
48+
oneof_weighted [ (5, rel); (5, abs) ]
4949

5050
let deps =
5151
let open QCheck2.Gen in
@@ -56,8 +56,8 @@ let cache_entry =
5656
map3
5757
(fun last_build_date hash deps ->
5858
Yocaml.Cache.entry ?last_build_date hash deps)
59-
(opt int)
60-
(small_string ~gen:printable)
59+
(option int)
60+
string_small
6161
deps
6262

6363
let cache =
@@ -67,4 +67,4 @@ let cache =
6767
let+ k = path in
6868
(k, v)
6969
in
70-
line |> small_list |> map Yocaml.Cache.from_list
70+
line |> list_small |> map Yocaml.Cache.from_list

0 commit comments

Comments
 (0)