Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update error message for nested match, fix style and comments #89

Merged
merged 4 commits into from
Aug 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/style/verbose.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module TupleProj : EXPRCHECK = struct
let name = "TupleProj", check
end

(** ----------------------- Checks rules: Nesting if >= 3 levels ------------- *)
(** ----------------------- Checks rules: Nesting if > 3 levels ------------- *)
module NestedIf : EXPRCHECK = struct
type ctxt = Parsetree.expression_desc Pctxt.pctxt
let fix = "using let statements or helper methods / rethinking logic"
Expand All @@ -45,9 +45,9 @@ module NestedIf : EXPRCHECK = struct
depth = 0 ||
begin match p with
| Pexp_ifthenelse (_, bthen, Some belse) ->
if depth = 1 then true else
find_nesting ((skip_seq_let bthen).pexp_desc) (depth - 1) ||
find_nesting ((skip_seq_let belse).pexp_desc) (depth - 1)
depth = 1
|| find_nesting ((skip_seq_let bthen).pexp_desc) (depth - 1)
|| find_nesting ((skip_seq_let belse).pexp_desc) (depth - 1)
| _ -> false
end
in
Expand All @@ -59,7 +59,7 @@ end
module NestedMatch : EXPRCHECK = struct
type ctxt = Parsetree.expression_desc Pctxt.pctxt
let fix = "using let statements or helper methods / rethinking logic"
let violation = "using nested match statements more than three layers deep"
let violation = "using nested match statements three or more layers deep"
let check st (E {location; source; pattern} : ctxt) =
begin match pattern with
(* Layer one *)
Expand Down