Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: ricwo <20581300+ricwo@users.noreply.github.com>
  • Loading branch information
wochinge and ricwo committed Oct 28, 2020
1 parent 6a93f74 commit e573427
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,18 @@ jobs:
sudo apt-get -y install libpq-dev
make install-full install-docs
- name: Lint Code 🎎
run: make lint

- name: Checkout target branch to be able to diff
if: github.event_name == 'pull_request'
run: |
git fetch --depth=1 origin ${{ github.base_ref }}
echo "DOCSTRING_DIFF_BRANCH=origin/${{ github.base_ref }}" >> $GITHUB_ENV
- name: Check Docstring conventions 📃
if: github.event_name == 'pull_request'
run: make lint-docs branch=origin/${{ github.base_ref }}
- name: Lint Code 🎎
run: |
# If it's not a pull request, $DOCSTRING_DIFF_BRANCH is unset.
# This will result in an empty diff, which effictively means that
# make lint-docstrings will be skipped for other events than `pull_request`
make lint BRANCH=$DOCSTRING_DIFF_BRANCH
- name: Check Types 📚
run: make types
Expand Down
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ help:
@echo " Apply black formatting to code."
@echo " lint"
@echo " Lint code with flake8, and check if black formatter should be applied."
@echo " lint-docs"
@echo " lint-docstrings"
@echo " Check docstring conventions in changed files."
@echo " types"
@echo " Check for type errors using mypy."
Expand Down Expand Up @@ -61,15 +61,16 @@ formatter:
poetry run black rasa tests

lint:
# Ignore docstring errors when running on the entire project
# Ignore docstring errors when running on the entire project
poetry run flake8 rasa tests --extend-ignore D
poetry run black --check rasa tests
make lint-docstrings

branch ?= master
lint-docs:
# Lint docstrings only against the the diff to avoid too many errors.
# Check only production code. Ignore other flake errors which are captured by `lint`
git diff $(branch) -- rasa | poetry run flake8 --select D --diff
BRANCH ?= master # Compare against `master` if no branch was provided
lint-docstrings:
# Lint docstrings only against the the diff to avoid too many errors.
# Check only production code. Ignore other flake errors which are captured by `lint`
git diff $(BRANCH) -- rasa | poetry run flake8 --select D --diff

types:
# FIXME: working our way towards removing these
Expand Down
7 changes: 5 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ log_cli_level = WARNING

[flake8]
max-line-length = 88
# See these resources for descriptions of the error codes:
# E***, F***, W*** : https://flake8.pycqa.org/en/latest/user/error-codes.html
# D***: http://www.pydocstyle.org/en/stable/error_codes.html
ignore = W503, E121, E126, E211, E225, E501, E203, E402, F401, F811, E231,
D100, # ignore missing module docstrings
D104, # ignore missing package docstrings
D100, # ignore missing docstrings in public module
D104, # ignore missing docstrings in public package
docstring-convention = google


Expand Down

0 comments on commit e573427

Please sign in to comment.