Opinionated OCaml linter with Merlin integration for code quality, naming conventions, and style checks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): suppress E310/E331 false positives, restore cla.ml module names

- E310: Skip uppercase names (first-class module bindings like (module M))
- E331: Skip suggestions when bare name would clash with existing value
- Revert cla.ml module variable from C back to M (idiomatic)

+22 -8
+8 -4
lib/rules/e310.ml
··· 16 16 else false 17 17 18 18 let check_value_name name = 19 - let expected = Naming.to_lowercase_snake_case name in 20 - if name <> expected && name <> String.lowercase_ascii name then 21 - if is_valid_snake_case_with_suffix name then None else Some expected 22 - else None 19 + (* Skip names starting with uppercase: these are first-class module bindings 20 + like (module M) which must be uppercase in OCaml *) 21 + if name <> "" && name.[0] >= 'A' && name.[0] <= 'Z' then None 22 + else 23 + let expected = Naming.to_lowercase_snake_case name in 24 + if name <> expected && name <> String.lowercase_ascii name then 25 + if is_valid_snake_case_with_suffix name then None else Some expected 26 + else None 23 27 24 28 let check (ctx : Context.file) = 25 29 let filename = ctx.filename in
+14 -4
lib/rules/e331.ml
··· 59 59 else None 60 60 in 61 61 62 + (* Collect all value names to detect clashes *) 63 + let existing_names = 64 + List.filter_map 65 + (fun (item : Outline.item) -> 66 + match item.kind with Outline.Value -> Some item.name | _ -> None) 67 + outline_data 68 + in 69 + 62 70 List.filter_map 63 71 (fun (item : Outline.item) -> 64 72 let name = item.name in ··· 68 76 | Outline.Value, Some loc -> ( 69 77 (* Check for regular function prefix patterns *) 70 78 match check_function_prefix name with 71 - | Some (prefix_type, suggested) -> 79 + | Some (prefix_type, suggested) 80 + when not (List.mem suggested existing_names) -> 72 81 Some 73 82 (Issue.v ~loc 74 83 { ··· 77 86 prefix_type; 78 87 context = name; 79 88 }) 80 - | None -> ( 89 + | Some _ | None -> ( 81 90 (* Check for Module.create_module pattern *) 82 91 match check_module_create_prefix name with 83 - | Some (prefix_type, suggested) -> 92 + | Some (prefix_type, suggested) 93 + when not (List.mem suggested existing_names) -> 84 94 Some 85 95 (Issue.v ~loc 86 96 { ··· 90 100 context = 91 101 String.capitalize_ascii module_name ^ "." ^ name; 92 102 }) 93 - | None -> None)) 103 + | Some _ | None -> None)) 94 104 | _ -> None) 95 105 outline_data 96 106