File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 18
18
python-version : ' 3.13'
19
19
20
20
- name : Check project structure
21
- run : python3 check_structure.py
21
+ run : python3 .github/workflows/scripts/ check_structure.py
22
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