Skip to content

Commit

Permalink
Use Burocrata to check/add license notices (#66)
Browse files Browse the repository at this point in the history
Replaces our custom script in `tools`. Can check and add (if missing)
the license notices in source code files.
  • Loading branch information
leouieda authored Mar 12, 2024
1 parent 660183a commit a81b748
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 115 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
28 changes: 9 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PROJECT=choclo
TESTDIR=tmp-test-dir-with-unique-name
PYTEST_ARGS=--cov-config=../.coveragerc --cov-report=term-missing --cov=$(PROJECT) --doctest-modules -v --pyargs
NUMBATEST_ARGS=--doctest-modules -v --pyargs
CHECK_STYLE=$(PROJECT) doc tools
CHECK_STYLE=$(PROJECT) doc

help:
@echo "Commands:"
Expand Down Expand Up @@ -37,29 +37,19 @@ test_numba:
cd $(TESTDIR); NUMBA_DISABLE_JIT=0 pytest $(NUMBATEST_ARGS) $(PROJECT)
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
check: check-format check-style

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

isort:
isort $(CHECK_STYLE)

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

flake8:
check-style:
flake8 $(CHECK_STYLE)

clean:
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
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ dependencies:
- flake8-simplify
- flake8-unused-arguments
- pep8-naming
- pip:
- 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 = "choclo/_version_generated.py"
[tool.isort]
profile = "black"
multi_line_output = 3

[tool.burocrata]
notice = '''
# Copyright (c) 2022 The Choclo 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 a81b748

Please sign in to comment.