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

conf: Add Pylint to CI. #16

Merged
merged 6 commits into from
Feb 19, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
16 changes: 0 additions & 16 deletions .githooks/commit-msg

This file was deleted.

25 changes: 0 additions & 25 deletions .githooks/pre-commit

This file was deleted.

13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,28 @@ jobs:
runs-on: ubuntu-latest

steps:
# Setup
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with black

# Lint
- name: Lint with Black
run: |
pip install black
black --check .

- name: Lint with Pylint
run: |
pip install pylint
touch __init__.py
pylint `pwd` --fail-under=5 --disable=too-few-public-methods,fixme
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.env
.idea
venv
**__pycache__**
*.pyc
__init__.py
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,10 @@ $ pip install -r requirements.txt
```
Or, if your system contains both Python 2 and Python 3, use `pip3`.

#### 5. Enable Git hooks

```
$ git config --local --add core.hooksPath .githooks
```

#### 6. Get the environment variables from another contributor
#### 7. [Download and configure ngrok](https://betterprogramming.pub/ngrok-make-your-localhost-accessible-to-anyone-333b99e44b07)
#### 8. Send your generated URL to MDG org admins
#### 9. Run the bot
#### 5. Get the environment variables from another contributor
#### 6. [Download and configure ngrok](https://betterprogramming.pub/ngrok-make-your-localhost-accessible-to-anyone-333b99e44b07)
#### 7. Send your generated URL to MDG org admins
#### 8. Run the bot

```
$ python main.py
Expand Down
1 change: 1 addition & 0 deletions github_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def parse(event_type, raw_json) -> GitHubEvent:
event_type=event_type,
json=json,
)
raise ValueError(f"Undefined event: {raw_json}")
BURG3R5 marked this conversation as resolved.
Show resolved Hide resolved


# Helper classes:
Expand Down
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ def manage_github_events():


@post("/slack/commands")
def manage_slack_commands():
def manage_slack_commands() -> Optional[dict]:
response: Optional[dict] = bot.run(raw_json=request.forms)
if response is not None:
return response
return None


bot: SlackBot = SlackBot()
Expand Down
1 change: 1 addition & 0 deletions models/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def __init__(self, name: str, **kwargs):
self.link = kwargs.get("link", f"https://github.com/{name}")


# pylint: disable-next=too-many-instance-attributes
class GitHubEvent:
def __init__(self, event_type: EventType, repo: Repository, **kwargs):
self.type = event_type
Expand Down
Loading