forked from facebook/pyre-check
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck.ml
42 lines (36 loc) · 1.2 KB
/
check.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(* Copyright (c) 2016-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree. *)
open Core
open Ast
module Error = AnalysisError
module type Signature = sig
val name : string
val run
: configuration:Configuration.Analysis.t ->
environment:(module Environment.Handler) ->
source:Source.t ->
Error.t list
end
let checks : (module Signature) String.Map.t =
let checks : (string * (module Signature)) list =
[ "awaitable", (module AwaitableCheck);
"deobfuscation", (module DeobfuscationCheck);
"immutable_collection", (module ImmutableCollectionCheck);
"inference", (module Inference);
"typeCheck", (module TypeCheck) ]
in
String.Map.of_alist_exn checks
let checks ~configuration:{ Configuration.Analysis.infer; additional_checks; _ }
: (module Signature) list
=
let checks_to_run = if infer then ["inference"] else "typeCheck" :: additional_checks in
let find name =
match Map.find checks name with
| Some check -> Some check
| None ->
Log.warning "Could not find check `%s`." name;
None
in
List.filter_map checks_to_run ~f:find