Skip to content

Commit 5905286

Browse files
committed
Enhance PR validation script to enforce directory structure for language files
1 parent 321b065 commit 5905286

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/scripts/validate-pr.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@ while IFS= read -r file; do
5656
;;
5757
esac
5858

59-
# Check directory structure
59+
# Check directory structure - must be in Language/Category or Language/Category/Subcategory
6060
if [[ "$file" =~ \.(c|cpp|java|py|js|ts|go|rs|kt|swift|php|rb|cs|dart|scala)$ ]]; then
61-
if [[ ! "$dir" =~ (algorithms|data_structures|dynamic_programming|projects|graph|sorting|searching) ]]; then
62-
invalid_files+=("$file: Should be in proper subdirectory (algorithms/, data_structures/, etc.)")
61+
# Check if file is in a valid language directory with at least one subdirectory
62+
if [[ ! "$dir" =~ ^(C|CPP|Java|Python|JavaScript|TypeScript|Go|Rust|Kotlin|Swift|PHP|Ruby|CSharp|Dart|Scala)/ ]]; then
63+
invalid_files+=("$file: Must be in a language directory (C/, CPP/, Java/, Python/, etc.)")
64+
elif [[ ! "$dir" =~ (algorithms|data_structures|dynamic_programming|projects) ]]; then
65+
invalid_files+=("$file: Should be in proper category (algorithms/, data_structures/, dynamic_programming/, or projects/)")
6366
fi
6467
fi
6568
done <<< "$changed_files"

0 commit comments

Comments
 (0)