Skip to content

Commit 9bc4812

Browse files
committed
Add support for ignoring failed files
1 parent 7f449e4 commit 9bc4812

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

tools/make/lib/lint/python/pycodestyle.mk

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,19 @@ endif
6262
# This target lints only Python source files.
6363

6464
pycodestyle-src:
65+
ifeq ($(FAIL_FAST), true)
6566
$(QUIET) $(FIND_PYTHON_SOURCES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
6667
echo ''; \
6768
echo "Linting code style: $$file"; \
6869
$(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$file || exit 1; \
6970
done
71+
else
72+
$(QUIET) $(FIND_PYTHON_SOURCES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
73+
echo ''; \
74+
echo "Linting code style: $$file"; \
75+
$(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$file; \
76+
done
77+
endif
7078

7179
.PHONY: pycodestyle-src
7280

@@ -76,11 +84,19 @@ pycodestyle-src:
7684
# This target lints only Python test fixture files.
7785

7886
pycodestyle-tests-fixtures:
87+
ifeq ($(FAIL_FAST), true)
7988
$(QUIET) $(FIND_PYTHON_TESTS_FIXTURES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
8089
echo ''; \
8190
echo "Linting code style: $$file"; \
8291
$(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$file || exit 1; \
8392
done
93+
else
94+
$(QUIET) $(FIND_PYTHON_TESTS_FIXTURES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
95+
echo ''; \
96+
echo "Linting code style: $$file"; \
97+
$(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$file; \
98+
done
99+
endif
84100

85101
.PHONY: pycodestyle-tests-fixtures
86102

@@ -90,11 +106,19 @@ pycodestyle-tests-fixtures:
90106
# This target lints only Python example files.
91107

92108
pycodestyle-examples:
109+
ifeq ($(FAIL_FAST), true)
93110
$(QUIET) $(FIND_PYTHON_EXAMPLES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
94111
echo ''; \
95112
echo "Linting code style: $$file"; \
96113
$(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$file || exit 1; \
97114
done
115+
else
116+
$(QUIET) $(FIND_PYTHON_EXAMPLES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
117+
echo ''; \
118+
echo "Linting code style: $$file"; \
119+
$(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$file; \
120+
done
121+
endif
98122

99123
.PHONY: pycodestyle-examples
100124

@@ -104,11 +128,19 @@ pycodestyle-examples:
104128
# This target lints only Python benchmark files.
105129

106130
pycodestyle-benchmarks:
131+
ifeq ($(FAIL_FAST), true)
107132
$(QUIET) $(FIND_PYTHON_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
108133
echo ''; \
109134
echo "Linting code style: $$file"; \
110135
$(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$file || exit 1; \
111136
done
137+
else
138+
$(QUIET) $(FIND_PYTHON_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
139+
echo ''; \
140+
echo "Linting code style: $$file"; \
141+
$(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$file; \
142+
done
143+
endif
112144

113145
.PHONY: pycodestyle-benchmarks
114146

@@ -118,10 +150,18 @@ pycodestyle-benchmarks:
118150
# This target lints Python files. Note that we expect `$FILES` to be a Python file list.
119151

120152
pycodestyle-files:
153+
ifeq ($(FAIL_FAST), true)
121154
$(QUIET) for file in $(FILES); do \
122155
echo ''; \
123156
echo "Linting code style: $$file"; \
124157
$(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$file || exit 1; \
125158
done
159+
else
160+
$(QUIET) for file in $(FILES); do \
161+
echo ''; \
162+
echo "Linting code style: $$file"; \
163+
$(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $$file; \
164+
done
165+
endif
126166

127167
.PHONY: pycodestyle-files

tools/make/lib/lint/python/pydocstyle.mk

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,19 @@ endif
6262
# This target lints only Python source files.
6363

6464
pydocstyle-src:
65+
ifeq ($(FAIL_FAST), true)
6566
$(QUIET) $(FIND_PYTHON_SOURCES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
6667
echo ''; \
6768
echo "Linting docstrings: $$file"; \
6869
$(PYDOCSTYLE) $(PYDOCSTYLE_FLAGS) $$file || exit 1; \
6970
done
71+
else
72+
$(QUIET) $(FIND_PYTHON_SOURCES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
73+
echo ''; \
74+
echo "Linting docstrings: $$file"; \
75+
$(PYDOCSTYLE) $(PYDOCSTYLE_FLAGS) $$file; \
76+
done
77+
endif
7078

7179
.PHONY: pydocstyle-src
7280

@@ -76,11 +84,19 @@ pydocstyle-src:
7684
# This target lints only Python test fixture files.
7785

7886
pydocstyle-tests-fixtures:
87+
ifeq ($(FAIL_FAST), true)
7988
$(QUIET) $(FIND_PYTHON_TESTS_FIXTURES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
8089
echo ''; \
8190
echo "Linting docstrings: $$file"; \
8291
$(PYDOCSTYLE) $(PYDOCSTYLE_FLAGS) $$file || exit 1; \
8392
done
93+
else
94+
$(QUIET) $(FIND_PYTHON_TESTS_FIXTURES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
95+
echo ''; \
96+
echo "Linting docstrings: $$file"; \
97+
$(PYDOCSTYLE) $(PYDOCSTYLE_FLAGS) $$file; \
98+
done
99+
endif
84100

85101
.PHONY: pydocstyle-tests-fixtures
86102

@@ -90,11 +106,19 @@ pydocstyle-tests-fixtures:
90106
# This target lints only Python example files.
91107

92108
pydocstyle-examples:
109+
ifeq ($(FAIL_FAST), true)
93110
$(QUIET) $(FIND_PYTHON_EXAMPLES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
94111
echo ''; \
95112
echo "Linting docstrings: $$file"; \
96113
$(PYDOCSTYLE) $(PYDOCSTYLE_FLAGS) $$file || exit 1; \
97114
done
115+
else
116+
$(QUIET) $(FIND_PYTHON_EXAMPLES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
117+
echo ''; \
118+
echo "Linting docstrings: $$file"; \
119+
$(PYDOCSTYLE) $(PYDOCSTYLE_FLAGS) $$file; \
120+
done
121+
endif
98122

99123
.PHONY: pydocstyle-examples
100124

@@ -104,11 +128,19 @@ pydocstyle-examples:
104128
# This target lints only Python benchmark files.
105129

106130
pydocstyle-benchmarks:
131+
ifeq ($(FAIL_FAST), true)
107132
$(QUIET) $(FIND_PYTHON_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
108133
echo ''; \
109134
echo "Linting docstrings: $$file"; \
110135
$(PYDOCSTYLE) $(PYDOCSTYLE_FLAGS) $$file || exit 1; \
111136
done
137+
else
138+
$(QUIET) $(FIND_PYTHON_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
139+
echo ''; \
140+
echo "Linting docstrings: $$file"; \
141+
$(PYDOCSTYLE) $(PYDOCSTYLE_FLAGS) $$file; \
142+
done
143+
endif
112144

113145
.PHONY: pydocstyle-benchmarks
114146

@@ -118,10 +150,18 @@ pydocstyle-benchmarks:
118150
# This target lints Python files. Note that we expect `$FILES` to be a Python file list.
119151

120152
pydocstyle-files:
153+
ifeq ($(FAIL_FAST), true)
121154
$(QUIET) for file in $(FILES); do \
122155
echo ''; \
123156
echo "Linting docstrings: $$file"; \
124157
$(PYDOCSTYLE) $(PYDOCSTYLE_FLAGS) $$file || exit 1; \
125158
done
159+
else
160+
$(QUIET) for file in $(FILES); do \
161+
echo ''; \
162+
echo "Linting docstrings: $$file"; \
163+
$(PYDOCSTYLE) $(PYDOCSTYLE_FLAGS) $$file; \
164+
done
165+
endif
126166

127167
.PHONY: pydocstyle-files

tools/make/lib/lint/python/pylint.mk

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,19 @@ endif
6464
# This target lints only Python source files.
6565

6666
pylint-src:
67+
ifeq ($(FAIL_FAST), true)
6768
$(QUIET) $(FIND_PYTHON_SOURCES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
6869
echo ''; \
6970
echo "Linting file: $$file"; \
7071
$(PYLINT) $(PYLINT_FLAGS) $$file || exit 1; \
7172
done
73+
else
74+
$(QUIET) $(FIND_PYTHON_SOURCES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
75+
echo ''; \
76+
echo "Linting file: $$file"; \
77+
$(PYLINT) $(PYLINT_FLAGS) $$file; \
78+
done
79+
endif
7280

7381
.PHONY: pylint-src
7482

@@ -78,11 +86,19 @@ pylint-src:
7886
# This target lints only Python test fixture files.
7987

8088
pylint-tests-fixtures:
89+
ifeq ($(FAIL_FAST), true)
8190
$(QUIET) $(FIND_PYTHON_TESTS_FIXTURES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
8291
echo ''; \
8392
echo "Linting file: $$file"; \
8493
$(PYLINT) $(PYLINT_FLAGS) $$file || exit 1; \
8594
done
95+
else
96+
$(QUIET) $(FIND_PYTHON_TESTS_FIXTURES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
97+
echo ''; \
98+
echo "Linting file: $$file"; \
99+
$(PYLINT) $(PYLINT_FLAGS) $$file; \
100+
done
101+
endif
86102

87103
.PHONY: pylint-tests-fixtures
88104

@@ -92,11 +108,19 @@ pylint-tests-fixtures:
92108
# This target lints only Python example files.
93109

94110
pylint-examples:
111+
ifeq ($(FAIL_FAST), true)
95112
$(QUIET) $(FIND_PYTHON_EXAMPLES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
96113
echo ''; \
97114
echo "Linting file: $$file"; \
98115
$(PYLINT) $(PYLINT_FLAGS) $$file || exit 1; \
99116
done
117+
else
118+
$(QUIET) $(FIND_PYTHON_EXAMPLES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
119+
echo ''; \
120+
echo "Linting file: $$file"; \
121+
$(PYLINT) $(PYLINT_FLAGS) $$file; \
122+
done
123+
endif
100124

101125
.PHONY: pylint-examples
102126

@@ -106,11 +130,19 @@ pylint-examples:
106130
# This target lints only Python benchmark files.
107131

108132
pylint-benchmarks:
133+
ifeq ($(FAIL_FAST), true)
109134
$(QUIET) $(FIND_PYTHON_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
110135
echo ''; \
111136
echo "Linting file: $$file"; \
112137
$(PYLINT) $(PYLINT_FLAGS) $$file || exit 1; \
113138
done
139+
else
140+
$(QUIET) $(FIND_PYTHON_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
141+
echo ''; \
142+
echo "Linting file: $$file"; \
143+
$(PYLINT) $(PYLINT_FLAGS) $$file; \
144+
done
145+
endif
114146

115147
.PHONY: pylint-benchmarks
116148

@@ -120,10 +152,18 @@ pylint-benchmarks:
120152
# This target lints Python files. Note that we expect `$FILES` to be a Python file list.
121153

122154
pylint-files:
155+
ifeq ($(FAIL_FAST), true)
123156
$(QUIET) for file in $(FILES); do \
124157
echo ''; \
125158
echo "Linting file: $$file"; \
126159
$(PYLINT) $(PYLINT_FLAGS) $$file || exit 1; \
127160
done
161+
else
162+
$(QUIET) for file in $(FILES); do \
163+
echo ''; \
164+
echo "Linting file: $$file"; \
165+
$(PYLINT) $(PYLINT_FLAGS) $$file; \
166+
done
167+
endif
128168

129169
.PHONY: pylint-files

0 commit comments

Comments
 (0)