-
Notifications
You must be signed in to change notification settings - Fork 396
/
Makefile
65 lines (60 loc) · 1.55 KB
/
Makefile
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# Check rule validity and check that semgrep finds the expected findings.
# See https://semgrep.dev/docs/writing-rules/testing-rules for more info.
#
# The semgrep repo (and now semgrep-pro repo) also runs those tests as part
# of its CI for consistency.
#
.PHONY: test
test:
$(MAKE) validate
$(MAKE) test-only
# Use the SEMGREP env variable to specify a non-standard semgrep command
SEMGREP ?= semgrep
.PHONY: test-only
#old: pysemgrep --test was also using flags below but not needed
# --test-ignore-todo --strict --disable-version-check --metrics=off --verbose
test-only:
$(SEMGREP) test --pro .
# TODO: semgrep validate use a different targeting than 'semgrep test'
# so we unfortunately need this whitelist of dirs because it reports
# errors on stats/ and scripts/ (and .github/workflows/) files otherwise
# (we also skip libsonnet/ and trusted_python/ which do not contain rules)
LANG_DIRS=\
bash \
c \
clojure \
csharp \
dockerfile \
generic \
go \
html \
java \
javascript \
json \
kotlin \
ocaml \
php \
python \
ruby \
rust \
scala \
solidity \
swift \
terraform \
typescript \
yaml
PRO_DIRS=apex elixir
OTHER_DIRS=ai problem-based-packs
DIRS=$(LANG_DIRS) $(PRO_DIRS) $(OTHER_DIRS)
.PHONY: validate
#old: pysemgrep --validate was also using the flags below but not needed
# --strict --disable-version-check --metrics=off --verbose
validate:
$(SEMGREP) validate --pro $(DIRS)
.PHONY: test-oss-only
test-oss-only:
@for dir in $(LANG_DIRS) $(OTHER_DIRS); do \
echo "processing $$dir"; \
$(SEMGREP) test $$dir; \
done