Skip to content

Commit

Permalink
Use Burocrata to check license notices in code (#69)
Browse files Browse the repository at this point in the history
The tool replaces our custom script (which is now removed).
  • Loading branch information
leouieda authored Mar 4, 2024
1 parent 010fe92 commit 0eb6a68
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 119 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: python -m pip freeze

- name: Check code format
run: make black-check isort-check license-check
run: make check-format

style:
runs-on: ubuntu-latest
Expand All @@ -58,4 +58,4 @@ jobs:
run: python -m pip freeze

- name: Check code style
run: make flake8
run: make check-style
30 changes: 10 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
PROJECT=ensaio
TESTDIR=tmp-test-dir-with-unique-name
PYTEST_ARGS=--cov-config=../.coveragerc --cov-report=term-missing --cov=$(PROJECT) --doctest-modules -v --pyargs
CHECK_STYLE=$(PROJECT) doc tools
CHECK_STYLE=$(PROJECT) doc

help:
@echo "Commands:"
Expand All @@ -28,30 +28,20 @@ test:
cp $(TESTDIR)/.coverage* .
rm -rvf $(TESTDIR)

format: license isort black

check: black-check isort-check license-check flake8

black:
format:
isort $(CHECK_STYLE)
black $(CHECK_STYLE)
burocrata --extension=py $(CHECK_STYLE)

black-check:
black --check $(CHECK_STYLE)

license:
python tools/license_notice.py

license-check:
python tools/license_notice.py --check
check: check-style check-format

isort:
isort $(CHECK_STYLE)
check-style:
flake8 $(CHECK_STYLE)

isort-check:
check-format:
isort --check $(CHECK_STYLE)

flake8:
flake8 $(CHECK_STYLE)
black --check $(CHECK_STYLE)
burocrata --check --extension=py $(CHECK_STYLE)

clean:
find . -name "*.pyc" -exec rm -v {} \;
Expand Down
1 change: 1 addition & 0 deletions env/requirements-style.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ flake8-rst-docstrings
flake8-simplify
flake8-unused-arguments
pep8-naming
burocrata
5 changes: 2 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ dependencies:
- flake8-mutable
- flake8-rst-docstrings
- flake8-simplify
- flake8-unused-arguments
- pep8-naming
- pip:
# Install flake8-unused-arguments through pip
# (not available through conda yet)
- flake8-unused-arguments
- burocrata
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@ write_to = "ensaio/_version_generated.py"
[tool.isort]
profile = "black"
multi_line_output = 3

[tool.burocrata]
notice = '''
# Copyright (c) 2021 The Ensaio Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#'''
94 changes: 0 additions & 94 deletions tools/license_notice.py

This file was deleted.

0 comments on commit 0eb6a68

Please sign in to comment.