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

Adopt black #28

Merged
merged 3 commits into from
Jan 30, 2023
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: '3.8'
- name: Install dependencies
run: |
make develop
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8'
- name: Install dependencies
run: |
make develop
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ instance/

# Sphinx documentation
doc/_build/
doc/modules.rst
doc/modules.rst

# PyBuilder
target/
Expand Down
49 changes: 17 additions & 32 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
repos:
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.30.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: yapf
args: [--in-place, --parallel, --recursive, --style, .yapf-config]
files: "^(harvest|test)"
stages: [commit]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
- id: trailing-whitespace
- id: check-yaml
- id: fix-encoding-pragma
args: ["--remove"] # Not needed on python3
- repo: https://github.com/ambv/black
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [
--extend-ignore,
"P1,C812,C813,C814,C815,C816,W503"
]
additional_dependencies: [
flake8-2020,
flake8-broken-line,
flake8-bugbear,
flake8-builtins,
flake8-commas,
flake8-comprehensions,
flake8-docstrings,
flake8-eradicate,
flake8-import-order,
flake8-mutable,
flake8-pep3101,
flake8-print,
flake8-quotes,
flake8-string-format,
flake8-use-fstring,
pep8-naming
]
files: "^(harvest|test)"
stages: [commit]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
hooks:
- id: bandit
args: [--recursive]
14 changes: 0 additions & 14 deletions .yapf-config

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# [1.2.1](https://github.com/ComplianceAsCode/auditree-harvest/releases/tag/v1.2.1)

- [CHANGED] Removed yapf in favour of black as code formatter.

# [1.2.0](https://github.com/ComplianceAsCode/auditree-harvest/releases/tag/v1.2.0)

- [FIXED] Invalid Git repo error is now handled by a refresh of the local Git repo.
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Follow the guidelines outlined in the [generating reports][] section of the harv

## Code formatting and style

Please ensure all code contributions are formatted by `yapf` and pass all `flake8` linter requirements.
CI/CD will run `yapf` and `flake8` on all new commits and reject changes if there are failures. If you
run `make develop` to setup and maintain your virtual environment then `yapf` and `flake8` will be executed
Please ensure all code contributions are formatted by `black` and pass all `flake8` linter requirements.
CI/CD will run `black` and `flake8` on all new commits and reject changes if there are failures. If you
run `make develop` to setup and maintain your virtual environment then `black` and `flake8` will be executed
automatically as part of all git commits. If you'd like to run things manually you can do so locally by using:

```shell
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
develop:
pip install -q -e .[dev] --upgrade --upgrade-strategy eager
pre-commit install

update-pre-commit:
pre-commit autoupdate

install:
Expand All @@ -27,7 +29,7 @@ uninstall:
pip uninstall auditree-harvest

code-format:
pre-commit run yapf --all-files
pre-commit run black --all-files

code-lint:
pre-commit run flake8 --all-files
Expand Down
3 changes: 1 addition & 2 deletions harvest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2020 IBM Corp. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,4 +13,4 @@
# limitations under the License.
"""The Auditree file collating and reporting tool."""

__version__ = '1.2.0'
__version__ = "1.2.0"
Loading