-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (42 loc) · 1.56 KB
/
reflection.yml
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
name: "Test HTML Reflection not broken"
# Some classes may not reflect, to make sure we are not breaking the runners we search for known blacklist imports
on:
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request:
jobs:
check-blacklist-imports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
# Install required tools
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "corretto"
java-version: "11"
- name: Define blacklisted packages and directories
run: |
# List of forbidden imports (blacklisted packages)
BLACKLIST=("java.nio.file")
# List of relative directories to search (after java/)
RELATIVE_SEARCH_DIRS=("runner" "state" "project" "tools" "utils/io/data" "utils/log")
# Base directory
BASE_DIR="src/main/java/org/ois/core"
# Loop over the blacklist
for forbidden_pkg in "${BLACKLIST[@]}"; do
# Search for forbidden imports in the specified relative directories
for dir in "${RELATIVE_SEARCH_DIRS[@]}"; do
FULL_PATH="$BASE_DIR/$dir"
if grep -rnw "$FULL_PATH" -e "import $forbidden_pkg" --include \*.java; then
echo "Error: Found forbidden import: $forbidden_pkg in $dir"
exit 1
fi
done
done
echo "No forbidden imports found."