Skip to content

Commit

Permalink
Start using auto-formatters (#754)
Browse files Browse the repository at this point in the history
Use black to auto-format the style so it's always consistent and
pyupgrade will allow us to auto-upgrade to the newest language features.
  • Loading branch information
sigmavirus24 committed Jan 22, 2022
1 parent 78543ff commit 9fcf66b
Show file tree
Hide file tree
Showing 89 changed files with 4,499 additions and 3,583 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Build and Test Bandit
on: [push, pull_request]

jobs:
pylint:
format:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5]
python-version: [3.6]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -21,13 +21,13 @@ jobs:
pip install -r test-requirements.txt
pip install tox
- name: Run tox
run: tox -e pylint
run: tox -e format

pep8:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5]
python-version: [3.6]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -43,11 +43,11 @@ jobs:
- name: Run tox
run: tox -e pep8

py35:
py36:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5]
python-version: [3.6]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -61,13 +61,13 @@ jobs:
pip install -r test-requirements.txt
pip install tox
- name: Run tox
run: tox -e py35
run: tox -e py36

py36:
py37:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6]
python-version: [3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -81,13 +81,13 @@ jobs:
pip install -r test-requirements.txt
pip install tox
- name: Run tox
run: tox -e py36
run: tox -e py37

py37:
py38:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
python-version: [3.8]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -101,13 +101,13 @@ jobs:
pip install -r test-requirements.txt
pip install tox
- name: Run tox
run: tox -e py37
run: tox -e py38

py38:
py39:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: [3.9]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -121,13 +121,13 @@ jobs:
pip install -r test-requirements.txt
pip install tox
- name: Run tox
run: tox -e py38
run: tox -e py39

py39:
py310:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: ['3.10']
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -141,4 +141,4 @@ jobs:
pip install -r test-requirements.txt
pip install tox
- name: Run tox
run: tox -e py39
run: tox -e py310
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
exclude: ^(examples|tools|doc|releasenotes)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
hooks:
- id: reorder-python-imports
args: [--application-directories, '.:src', --py36-plus]
- repo: https://github.com/psf/black
rev: 21.10b0
hooks:
- id: black
args: [--line-length=79, --target-version=py36]
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/jorisroovers/gitlint
rev: v0.16.0
hooks:
- id: gitlint
#- repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.910-1
# hooks:
# - id: mypy
# exclude: ^(docs/|example-plugin/)
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Contributing to Bandit
Thanks for considering to take part in the improvement of the Bandit project. Contributions are always welcome!
Thanks for considering to take part in the improvement of the Bandit project. Contributions are always welcome!
Here are guidelines and rules that can be helpful if you plan to want to get involved in the project.

#### Table Of Contents
Expand Down Expand Up @@ -27,7 +27,7 @@ If you encounter a bug, please let us know about it. See the guide here [GitHub
to add a comment to the existing issue instead of creating a new one.

### Submitting your first issue
We encourage using the issue template to improve quality of reported issues.
We encourage using the issue template to improve quality of reported issues.
Navigate to the issues tab and select `New issue`, then select the **Bug report** template and fill out the form.
To submit a good bug report keep in mind to:
* Use a descriptive title so other people can understand what the issue is about.
Expand Down
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,3 @@
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

4 changes: 1 addition & 3 deletions bandit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# -*- coding:utf-8 -*-
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# SPDX-License-Identifier: Apache-2.0

import pbr.version

from bandit.core import config # noqa
Expand All @@ -18,4 +16,4 @@
from bandit.core.issue import * # noqa
from bandit.core.test_properties import * # noqa

__version__ = pbr.version.VersionInfo('bandit').version_string()
__version__ = pbr.version.VersionInfo("bandit").version_string()
1 change: 1 addition & 0 deletions bandit/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
https://bandit.readthedocs.io/
"""
from bandit.cli import main

main.main()

0 comments on commit 9fcf66b

Please sign in to comment.