File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ name : ProjectStructure
3
+
4
+ ' on ' :
5
+ workflow_dispatch :
6
+ push :
7
+ branches :
8
+ - master
9
+ pull_request :
10
+
11
+ jobs :
12
+ check_structure :
13
+ runs-on : ubuntu-latest
14
+ steps :
15
+ - uses : actions/checkout@v4
16
+ - uses : actions/setup-python@v5
17
+ with :
18
+ python-version : ' 3.13'
19
+
20
+ - name : Check project structure
21
+ run : python3 .github/workflows/scripts/check_structure.py
22
+ ...
Original file line number Diff line number Diff line change
1
+ import pathlib
2
+ import sys
3
+
4
+
5
+ def _is_java_file_properly_located (java_file : pathlib .Path ) -> bool :
6
+ main_parents = java_file .parent .parents
7
+ return (
8
+ pathlib .Path ("src/main/java/com/thealgorithms/" ) in main_parents
9
+ or pathlib .Path ("src/test/java/com/thealgorithms/" ) in main_parents
10
+ )
11
+
12
+
13
+ def _find_misplaced_java_files () -> list [pathlib .Path ]:
14
+ return [
15
+ java_file
16
+ for java_file in pathlib .Path ("." ).rglob ("*.java" )
17
+ if not _is_java_file_properly_located (java_file )
18
+ ]
19
+
20
+
21
+ if __name__ == "__main__" :
22
+ misplaced_files = _find_misplaced_java_files ()
23
+ if misplaced_files :
24
+ print ("The following java files are not located in the correct directory:" )
25
+ for _ in misplaced_files :
26
+ print (_ )
27
+ sys .exit (1 )
You can’t perform that action at this time.
0 commit comments