Skip to content

Commit 77a6290

Browse files
authored
Convert to snake case (#8456)
* Convert to snake case * Update CHANGELOG.md * fix reactive_test * rename gen_type to gentype * Fix suspicious names
1 parent 7d96fe3 commit 77a6290

317 files changed

Lines changed: 18908 additions & 18472 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
- Add a multi-file fixture harness (`super_errors_multi`) for cross-module errors and warnings. https://github.com/rescript-lang/rescript/pull/8433
5959
- Catalog every named compiler error variant in `tests/ERROR_VARIANTS.md` and add fixtures for the remaining reachable ones. https://github.com/rescript-lang/rescript/pull/8446
6060
- Remove dead and unreachable compiler error and warning variants; add fixtures for the ones found to be reachable. https://github.com/rescript-lang/rescript/pull/8459
61+
- Convert OCaml codebase to snake case format. https://github.com/rescript-lang/rescript/pull/8456
6162

6263

6364
# 13.0.0-alpha.4

analysis/bin/main.ml

Lines changed: 65 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -93,116 +93,127 @@ Options:
9393

9494
let main () =
9595
let args = Array.to_list Sys.argv in
96-
let debugLevel, args =
96+
let debug_level, args =
9797
match args with
98-
| _ :: "debug-dump" :: logLevel :: rest ->
99-
( (match logLevel with
98+
| _ :: "debug-dump" :: log_level :: rest ->
99+
( (match log_level with
100100
| "verbose" -> Debug.Verbose
101101
| "regular" -> Regular
102102
| _ -> Off),
103103
"dummy" :: rest )
104104
| args -> (Off, args)
105105
in
106-
Debug.debugLevel := debugLevel;
107-
let debug = debugLevel <> Debug.Off in
108-
let printHeaderInfo path line col =
106+
Debug.debug_level := debug_level;
107+
let debug = debug_level <> Debug.Off in
108+
let print_header_info path line col =
109109
if debug then
110110
Printf.printf "Debug level: %s\n%s:%s-%s\n\n"
111-
(match debugLevel with
111+
(match debug_level with
112112
| Debug.Verbose -> "verbose"
113113
| Regular -> "regular"
114114
| Off -> "off")
115115
path line col
116116
in
117117
match args with
118-
| [_; "cache-project"; rootPath] -> (
119-
Cfg.readProjectConfigCache := false;
120-
let uri = Uri.fromPath rootPath in
121-
match Packages.getPackage ~uri with
122-
| Some package -> Cache.cacheProject package
118+
| [_; "cache-project"; root_path] -> (
119+
Cfg.read_project_config_cache := false;
120+
let uri = Uri.from_path root_path in
121+
match Packages.get_package ~uri with
122+
| Some package -> Cache.cache_project package
123123
| None -> print_endline "\"ERR\"")
124-
| [_; "cache-delete"; rootPath] -> (
125-
Cfg.readProjectConfigCache := false;
126-
let uri = Uri.fromPath rootPath in
127-
match Packages.findRoot ~uri (Hashtbl.create 0) with
128-
| Some (`Bs rootPath) -> (
129-
match BuildSystem.getLibBs rootPath with
124+
| [_; "cache-delete"; root_path] -> (
125+
Cfg.read_project_config_cache := false;
126+
let uri = Uri.from_path root_path in
127+
match Packages.find_root ~uri (Hashtbl.create 0) with
128+
| Some (`Bs root_path) -> (
129+
match Build_system.get_lib_bs root_path with
130130
| None -> print_endline "\"ERR\""
131-
| Some libBs ->
132-
Cache.deleteCache (Cache.targetFileFromLibBs libBs);
131+
| Some lib_bs ->
132+
Cache.delete_cache (Cache.target_file_from_lib_bs lib_bs);
133133
print_endline "\"OK\"")
134134
| _ -> print_endline "\"ERR: Did not find root \"")
135-
| [_; "completion"; path; line; col; currentFile] ->
136-
printHeaderInfo path line col;
135+
| [_; "completion"; path; line; col; current_file] ->
136+
print_header_info path line col;
137137
Cli.completion ~debug ~path
138138
~pos:(int_of_string line, int_of_string col)
139-
~currentFile
140-
| [_; "completionResolve"; path; modulePath] ->
141-
Cli.completionResolve ~path ~modulePath
139+
~current_file
140+
| [_; "completionResolve"; path; module_path] ->
141+
Cli.completion_resolve ~path ~module_path
142142
| [_; "definition"; path; line; col] ->
143143
Cli.definition ~path ~pos:(int_of_string line, int_of_string col) ~debug
144144
| [_; "typeDefinition"; path; line; col] ->
145-
Cli.typeDefinition ~path ~pos:(int_of_string line, int_of_string col) ~debug
146-
| [_; "documentSymbol"; path] -> DocumentSymbol.command ~path
147-
| [_; "hover"; path; line; col; currentFile; supportsMarkdownLinks] ->
145+
Cli.type_definition ~path
146+
~pos:(int_of_string line, int_of_string col)
147+
~debug
148+
| [_; "documentSymbol"; path] -> Document_symbol.command ~path
149+
| [_; "hover"; path; line; col; current_file; supports_markdown_links] ->
148150
Cli.hover ~path
149151
~pos:(int_of_string line, int_of_string col)
150-
~currentFile ~debug
151-
~supportsMarkdownLinks:
152-
(match supportsMarkdownLinks with
152+
~current_file ~debug
153+
~supports_markdown_links:
154+
(match supports_markdown_links with
153155
| "true" -> true
154156
| _ -> false)
155157
| [
156-
_; "signatureHelp"; path; line; col; currentFile; allowForConstructorPayloads;
158+
_;
159+
"signatureHelp";
160+
path;
161+
line;
162+
col;
163+
current_file;
164+
allow_for_constructor_payloads;
157165
] ->
158-
Cli.signatureHelp ~path
166+
Cli.signature_help ~path
159167
~pos:(int_of_string line, int_of_string col)
160-
~currentFile ~debug
161-
~allowForConstructorPayloads:
162-
(match allowForConstructorPayloads with
168+
~current_file ~debug
169+
~allow_for_constructor_payloads:
170+
(match allow_for_constructor_payloads with
163171
| "true" -> true
164172
| _ -> false)
165-
| [_; "inlayHint"; path; line_start; line_end; maxLength] ->
173+
| [_; "inlayHint"; path; line_start; line_end; max_length] ->
166174
Cli.inlayhint ~path
167175
~pos:(int_of_string line_start, int_of_string line_end)
168-
~maxLength ~debug
169-
| [_; "codeLens"; path] -> Cli.codeLens ~path ~debug
170-
| [_; "codeAction"; path; startLine; startCol; endLine; endCol; currentFile]
171-
->
172-
Cli.codeAction ~path
173-
~startPos:(int_of_string startLine, int_of_string startCol)
174-
~endPos:(int_of_string endLine, int_of_string endCol)
175-
~currentFile ~debug
176+
~max_length ~debug
177+
| [_; "codeLens"; path] -> Cli.code_lens ~path ~debug
178+
| [
179+
_; "codeAction"; path; start_line; start_col; end_line; end_col; current_file;
180+
] ->
181+
Cli.code_action ~path
182+
~start_pos:(int_of_string start_line, int_of_string start_col)
183+
~end_pos:(int_of_string end_line, int_of_string end_col)
184+
~current_file ~debug
176185
| [_; "codemod"; path; line; col; typ; hint] ->
177186
let typ =
178187
match typ with
179188
| "add-missing-cases" -> Codemod.AddMissingCases
180189
| _ -> raise (Failure "unsupported type")
181190
in
182-
let source = Files.readFile path |> Option.value ~default:"" in
191+
let source = Files.read_file path |> Option.value ~default:"" in
183192
`String
184193
(Codemod.transform ~source
185194
~pos:(int_of_string line, int_of_string col)
186195
~debug ~typ ~hint)
187196
|> Yojson.Safe.pretty_to_string ~std:true
188197
|> print_endline
189-
| [_; "diagnosticSyntax"; path] -> Cli.diagnosticSyntax ~path
198+
| [_; "diagnosticSyntax"; path] -> Cli.diagnostic_syntax ~path
190199
| [_; "references"; path; line; col] ->
191200
Cli.references ~path ~pos:(int_of_string line, int_of_string col) ~debug
192201
| [_; "prepareRename"; path; line; col] ->
193-
Cli.prepareRename ~path ~pos:(int_of_string line, int_of_string col) ~debug
194-
| [_; "rename"; path; line; col; newName] ->
202+
Cli.prepare_rename ~path ~pos:(int_of_string line, int_of_string col) ~debug
203+
| [_; "rename"; path; line; col; new_name] ->
195204
Cli.rename ~path
196205
~pos:(int_of_string line, int_of_string col)
197-
~newName ~debug
198-
| [_; "semanticTokens"; currentFile] -> Cli.semanticTokens ~path:currentFile
199-
| [_; "createInterface"; path; cmiFile] ->
200-
`String (CreateInterface.command ~path ~cmiFile)
206+
~new_name ~debug
207+
| [_; "semanticTokens"; current_file] ->
208+
Cli.semantic_tokens ~path:current_file
209+
| [_; "createInterface"; path; cmi_file] ->
210+
`String (Create_interface.command ~path ~cmi_file)
201211
|> Yojson.Safe.pretty_to_string ~std:true
202212
|> print_endline
203213
| [_; "format"; path] -> Cli.format ~path
204214
| [_; "test"; path] -> Cli.test ~path
205-
| [_; "cmt"; rescript_json; cmt_path] -> CmtViewer.dump rescript_json cmt_path
215+
| [_; "cmt"; rescript_json; cmt_path] ->
216+
Cmt_viewer.dump rescript_json cmt_path
206217
| args when List.mem "-h" args || List.mem "--help" args -> prerr_endline help
207218
| _ ->
208219
prerr_endline help;

analysis/reactive/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ build:
66

77
# Run all tests
88
test:
9-
dune build test/ReactiveTest.exe
10-
dune exec test/ReactiveTest.exe
9+
dune build test/reactive_test.exe
10+
dune exec test/reactive_test.exe
1111

1212
# Clean build artifacts
1313
clean:
1414
dune clean
15-

analysis/reactive/src/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(library
22
(name reactive)
33
(wrapped false)
4-
(private_modules ReactiveFixpoint)
4+
(private_modules reactive_fixpoint)
55
(libraries unix))
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ let source ~name () =
532532

533533
(** {1 FlatMap} *)
534534

535-
let flatMap ~name (src : ('k1, 'v1) t) ~f ?merge () : ('k2, 'v2) t =
535+
let flat_map ~name (src : ('k1, 'v1) t) ~f ?merge () : ('k2, 'v2) t =
536536
let my_level = src.level + 1 in
537537
let merge_fn =
538538
match merge with
@@ -1077,7 +1077,7 @@ let fixpoint ~name ~(init : ('k, unit) t) ~(edges : ('k, 'k list) t) () :
10771077
let my_level = max init.level edges.level + 1 in
10781078

10791079
(* Internal state *)
1080-
let state = ReactiveFixpoint.create () in
1080+
let state = Reactive_fixpoint.create () in
10811081
let subscribers = ref [] in
10821082
let my_stats = create_stats () in
10831083

@@ -1122,7 +1122,7 @@ let fixpoint ~name ~(init : ('k, unit) t) ~(edges : ('k, 'k list) t) () :
11221122
my_stats.removes_received + init_removes + edges_removes;
11231123

11241124
let output_entries =
1125-
ReactiveFixpoint.apply state ~init_entries ~edge_entries:edges_entries
1125+
Reactive_fixpoint.apply state ~init_entries ~edge_entries:edges_entries
11261126
in
11271127
emit_output output_entries
11281128
in
@@ -1145,14 +1145,15 @@ let fixpoint ~name ~(init : ('k, unit) t) ~(edges : ('k, 'k list) t) () :
11451145
Registry.mark_dirty name);
11461146

11471147
(* Initialize from existing data *)
1148-
ReactiveFixpoint.initialize state ~roots_iter:init.iter ~edges_iter:edges.iter;
1148+
Reactive_fixpoint.initialize state ~roots_iter:init.iter
1149+
~edges_iter:edges.iter;
11491150

11501151
{
11511152
name;
11521153
subscribe = (fun h -> subscribers := h :: !subscribers);
1153-
iter = (fun f -> ReactiveFixpoint.iter_current state f);
1154-
get = (fun k -> ReactiveFixpoint.get_current state k);
1155-
length = (fun () -> ReactiveFixpoint.current_length state);
1154+
iter = (fun f -> Reactive_fixpoint.iter_current state f);
1155+
get = (fun k -> Reactive_fixpoint.get_current state k);
1156+
length = (fun () -> Reactive_fixpoint.current_length state);
11561157
stats = my_stats;
11571158
level = my_level;
11581159
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ val source : name:string -> unit -> ('k, 'v) t * (('k, 'v) delta -> unit)
109109

110110
(** {1 Combinators} *)
111111

112-
val flatMap :
112+
val flat_map :
113113
name:string ->
114114
('k1, 'v1) t ->
115115
f:('k1 -> 'v1 -> ('k2 * 'v2) list) ->
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)