2424RUN_BLACK=TRUE
2525RUN_FLAKE8=TRUE
2626RUN_PYLINT=TRUE
27+ RUN_MDFORMAT=TRUE
2728
2829# ###################################
2930# Overwrite linter versions if set #
8384 echo " - pylint version not overwritten in code workflow"
8485fi
8586
87+ if [ $( yq ' .jobs.lint.with | has("mdformat-version")' $CODE_LINTING_WORKFLOW ) == true ]
88+ then
89+ DEFAULT_MDFORMAT_VERSION=$( cat /requirements.txt | grep mdformat== | cut -d " =" -f 3)
90+ NEW_MDFORMAT_VERSION=$( yq ' .jobs.lint.with."mdformat-version"' $CODE_LINTING_WORKFLOW )
91+ if [ " $( echo $NEW_MDFORMAT_VERSION | tr ' "' ' x' ) " = " xx" ]
92+ then
93+ RUN_MDFORMAT=FALSE
94+ echo " - mdformat configured to be skipped (empty string)"
95+ elif [ $DEFAULT_MDFORMAT_VERSION != $NEW_MDFORMAT_VERSION ]
96+ then
97+ # sed would fail with Permission denied
98+ # sed -i "s+$DEFAULT_MDFORMAT_VERSION+$NEW_MDFORMAT_VERSION+g" /requirements.txt
99+ echo " - Warning: overwritten mdformat version will not be installed!"
100+ fi
101+ else
102+ echo " - mdformat version not overwritten in code workflow"
103+ fi
104+
86105echo
87106
88107# ##################
94113echo " flake8: ` flake8 --version` "
95114echo " pylint: ` pylint --version` "
96115echo " black: ` black --version` "
116+ echo " mdformat: ` mdformat --version` "
97117
98118# #######
99119# lint #
134154 if [ $? -ne 0 ]
135155 then
136156 RETURNCODE=1
137- FAILINGSTEP=" $FAILINGSTEP PYLINT"
157+ FAILINGSTEP=" $FAILINGSTEP PYLINT (run 'pylint .') "
138158 fi
139159
140160 echo
150170 pylint --rc-file=.pylintrc_allowed_to_fail .
151171else
152172 echo
153- echo " PYLINT configured to be skipped"
173+ echo " PYLINT configured to be skipped (run 'pylint --rc-file=.pylintrc_allowed_to_fail .') "
154174fi
155175
156176if [ $RUN_BLACK != " FALSE" ]
@@ -161,13 +181,28 @@ then
161181 if [ $? -ne 0 ]
162182 then
163183 RETURNCODE=1
164- FAILINGSTEP=" $FAILINGSTEP BLACK"
184+ FAILINGSTEP=" $FAILINGSTEP BLACK (run 'black --check --diff --line-length 79 .') "
165185 fi
166186else
167187 echo
168188 echo " BLACK configured to be skipped"
169189fi
170190
191+ if [ $RUN_MDFORMAT != " FALSE" ]
192+ then
193+ echo
194+ echo " MDFORMAT:"
195+ mdformat --check .
196+ if [ $? -ne 0 ]
197+ then
198+ RETURNCODE=1
199+ FAILINGSTEP=" $FAILINGSTEP MDFORMAT (run 'mdformat --check .')"
200+ fi
201+ else
202+ echo
203+ echo " MDFORMAT configured to be skipped"
204+ fi
205+
171206if [ $RETURNCODE -ne 0 ]
172207then
173208 echo " Failing steps: ${FAILINGSTEP} "
0 commit comments