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

[chore] Add flake8 workflow #260

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
ignore = F401,F405,W503,F841,F403,E402,F821,W291,E266,F811
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why so much error code in ignoring. If there are errors then they should be fixed in this PR.
You can consider trailing commas and import in __init__.py error code in ignoring or any other code which is required but do mention about code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codesankalp should I mention error codes .flake8 itself or in README?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No just add how to run check for flake8.

max-line-length = 160
20 changes: 20 additions & 0 deletions .github/workflows/flake8-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Flake8 Check

on: [push, pull_request]

jobs:
lint:
name: Linting with Flake8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Installing Dependencies
run: |
python -m pip install --upgrade pip
pip install flake8==3.8.4
- name: Running Flake8 checks
run: ./flake8-check
13 changes: 13 additions & 0 deletions flake8-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

flake8-check() {
flake8 && echo "Flake8 Check ✅" ||{
>&2 echo "Flake8 Check ❌"
echo "Suggestion: Run - flake8 ."
echo ""
FAILURE=1
}
}

flake8-check
exit $FAILURE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a new line at the end is required.