Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add darglint to ci #2007

Merged
merged 25 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f00311d
ci: add darglint to ci
bwanglzu Feb 22, 2021
7bedab4
ci: add test file to validate
bwanglzu Feb 22, 2021
50c9c1e
ci: add test file to validate
bwanglzu Feb 22, 2021
39b9aa9
ci: add pydocstyle and dummy files
cristianmtr Feb 22, 2021
271b734
Merge branch 'ci-lint-docstring' of github.com:jina-ai/jina into ci-l…
cristianmtr Feb 22, 2021
d225419
ci: testing docstrings linter
cristianmtr Feb 22, 2021
2741d53
ci: add test file to validate
bwanglzu Feb 22, 2021
d549e8f
ci: add test file to validate
bwanglzu Feb 22, 2021
5953fbd
ci: add test file to validate
bwanglzu Feb 22, 2021
66b0eb4
ci: add test file to validate
bwanglzu Feb 22, 2021
e04164b
ci: add test file to validate
bwanglzu Feb 22, 2021
2a6f6de
ci: add test file to validate
bwanglzu Feb 22, 2021
e3aeb42
ci: add test file to validate
bwanglzu Feb 22, 2021
fff5b91
ci: add test file to validate
bwanglzu Feb 22, 2021
948954f
ci: debug changed file in loop
bwanglzu Feb 22, 2021
60dfaa1
ci: debug changed file in loop
bwanglzu Feb 22, 2021
942e396
Merge remote-tracking branch 'origin' into ci-lint-docstring
bwanglzu Feb 22, 2021
1bb3928
ci: rename workflow add echo
bwanglzu Feb 22, 2021
5e9ccd4
ci: test printing all outputs
cristianmtr Feb 23, 2021
499a818
Merge branch 'master' into ci-lint-docstring
cristianmtr Feb 23, 2021
91e2621
ci: testing docstring linter
cristianmtr Feb 23, 2021
64f0507
Merge branch 'master' into ci-lint-docstring
cristianmtr Feb 23, 2021
a7640a1
Merge branch 'master' into ci-lint-docstring
cristianmtr Feb 23, 2021
041b77d
ci: capture output of both
cristianmtr Feb 23, 2021
4a77e66
ci: remove dummy files
cristianmtr Feb 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -69,6 +69,23 @@ jobs:
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude .git,__pycache__,docs/source/conf.py,old,build,dist,tests/,jina/hub/

check-docstring:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- id: file_changes
uses: jitterbit/get-changed-files@v1
- name: docstring check with darglint and pydocstyle
run: ./scripts/docstrings_lint.sh
env:
CHANGED_FILES: ${{ steps.file_changes.outputs.all }}

prep-testbed:
runs-on: ubuntu-18.04
steps:
Expand Down
28 changes: 28 additions & 0 deletions scripts/docstrings_lint.sh
@@ -0,0 +1,28 @@
#!/bin/bash
# required in order to get the status of all the files at once
pip install darglint==1.6.0
pip install pydocstyle==5.1.1
echo ====================================================================================
echo DOCSTRINGS LINT: checking $CHANGED_FILES
echo ------------------------------------------------------------------------------------
echo 'removing files under /tests...'
arrVar=()
# we ignore tests files
for changed_file in $CHANGED_FILES; do
if [[ ${changed_file}} != tests/* ]]; then
echo keeping ${changed_file}
arrVar+=(${changed_file})
fi
done
DARGLINT_OUTPUT=$(darglint -v 2 -s sphinx "${arrVar[@]}"); PYDOCSTYLE_OUTPUT=$(pydocstyle --select=D101,D102,D103 "${arrVar[@]}")
# status captured here
if [[ -z "$PYDOCSTYLE_OUTPUT" ]] && [[ -z "$DARGLINT_OUTPUT" ]]; then
echo 'OK'
exit 0
else
echo 'failure'
echo $DARGLINT_OUTPUT
echo $PYDOCSTYLE_OUTPUT
exit 1
fi
echo ====================================================================================