Skip to content

Commit 9ae5986

Browse files
add ahrefs profile in tests (#2695)
1 parent e20f518 commit 9ae5986

File tree

389 files changed

+44034
-0
lines changed

Some content is hidden

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

389 files changed

+44034
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
profile=default
2+
ocaml-version=4.14.0
3+
4+
break-cases=toplevel
5+
break-infix-before-func=false
6+
break-infix=fit-or-vertical
7+
cases-exp-indent=2
8+
doc-comments=before
9+
exp-grouping=preserve
10+
leading-nested-match-parens=true
11+
let-and=sparse
12+
m=80
13+
max-indent=2
14+
module-item-spacing=preserve
15+
nested-match=align
16+
parens-ite=true
17+
parens-tuple=multi-line-only
18+
parse-docstrings=false
19+
type-decl=sparse
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let sum_of_squares num =
2+
num + 1
3+
|> List.range 0
4+
|> List.map ~f:square
5+
|> List.fold_left ~init:0 ~f:( + )
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
let file_contents = [] @ [ foo ] @ [ bar ]
2+
3+
let _ =
4+
match s.src with
5+
| None -> [ zz ] + 2
6+
| Some s ->
7+
[ Variable (s_src, OpamFormat.make_string (OpamFilename.to_string s)); yy ];
8+
foo
9+
| Some s ->
10+
{ fww = s_src, OpamFormat.make_string (OpamFilename.to_string s); gdd = yy }
11+
12+
let _ = [ x; y ] @ z
13+
14+
let _ = [ x; y ] @ z
15+
16+
let _ = [ x; y ] @ z
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
let _ = List.map ~f:(( + ) (M.f x))
2+
3+
let id x = x
4+
5+
let plus a ?(b = 0) c = a + b + c;;
6+
7+
id (plus 1) ~b:1;;
8+
9+
(* The version above does not type-check, while the version below does
10+
type-check, and should not be formatted to the above. See
11+
https://caml.inria.fr/mantis/view.php?id=7832 for explanation on the
12+
type-checking (and dynamic semantics) distinction. *)
13+
14+
(id (plus 1)) ~b:1;;
15+
16+
let ( !!! ) a ~b = a + b
17+
18+
let _ = ( !!! ) a b
19+
20+
let _ = ( !!! ) ~b
21+
22+
let _ = !!!!a b d
23+
24+
let _ = ( + ) a b c d
25+
26+
let cartesian_product l1 l2 =
27+
List.concat (l1 |> List.map (fun v1 -> l2 |> List.map (fun v2 -> v1, v2)))
28+
29+
let cartesian_product' long_list_one long_list_two =
30+
List.concat
31+
(long_list_one
32+
|> List.map (fun v1 -> long_list_two |> List.map (fun v2 -> v1, v2)))
33+
34+
let whatever a_function_name long_list_one some_other_thing =
35+
List.map
36+
(fun long_list_one_elt ->
37+
do_something_with_a_function_and_some_things a_function_name
38+
long_list_one_elt some_other_thing)
39+
long_list_one
40+
41+
let whatever_labelled a_function_name long_list_one some_other_thing =
42+
ListLabels.map long_list_one ~f:(fun long_list_one_elt ->
43+
do_something_with_a_function_and_some_things a_function_name
44+
long_list_one_elt some_other_thing)
45+
46+
let eradicate_meta_class_is_nullsafe =
47+
register ~id:"ERADICATE_META_CLASS_IS_NULLSAFE"
48+
~hum:"Class is marked @Nullsafe and has 0 issues"
49+
(* Should be enabled for special integrations *)
50+
~enabled:false Info Eradicate (* TODO *)
51+
~user_documentation:""
52+
53+
let eradicate_meta_class_is_nullsafe =
54+
register
55+
~id:"ERADICATE_META_CLASS_IS_NULLSAFE"
56+
(* Should be enabled for special integrations *)
57+
~hum:"Class is marked @Nullsafe and has 0 issues"
58+
(* Should be enabled for special integrations *)
59+
~enabled:false Info
60+
61+
[@@@ocamlformat "indicate-multiline-delimiters=closing-on-separate-line"]
62+
63+
let cartesian_product' long_list_one long_list_two =
64+
List.concat
65+
(long_list_one
66+
|> List.map (fun v1 -> long_list_two |> List.map (fun v2 -> v1, v2))
67+
)
68+
69+
let whatever a_function_name long_list_one some_other_thing =
70+
List.map
71+
(fun long_list_one_elt ->
72+
do_something_with_a_function_and_some_things a_function_name
73+
long_list_one_elt some_other_thing
74+
)
75+
long_list_one
76+
77+
let whatever_labelled a_function_name long_list_one some_other_thing =
78+
ListLabels.map long_list_one ~f:(fun long_list_one_elt ->
79+
do_something_with_a_function_and_some_things a_function_name
80+
long_list_one_elt some_other_thing
81+
)
82+
;;
83+
84+
(a - b) ();;
85+
86+
((a - b) [@foo]) ();;
87+
88+
let _ = M.(loooooooooooooooooooooong + loooooooooooooooooong)
89+
90+
let _ =
91+
M.(
92+
loooooooooooooooooooooong
93+
+ loooooooooooooooooong
94+
+ llllllllllloooooooooooooooooonnnnnnnnnnnnnggggggggggg
95+
)
96+
97+
let _ =
98+
i'm_a_function loooooooooooong
99+
(loooooooooooong looooooooooooooong loooooooooooooong
100+
[ loooooooooong; loooooooooooong; loooooooooooooooooooooong ]
101+
)
102+
103+
let f (x :: y) = x
104+
105+
let f (* xx *) ((* aa *) x (* bb *) :: (* cc *) y (* dd *)) (* yy *) = x
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module _ = F (functor (X : T) -> X)
2+
module _ =
3+
F
4+
(functor
5+
(X____________________________ : T)
6+
->
7+
X____________________________)
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
let nullsafe_optimistic_third_party_params_in_non_strict =
2+
CLOpt.mk_bool
3+
~long:"nullsafe-optimistic-third-party-params-in-non-strict"
4+
(* Turned on for compatibility reasons. Historically this is because
5+
there was no actionable way to change third party annotations. Now
6+
that we have such a support, this behavior should be reconsidered,
7+
provided our tooling and error reporting is friendly enough to be
8+
smoothly used by developers. *)
9+
~default:true
10+
"Nullsafe: in this mode we treat non annotated third party method params as if they were \
11+
annotated as nullable."
12+
13+
let test_file_renamings_from_json =
14+
let create_test test_input expected_output _ =
15+
let test_output input =
16+
DifferentialFilters.FileRenamings.VISIBLE_FOR_TESTING_DO_NOT_USE_DIRECTLY.from_json input
17+
in
18+
foo
19+
in
20+
fooooooooooooooo
21+
22+
let eval location exp0 astate =
23+
let rec eval exp astate =
24+
match (exp : Exp.t) with
25+
| Var id -> Ok (eval_var (* error in case of missing history? *) [] (Var.of_id id) astate)
26+
| Lvar pvar ->
27+
Ok (eval_var [ ValueHistory.VariableAccessed (pvar, location) ] (Var.of_pvar pvar) astate)
28+
| Lfield (exp', field, _) -> goooooooo
29+
in
30+
fooooooooooooooooooooo
31+
32+
let declare_locals_and_ret tenv pdesc (prop_ : Prop.normal Prop.t) =
33+
let foooooooooooooo =
34+
BiabductionConfig.run_in_re_execution_mode
35+
(* no footprint vars for locals *)
36+
sigma_locals_and_ret ()
37+
in
38+
fooooooooooooooooooooooooooo
39+
40+
let bottom_up fooooooooooo =
41+
let empty = Int.equal 0 !scheduled && Queue.is_empty pending in
42+
if empty then (
43+
remaining := 0;
44+
L.progress "Finished call graph scheduling, %d procs remaining (in, or reaching, cycles).@."
45+
(CallGraph.n_procs syntactic_call_graph);
46+
if Config.debug_level_analysis > 0 then CallGraph.to_dotty syntactic_call_graph "cycles.dot";
47+
foooooooooooooooooo)
48+
else fooooooooooooooooo
49+
50+
let test_file_renamings_from_json =
51+
let fooooooooooooo =
52+
match expected_output with
53+
| Return exp ->
54+
assert_equal ~pp_diff
55+
~cmp:DifferentialFilters.FileRenamings.VISIBLE_FOR_TESTING_DO_NOT_USE_DIRECTLY.equal exp
56+
(test_output test_input)
57+
| Raise exc -> assert_raises exc (fun () -> test_output test_input)
58+
in
59+
foooooooooooooooo
60+
61+
let gen_with_record_deps ~expand t resolved_forms ~dep_kind =
62+
let foooooooooooooooooooooo =
63+
expand
64+
(* we keep the dir constant here to replicate the old behavior of:
65+
(chdir foo %{exe:bar}). This should lookup ./bar rather than
66+
./foo/bar *)
67+
resolved_forms ~dir:t.dir ~dep_kind ~expand_var:t.expand_var
68+
in
69+
{ t with expand_var }
70+
71+
let f =
72+
very_long_function_name
73+
~very_long_variable_name:(very_long expression)
74+
(* this is a
75+
multiple-line-spanning
76+
comment *)
77+
~y
78+
79+
let eradicate_meta_class_is_nullsafe =
80+
register ~id:"ERADICATE_META_CLASS_IS_NULLSAFE"
81+
~hum:"Class is marked @Nullsafe and has 0 issues"
82+
(* Should be enabled for special integrations *)
83+
~enabled:false Info Eradicate (* TODO *)
84+
~user_documentation:""
85+
86+
let eradicate_meta_class_is_nullsafe =
87+
register ~id:"ERADICATE_META_CLASS_IS_NULLSAFE" (* Should be enabled for special integrations *)
88+
~hum:"Class is marked @Nullsafe and has 0 issues"
89+
(* Should be enabled for special integrations *)
90+
~enabled:false Info
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[|
2+
1222222;
3+
1222222;
4+
1222222;
5+
1222222;
6+
1222222;
7+
1222222;
8+
1222222;
9+
1222222;
10+
1222222;
11+
1222222;
12+
1222222;
13+
1222222;
14+
1222222;
15+
1222222;
16+
1222222;
17+
1222222;
18+
1222222;
19+
1222222;
20+
|]
21+
;;
22+
23+
let f = function
24+
| [|
25+
1222222;
26+
1222222;
27+
1222222;
28+
1222222;
29+
1222222;
30+
1222222;
31+
1222222;
32+
1222222;
33+
1222222;
34+
1222222;
35+
1222222;
36+
1222222;
37+
1222222;
38+
1222222;
39+
1222222;
40+
1222222;
41+
1222222;
42+
1222222;
43+
|] ->
44+
()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Warning: assignment_operator-op_begin_line.ml:62 exceeds the margin
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
let foo =
2+
entry.logdata.value_end
3+
:= entry.logdata.value_end - !remove_size + testtesttest;
4+
entry.logdata.value_end
5+
:= (entry.logdata.value_end - !remove_size + testtesttest) [@foo];
6+
(* foooooooooo *)
7+
entry.logdata.value_end
8+
:= (entry.logdata.value_end - !remove_size + testtesttest) [@foo]
9+
(* foooooooooooo *);
10+
entry.logdata.value_end
11+
:= entry.logdata.value_end - !remove_size + testtesttest
12+
(* fooooooooooooooooooooooooo *);
13+
value_end
14+
:= entry.logdata.value_end - !remove_size + testtesttesttesttesttesttest;
15+
value_end
16+
:= (entry.logdata.value_end
17+
- !remove_size
18+
+ testtesttesttesttesttesttest)
19+
[@foo];
20+
value_end
21+
:= (entry.logdata.value_end
22+
- !remove_size
23+
+ testtesttesttesttesttesttest)
24+
[@foo]
25+
(* fooooooooooooo *);
26+
(* foooooooooooooooooooo *)
27+
value_end
28+
:= entry.logdata.value_end - !remove_size + testtesttesttesttesttesttest
29+
(* foooooooo *);
30+
foo
31+
32+
let _ =
33+
r (* _________________________________________________________________ *) := 1
34+
35+
let _ =
36+
r
37+
(* _________________________________________________________________ *)
38+
(* _________________________________________________________________ *) := 1
39+
40+
let _ =
41+
r := (* _________________________________________________________________ *) 1
42+
43+
let _ =
44+
r
45+
:= (* _________________________________________________________________ *)
46+
(* _________________________________________________________________ *)
47+
1
48+
49+
let _ =
50+
r (* _________________________________________________________________ *)
51+
:= (* _________________________________________________________________ *) 1
52+
53+
let _ =
54+
r
55+
(* _________________________________________________________________ *)
56+
(* _________________________________________________________________ *)
57+
:= (* _________________________________________________________________ *)
58+
(* _________________________________________________________________ *)
59+
1
60+
61+
let _ =
62+
aaaaaaa
63+
(* __________________________________________________________________________________ *)
64+
:= bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Warning: assignment_operator.ml:64 exceeds the margin

0 commit comments

Comments
 (0)