-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Add support for Erlang. Wait -- Erlang doesn't have annotations. That's right. But annotation reachability also supports regexps to model methods as if they were annotated, so we can use this checker for callgraph reachability in general. Reviewed By: mmarescotti Differential Revision: D65213665 fbshipit-source-id: 4d7d97b982182d9831a6069edcd682f41452ddbb
- Loading branch information
1 parent
249de1f
commit 8566303
Showing
10 changed files
with
100 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"annotation-reachability": true, | ||
"annotation-reachability-custom-pairs": [ | ||
{ | ||
"sources": ["Source"], | ||
"sinks": ["Sink"], | ||
"sanitizers": ["Sanitizer"] | ||
} | ||
], | ||
"annotation-reachability-custom-models": { | ||
"Source": [".*:.*source.*/0"], | ||
"Sink": [".*:.*sink.*/0"], | ||
"Sanitizer": [".*:.*sanitizer.*/0"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
TESTS_DIR = ../../.. | ||
|
||
INFER_OPTIONS = \ | ||
--annotation-reachability-only --debug-exceptions \ | ||
--project-root $(TESTS_DIR) --print-types | ||
|
||
INFERPRINT_OPTIONS = --issues-tests | ||
|
||
SOURCES = $(wildcard *.erl) | ||
|
||
include $(TESTS_DIR)/erlc.make | ||
|
||
infer-out/report.json: $(MAKEFILE_LIST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
codetoanalyze/erlang/annotreach/reach.erl, test_source2_Bad/0, 0, CHECKERS_ANNOTATION_REACHABILITY_ERROR, no_bucket, ERROR, [Method test_source2_Bad/0, marked as source @Source,calls sink/0,sink/0 defined here, marked as sink @Sink] | ||
codetoanalyze/erlang/annotreach/reach.erl, test_source4_Bad/0, 0, CHECKERS_ANNOTATION_REACHABILITY_ERROR, no_bucket, ERROR, [Method test_source4_Bad/0, marked as source @Source,calls not_sani_tizer/0,not_sani_tizer/0 defined here,calls sink/0,sink/0 defined here, marked as sink @Sink] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
% Copyright (c) Facebook, Inc. and its affiliates. | ||
% | ||
% This source code is licensed under the MIT license found in the | ||
% LICENSE file in the root directory of this source tree. | ||
|
||
-module(reach). | ||
|
||
-export([ | ||
test_source1_Ok/0, | ||
test_source2_Bad/0, | ||
test_source3_Ok/0, | ||
test_source4_Bad/0, test_source5_Ok/0 | ||
]). | ||
|
||
sink() -> ok. | ||
|
||
not_si_nk() -> ok. | ||
|
||
not_sink_because_arity(X) -> X. | ||
|
||
sanitizer() -> sink(). | ||
|
||
not_sani_tizer() -> sink(). | ||
|
||
test_source1_Ok() -> not_si_nk(). | ||
|
||
test_source2_Bad() -> sink(). | ||
|
||
test_source3_Ok() -> sanitizer(). | ||
|
||
test_source4_Bad() -> not_sani_tizer(). | ||
|
||
test_source5_Ok() -> not_sink_because_arity(1). |