Skip to content

Commit 7995f33

Browse files
committed
build: handle Makefiles and gyp files in script adding trailing newlines
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: passed - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 0e81d53 commit 7995f33

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

.github/workflows/scripts/add_trailing_newlines

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ set -o pipefail
3333
# VARIABLES #
3434

3535
# List of file extensions to process:
36-
extensions=("js" "mjs" "cjs" "json" "ts" "py" "jl" "R" "c" "h" "cpp" "hpp" "f" "sh" "awk" "html" "xml" "css" "md" "yml" "gypi" "bib" "tex")
36+
extensions=("js" "mjs" "cjs" "json" "ts" "py" "jl" "R" "c" "h" "cpp" "hpp" "f" "sh" "awk" "html" "xml" "css" "md" "yml" "gyp" "gypi" "bib" "tex" "mk")
3737

3838

3939
# FUNCTIONS #
@@ -70,13 +70,19 @@ main() {
7070
convert_line_endings "$file"
7171

7272
extension="${file##*.}"
73+
filename=$(basename "$file")
74+
7375
local match_found=false
74-
for ext in "${extensions[@]}"; do
75-
if [[ "$ext" == "$extension" ]]; then
76-
match_found=true
77-
break
78-
fi
79-
done
76+
if [[ "$filename" == "Makefile" ]]; then
77+
match_found=true
78+
elif [[ "$file" == *.* ]]; then
79+
for ext in "${extensions[@]}"; do
80+
if [[ "$ext" == "$extension" ]]; then
81+
match_found=true
82+
break
83+
fi
84+
done
85+
fi
8086
if [[ "$match_found" == true ]]; then
8187
if [[ "$(tail -c1 "$file"; echo x)" != $'\nx' ]]; then
8288
echo "Adding newline to: $file"

0 commit comments

Comments
 (0)