Troubleshooting of Sonar issue: Difference between revisions
Jump to navigation
Jump to search
→How to resolve "Add a new line at the end of this file."
| Line 21: | Line 21: | ||
# Retrieve the directory path argument | # Retrieve the directory path argument | ||
dir_path="$1" | dir_path="$1" | ||
# Initialize a counter for modified files | |||
modified_count=0 | |||
# Iterate through all .php files in the specified directory | # Iterate through all .php files in the specified directory | ||
| Line 33: | Line 36: | ||
# If it's not empty, append a newline character | # If it's not empty, append a newline character | ||
echo "" >> "$file" | echo "" >> "$file" | ||
# Increment the modified files counter | |||
((modified_count++)) | |||
fi | fi | ||
fi | fi | ||
done | done | ||
# Display the number of modified files | |||
echo "Number of modified files: $modified_count" | |||