Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
-> Added a script so you can count how many lines of code the app has :)
  • Loading branch information
NaysKutzu committed Jul 25, 2024
1 parent e665005 commit 5ec048a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
Empty file modified FIRST_INSTALL
100755 → 100644
Empty file.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"bash devtools/push.bash",
"git push origin develop",
"composer run tests",
"composer run lint"
"composer run lint",
"bash devtools/count_php_lines.bash"
],
"pull": [
"export COMPOSER_ALLOW_SUPERUSER=1",
Expand Down
36 changes: 36 additions & 0 deletions devtools/count_php_lines.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Set the directory to search for PHP files
directory="./"

# Initialize the line count
line_count=0

apt install bc -y >> /dev/null 2>&1

# Function to recursively count lines of code in PHP files
count_lines() {
local dir="$1"
local files=$(find "$dir" -type f -name "*.php" ! -path "*/node_modules/*" ! -path "*/vendor/*")

for file in $files; do
# Count the lines of code in the file and add it to the line count
lines=$(wc -l < "$file")
line_count=$((line_count + lines))
done
}

# Call the function to count lines of code
count_lines "$directory"

# Format the line count
if (( line_count >= 1000000 )); then
formatted_count=$(printf "%.2fM" "$(bc -l <<< "$line_count/1000000")")
elif (( line_count >= 1000 )); then
formatted_count=$(printf "%.2fK" "$(bc -l <<< "$line_count/1000")")
else
formatted_count=$line_count
fi

# Print the total line count
echo "Total lines of code: $formatted_count"
Empty file modified settings.json
100755 → 100644
Empty file.

0 comments on commit 5ec048a

Please sign in to comment.