You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
match stmts with|s :: st -> (
match s with|RETURNret_e -> (
match ret_e with|LITERALCVOID -> is_correct_void st (r &&true)
|_ -> is_correct_void st (r &&false))
|_ -> is_correct_void st r)
|_ -> r
match n with
| "malloc" -> (
match vals with| ...)
|"free" -> (
match vals with| ...)
|"sizeof" -> (
match vals with| ...)
|"main" -> ...
Exceptions
failwith
Using of List.hd_exn may be error-prone
Matching with _ exception
Catching Failure _ exception
Suggest function name with _exn suffix when function can throw an exception.
Kakadu
changed the title
Add lints detected in fp2020/2021/2022 programming course
Add lints detected in fp2020/2021/2022/2023 programming course
Feb 29, 2024
match ... with _ as x -> ....
and jump_stmt = None | Break | Continue | Return of v_value
if true then ...
if ... then true else false
... ^ ... ^ ...
may not be efficient| Foo x when x = true -> ...
~~~>| Foo true -> ....
Instead of matching a pair recommend 'let' #13
into
Match on bool when scrutinee starts with
not
Rewrite
fun e -> match e with ...
tofunction ...
if possiblefunction
here tooUse match instead of
if x = WasReturn then ... else if x = WasContinue then .. else ...
(related to the lint "use_match_instead_of_equality" which checks only for lists, options, etc...) #27| Return rexpr_o -> ( match rexpr_o with ... )
Recommend or-patterns when possible
Detect same RHSes
See also Warn about logical or between identical arguments. #42
Recommend nested matching
failwith
List.hd_exn
may be error-prone_
exceptionFailure _
exception_exn
suffix when function can throw an exception.{ e=f.e; g=f.g; h=189 }
to{ f with h = 189 }
#10{ key = fkey; foo = _; bar = _ }
to{ key = fkey; _ }
Adding stuff to Monad signature that doesn't belong there
Propose applicatives
Simplify artifacts from pretty printting #48
"\"%s\""
to"%S"
#53(fun arg1...argN -> IDENT arg1 ... argN)
suites and only them... :: [ ... ]
smell badlet ctx = ctx in ...
return @@ Vchar v
we should probably recommend parenthesis>>= fun ident -> return ident
andfun (ctx', pls) -> return (ctx', pls)
... :: [ ... ]
smells bad(t' :: ts') @ acc
smells bad. Proposet' :: (ts' @ ac)
[@@deriving sexp]
introduce code with assignments.concat_map
filter_map
List.to_seq [ eff ]
=>Seq.return eff
Rewritefun cd -> let f ... = (* no use of cd *) in ...
tolet f ... = ... in fun cd -> ...
print_string ...
should belet () = ...
@@
вreturn @@ Nil
return @@ (x+y)
return @@ (get_var_ctx_from_ctx i e_env).value
{| ... |}
when a normal string literal has too many '\n'(cram (deps ....)
(fun (ptrn, _) -> ptrn)
->fst
The text was updated successfully, but these errors were encountered: