Skip to content

Commit 0ae38c1

Browse files
committed
chore: bandit and isort
1 parent 54c5b29 commit 0ae38c1

File tree

10 files changed

+71
-11
lines changed

10 files changed

+71
-11
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
name: build
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
paths:
6+
- '.github/workflows/build.yml'
7+
- '**/*.py'
8+
branches:
9+
- "**"
10+
tags:
11+
- "!**"
12+
pull_request:
13+
paths:
14+
- '.github/workflows/build.yml'
15+
- '**/*.py'
416

517
jobs:
618
lint:
@@ -16,6 +28,8 @@ jobs:
1628
run: make install
1729
- name: Check format
1830
run: make format-check
31+
- name: Scan for security vulnerabilities
32+
run: make scan
1933
test:
2034
runs-on: ubuntu-latest
2135
strategy:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ jobs:
2020
make install
2121
make build
2222
- name: Publish to PyPI
23-
uses: pypa/gh-action-pypi-publish@master
23+
uses: pypa/gh-action-pypi-publish@release/v1
2424
with:
2525
password: ${{ secrets.PYPI_API_TOKEN }}

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ lint:
5656
mypy:
5757
$(VIRTUAL_BIN)/mypy $(PROJECT_NAME)/ $(TEST_DIR)/
5858

59+
## scan - Scans the project for security vulnerabilities
60+
scan:
61+
$(VIRTUAL_BIN)/bandit -r $(PROJECT_NAME)/
62+
5963
## test - Test the project
6064
test:
6165
$(VIRTUAL_BIN)/pytest
6266

63-
.PHONY: help build coverage clean black black-check format format-check install isort isort-check lint mypy test
67+
.PHONY: help build coverage clean black black-check format format-check install isort isort-check lint mypy scan test

pullbug/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from pullbug.bug import Pullbug
22
from pullbug.messages import Message
33

4+
45
__all__ = [
56
'Pullbug',
67
'Message',

pullbug/bug.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
import os
2-
from typing import Any, Dict, List, Tuple
2+
from typing import (
3+
Any,
4+
Dict,
5+
List,
6+
Tuple,
7+
)
38

49
import woodchips
5-
from github import Github, Issue, NamedUser, PaginatedList, PullRequest
10+
from github import (
11+
Github,
12+
Issue,
13+
NamedUser,
14+
PaginatedList,
15+
PullRequest,
16+
)
617
from typing_extensions import Literal
718

819
from pullbug.messages import Message
920

21+
1022
GITHUB_STATE_CHOICES = Literal[
1123
'all',
1224
'closed',
@@ -33,7 +45,7 @@
3345

3446

3547
class Pullbug:
36-
def __init__(
48+
def __init__( # nosec - no hardcoded token here, ignore
3749
self,
3850
github_owner: str,
3951
github_token: str = None,

pullbug/messages.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
import math
2-
from typing import List, Tuple, Union
2+
from typing import (
3+
List,
4+
Tuple,
5+
Union,
6+
)
37

48
import requests
59
import slack
610
import woodchips
7-
from github import Issue, NamedUser, PullRequest, Team
11+
from github import (
12+
Issue,
13+
NamedUser,
14+
PullRequest,
15+
Team,
16+
)
17+
818

919
LOGGER_NAME = 'pullbug'
1020

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ skip-string-normalization = true
55

66
[tool.isort]
77
profile = "black"
8+
line_length = 120
9+
indent = 4
10+
force_grid_wrap = 2
11+
multi_line_output = 3
12+
sections = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
13+
lines_after_imports = 2
14+
include_trailing_comma = true
15+
use_parentheses = true

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import setuptools
22

3+
34
with open('README.md', 'r') as fh:
45
long_description = fh.read()
56

@@ -12,6 +13,7 @@
1213
]
1314

1415
DEV_REQUIREMENTS = [
16+
'bandit == 1.7.*',
1517
'black == 22.*',
1618
'build == 0.7.*',
1719
'coveralls == 3.*',

test/unit/test_bug.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from unittest.mock import MagicMock, patch
1+
from unittest.mock import (
2+
MagicMock,
3+
patch,
4+
)
25

36
import pytest
47

test/unit/test_messages.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
from unittest.mock import MagicMock, patch
1+
from unittest.mock import (
2+
MagicMock,
3+
patch,
4+
)
25

36
import pytest
47
import requests
58
import slack
6-
from github import NamedUser, Team
9+
from github import (
10+
NamedUser,
11+
Team,
12+
)
713

814
from pullbug.messages import Message
915

0 commit comments

Comments
 (0)