Skip to content

Commit 3854aea

Browse files
authored
Enable flake8 lint validation (#20)
1 parent ffeabc8 commit 3854aea

File tree

6 files changed

+41
-7
lines changed

6 files changed

+41
-7
lines changed

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
max-line-length = 125
3+
# E401: We are fine with multiple imports in a line
4+
# W503: This rule is not compatible with black (code formatter)
5+
ignore = E401,W503

.github/workflows/flake8.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Lint validation using flake8
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
strategy:
13+
matrix:
14+
python-version: ['3.9']
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install dependencies
22+
run: |
23+
pip install -U pip
24+
pip install -e ".[testing]"
25+
# We manually upgrade it to make the builds stable
26+
pip install "flake8==4.0.1"
27+
- name: Run flake8
28+
run: |
29+
flake8 slack_discovery_sdk/

slack_discovery_sdk/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def discovery_user_conversations(
154154
"limit": limit,
155155
}
156156
)
157-
if offset != None:
157+
if offset is not None:
158158
kwargs.update({"offset": offset})
159159

160160
return self.api_call(

slack_discovery_sdk/examples/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
FILE_EXTENSION = ".json"
66

7-
## This file contains functions which will help create a directory structure to organize and
8-
## hold the output from the discovery APIs. This is just meant as a helper to get you started,
9-
## and is by no means a production ready solution. Use this to get familiar with the discovery APIs.
7+
# This file contains functions which will help create a directory structure to organize and
8+
# hold the output from the discovery APIs. This is just meant as a helper to get you started,
9+
# and is by no means a production ready solution. Use this to get familiar with the discovery APIs.
1010

1111

1212
def export_json_to_file(
@@ -27,7 +27,7 @@ def export_json_to_file(
2727
Returns:
2828
None
2929
"""
30-
if channel_id != None:
30+
if channel_id is not None:
3131
channel_folder = create_folder_for_channel(
3232
base_dir=base_dir,
3333
channel_id=channel_id,

slack_discovery_sdk/oauth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def do_GET(self):
6161
body=self._build_html_page(main),
6262
headers={"Content-Type": ["text/html; charset=utf-8"]},
6363
)
64-
except Exception as _:
64+
except Exception:
6565
_logger.exception("Failed to perform oauth.v2.access API call")
6666
main = f"""
6767
<p>Click <a href="{_install_path}">here</a> to install the app again.</p>

slack_discovery_sdk/response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class DiscoveryResponse:
4343
def __init__( # type: ignore
4444
self,
4545
*,
46-
client: "BaseDiscoveryClient",
46+
client: "BaseDiscoveryClient", # noqa: F821
4747
http_method: str,
4848
api_url: str,
4949
request_headers: dict,

0 commit comments

Comments
 (0)