Skip to content

Commit 5c04e6d

Browse files
committed
build: ensure we exit with correct error code when not failing fast
--- 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: na - 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 1de4fb4 commit 5c04e6d

File tree

1 file changed

+40
-15
lines changed

1 file changed

+40
-15
lines changed

tools/make/lib/lint/javascript/eslint.mk

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,16 @@ ifeq ($(FAIL_FAST), true)
9191
$(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF) $$file || exit 1; \
9292
done
9393
else
94-
$(QUIET) $(FIND_SOURCES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
94+
$(QUIET) status=0; \
95+
for file in $$($(FIND_SOURCES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]'); do \
9596
echo ''; \
9697
echo "Linting file: $$file"; \
97-
$(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF) $$file || echo 'Linting failed.'; \
98-
done
98+
if ! $(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF) $$file; then \
99+
echo 'Linting failed.'; \
100+
status=1; \
101+
fi; \
102+
done; \
103+
exit $$status;
99104
endif
100105

101106
.PHONY: eslint-src
@@ -127,11 +132,16 @@ ifeq ($(FAIL_FAST), true)
127132
$(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF_TESTS) $$file || exit 1; \
128133
done
129134
else
130-
$(QUIET) $(FIND_TESTS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
135+
$(QUIET) status=0; \
136+
for file in $$($(FIND_TESTS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]'); do \
131137
echo ''; \
132138
echo "Linting file: $$file"; \
133-
$(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF_TESTS) $$file || echo 'Linting failed.'; \
134-
done
139+
if ! $(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF_TESTS) $$file; then \
140+
echo 'Linting failed.'; \
141+
status=1; \
142+
fi; \
143+
done; \
144+
exit $$status;
135145
endif
136146

137147
.PHONY: eslint-tests
@@ -163,11 +173,16 @@ ifeq ($(FAIL_FAST), true)
163173
$(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF_EXAMPLES) $$file || exit 1; \
164174
done
165175
else
166-
$(QUIET) $(FIND_EXAMPLES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
176+
$(QUIET) status=0; \
177+
for file in $$($(FIND_EXAMPLES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]'); do \
167178
echo ''; \
168179
echo "Linting file: $$file"; \
169-
$(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF_EXAMPLES) $$file || echo 'Linting failed.'; \
170-
done
180+
if ! $(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF_EXAMPLES) $$file; then \
181+
echo 'Linting failed.'; \
182+
status=1; \
183+
fi; \
184+
done; \
185+
exit $$status;
171186
endif
172187

173188
.PHONY: eslint-examples
@@ -199,11 +214,16 @@ ifeq ($(FAIL_FAST), true)
199214
$(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF_BENCHMARKS) $$file || exit 1; \
200215
done
201216
else
202-
$(QUIET) $(FIND_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
217+
$(QUIET) status=0; \
218+
for file in $$($(FIND_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]'); do \
203219
echo ''; \
204220
echo "Linting file: $$file"; \
205-
$(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF_BENCHMARKS) $$file || echo 'Linting failed.'; \
206-
done
221+
if ! $(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF_BENCHMARKS) $$file; then \
222+
echo 'Linting failed.'; \
223+
status=1; \
224+
fi; \
225+
done; \
226+
exit $$status;
207227
endif
208228

209229
.PHONY: eslint-benchmarks
@@ -232,11 +252,16 @@ ifeq ($(FAIL_FAST), true)
232252
$(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF) $$file || exit 1; \
233253
done
234254
else
235-
$(QUIET) for file in $(FILES); do \
255+
$(QUIET) status=0; \
256+
for file in $(FILES); do \
236257
echo ''; \
237258
echo "Linting file: $$file"; \
238-
$(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF) $$file || echo 'Linting failed.'; \
239-
done
259+
if ! $(ESLINT) $(ESLINT_FLAGS) --config $(ESLINT_CONF) $$file; then \
260+
echo 'Linting failed.'; \
261+
status=1; \
262+
fi; \
263+
done; \
264+
exit $$status;
240265
endif
241266

242267
.PHONY: eslint-files

0 commit comments

Comments
 (0)