summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@ubuntu.com>2022-02-16 17:47:22 +0000
committerColin Watson <cjwatson@ubuntu.com>2022-02-16 17:47:22 +0000
commit9b8016a2b1e75fda42fe7b7bf37475a8c64dc6b2 (patch)
treeb84199151739deb66959e8340e9696e6df3ffc6b
parentc39d7009fb281e1fbf1ce0afea5c12a5f6394bb4 (diff)
Add pre-commit and woke configuration
-rw-r--r--.pre-commit-config.yaml14
-rw-r--r--.woke.yaml221
-rwxr-xr-xbin/git-build-recipe12
-rw-r--r--gitbuildrecipe/deb_util.py12
-rw-r--r--gitbuildrecipe/deb_version.py12
-rw-r--r--gitbuildrecipe/main.py12
-rw-r--r--gitbuildrecipe/recipe.py14
-rw-r--r--gitbuildrecipe/tests/__init__.py12
-rw-r--r--gitbuildrecipe/tests/test_deb_version.py12
-rw-r--r--gitbuildrecipe/tests/test_functional.py (renamed from gitbuildrecipe/tests/test_blackbox.py)14
-rw-r--r--gitbuildrecipe/tests/test_recipe.py12
-rwxr-xr-xsetup.py12
-rw-r--r--tox.ini10
13 files changed, 307 insertions, 62 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..4737b06
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,14 @@
+# See https://pre-commit.com for more information
+# See https://pre-commit.com/hooks.html for more hooks
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.1.0
+ hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: check-yaml
+ - id: check-added-large-files
+- repo: https://github.com/get-woke/woke
+ rev: v0.17.1
+ hooks:
+ - id: woke-from-source
diff --git a/.woke.yaml b/.woke.yaml
new file mode 100644
index 0000000..010ccff
--- /dev/null
+++ b/.woke.yaml
@@ -0,0 +1,221 @@
+
+# Based on Canonical's Guidelines
+# https://docs.google.com/document/d/1mJUa1VJHOMWa723dmKmNjSKGW-nlBv9xktzGZZwacVo/edit#heading=h.5efudb237qdb
+rules:
+ - name: whitelist
+ terms:
+ - whitelist
+ - white-list
+ - whitelisted
+ - white-listed
+ alternatives:
+ - allowlist
+ - inclusion list
+ severity: warning
+ note: "The underlying assumption of the whitelist/blacklist metaphor is that white = good and black = bad. Because colors in and of themselves have no predetermined meaning, any meaning we assign to them is cultural: for example, the color red in many Southeast Asian countries is lucky, and is often associated with events like marriages, whereas the color white carries the same connotations in many European countries. In the case of whitelist/blacklist, the terms originate in the publishing industry – one dominated by the USA and England, two countries which participated in slavery and which grapple with their racist legacies to this day."
+
+ - name: blacklist
+ terms:
+ - blacklist
+ - black-list
+ - blacklisted
+ - black-listed
+ alternatives:
+ - denylist
+ - blocklist
+ - exclusion list
+ severity: warning
+ note: "The underlying assumption of the whitelist/blacklist metaphor is that white = good and black = bad. Because colors in and of themselves have no predetermined meaning, any meaning we assign to them is cultural: for example, the color red in many Southeast Asian countries is lucky, and is often associated with events like marriages, whereas the color white carries the same connotations in many European countries. In the case of whitelist/blacklist, the terms originate in the publishing industry – one dominated by the USA and England, two countries which participated in slavery and which grapple with their racist legacies to this day."
+
+ - name: master-slave
+ terms:
+ - master-slave
+ - master/slave
+ alternatives:
+ - leader/follower
+ - main/replica
+ - primary/replica
+ - primary/standby
+ - primary/secondary
+
+ - name: slave
+ terms:
+ - slave
+ alternatives:
+ - follower
+ - replica
+ - standby
+
+ - name: grandfathered
+ terms:
+ - grandfathered
+ alternatives:
+ - legacy status
+ - legacied
+ - exempted
+ - carried
+ - brought forward
+ - rolled over
+
+ - name: man-hours
+ terms:
+ - man hours
+ - man-hours
+ alternatives:
+ - person hours
+ - engineer hours
+
+ - name: sanity
+ terms:
+ - sanity
+ alternatives:
+ - confidence
+ - quick check
+ - coherence check
+
+ - name: dummy
+ terms:
+ - dummy
+ alternatives:
+ - placeholder
+ - sample
+
+ - name: guys
+ terms:
+ - guys
+ alternatives:
+ - folks
+ - people
+ - you all
+ - y'all
+ - yinz
+
+ - name: whitebox
+ terms:
+ - white-box
+ - whitebox
+ - white box
+ alternatives:
+ - open-box
+
+ - name: blackbox
+ terms:
+ - black-box
+ - blackbox
+ - black box
+ alternatives:
+ - closed-box
+
+ - name: blackhat
+ terms:
+ - blackhat
+ - black-hat
+ - black hat
+ alternatives:
+ - attacker
+ - malicious actor
+
+ - name: whitehat
+ terms:
+ - whitehat
+ - white-hat
+ - white hat
+ alternatives:
+ - researcher
+ - security specialist
+
+ - name: illegal characters
+ terms:
+ - illegal characters
+ alternatives:
+ - invalid characters
+ - unsupported characters
+ - special characters
+
+ - name: native feature
+ terms:
+ - native feature
+ alternatives:
+ - core feature
+ - built-in feature
+
+ - name: chairman/foreman
+ terms:
+ - chairman
+ - foreman
+ alternatives:
+ - chair
+ - foreperson
+
+ - name: man in the middle
+ terms:
+ - man in the middle
+ - man-in-the-middle
+ alternatives:
+ - machine-in-the-middle
+ - person-in-the-middle
+ - system-in-the-middle
+ - intermediary attack
+
+ - name: middleman
+ terms:
+ - middleman
+ alternatives:
+ - middleperson
+ - intermediary
+
+ - name: manned
+ terms:
+ - manned
+ alternatives:
+ - crewed
+ - staffed
+ - monitored
+ - human operated
+
+ - name: mom test / girlfriend test
+ terms:
+ - mom test
+ - girlfriend test
+ alternatives:
+ - user test
+ - user friendly
+
+ - name: crazy
+ terms:
+ - crazy
+ alternatives:
+ - baffling
+ - unexplained
+ - errant
+
+ - name: cripples
+ terms:
+ - cripples
+ alternatives:
+ - slows down
+ - hinders
+ - obstructs
+
+ - name: crippling
+ terms:
+ - crippling
+ alternatives:
+ - attenuating
+ - incapacitating
+
+ - name: stonith/stomith
+ terms:
+ - stonith
+ - stomith
+ alternatives:
+ - fence failed nodes
+ - machines
+
+ - name: demilitarized zone
+ terms:
+ - demilitarized zone
+ - dmz
+ alternatives:
+ - perimeter network
+ - passthrough network
diff --git a/bin/git-build-recipe b/bin/git-build-recipe
index 3f4bd34..2e34b58 100755
--- a/bin/git-build-recipe
+++ b/bin/git-build-recipe
@@ -2,16 +2,16 @@
# Copyright 2015 Canonical Ltd.
#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 3, as published
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
+# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
"""A Git command to construct trees based on recipes."""
diff --git a/gitbuildrecipe/deb_util.py b/gitbuildrecipe/deb_util.py
index 56778e5..d0a6666 100644
--- a/gitbuildrecipe/deb_util.py
+++ b/gitbuildrecipe/deb_util.py
@@ -1,15 +1,15 @@
# Copyright 2015 Canonical Ltd.
#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 3, as published
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
+# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import email.utils
diff --git a/gitbuildrecipe/deb_version.py b/gitbuildrecipe/deb_version.py
index 2576357..f70bc49 100644
--- a/gitbuildrecipe/deb_version.py
+++ b/gitbuildrecipe/deb_version.py
@@ -1,15 +1,15 @@
# Copyright 2015 Canonical Ltd.
#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 3, as published
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
+# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
"""Handle deb-version and related substitutions."""
diff --git a/gitbuildrecipe/main.py b/gitbuildrecipe/main.py
index 6294852..30e6bec 100644
--- a/gitbuildrecipe/main.py
+++ b/gitbuildrecipe/main.py
@@ -2,16 +2,16 @@
# Copyright 2015 Canonical Ltd.
#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 3, as published
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
+# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
"""A Git command to construct trees based on recipes."""
diff --git a/gitbuildrecipe/recipe.py b/gitbuildrecipe/recipe.py
index 0ff215f..f932ca7 100644
--- a/gitbuildrecipe/recipe.py
+++ b/gitbuildrecipe/recipe.py
@@ -1,15 +1,15 @@
# Copyright 2015 Canonical Ltd.
#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 3, as published
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
+# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
"""Handle recipe parsing and substitution variables."""
@@ -845,7 +845,7 @@ class BaseRecipeBranch(RecipeBranch):
manifest += self._add_child_branches_to_manifest(
self.child_branches, 0)
if validate:
- # Sanity check.
+ # Ensure that the recipe can be parsed.
# TODO: write a function that compares the result of this parse
# with the branch that we built it from.
RecipeParser(manifest).parse()
diff --git a/gitbuildrecipe/tests/__init__.py b/gitbuildrecipe/tests/__init__.py
index 6b41396..d968f5b 100644
--- a/gitbuildrecipe/tests/__init__.py
+++ b/gitbuildrecipe/tests/__init__.py
@@ -1,15 +1,15 @@
# Copyright 2015 Canonical Ltd.
#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 3, as published
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
+# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import os.path
diff --git a/gitbuildrecipe/tests/test_deb_version.py b/gitbuildrecipe/tests/test_deb_version.py
index f58f56f..662e811 100644
--- a/gitbuildrecipe/tests/test_deb_version.py
+++ b/gitbuildrecipe/tests/test_deb_version.py
@@ -1,15 +1,15 @@
# Copyright 2015 Canonical Ltd.
#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 3, as published
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
+# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import datetime
diff --git a/gitbuildrecipe/tests/test_blackbox.py b/gitbuildrecipe/tests/test_functional.py
index c951a19..56fd216 100644
--- a/gitbuildrecipe/tests/test_blackbox.py
+++ b/gitbuildrecipe/tests/test_functional.py
@@ -1,15 +1,15 @@
# Copyright 2015 Canonical Ltd.
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 3, as published
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License along
+# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import hashlib
@@ -87,7 +87,7 @@ def make_pristine_tar_delta(dest, tarball_path):
return stdout
-class BlackboxBuilderTests(GitTestCase):
+class FunctionalBuilderTests(GitTestCase):
def setUp(self):
super().setUp()
diff --git a/gitbuildrecipe/tests/test_recipe.py b/gitbuildrecipe/tests/test_recipe.py
index 7628a45..bfc6452 100644
--- a/gitbuildrecipe/tests/test_recipe.py
+++ b/gitbuildrecipe/tests/test_recipe.py
@@ -1,15 +1,15 @@
# Copyright 2015 Canonical Ltd.
#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 3, as published
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
+# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import os
diff --git a/setup.py b/setup.py
index a9e781a..930bde2 100755
--- a/setup.py
+++ b/setup.py
@@ -2,16 +2,16 @@
# Copyright 2015 Canonical Ltd.
#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 3, as published
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranties of
-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
+# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
from setuptools import setup
diff --git a/tox.ini b/tox.ini
index f990d65..c36a664 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,6 @@
[tox]
envlist =
+ lint
py36
py37
py38
@@ -14,3 +15,12 @@ deps =
pytest
commands =
pytest {posargs}
+
+[testenv:lint]
+basepython =
+ python3.10
+deps =
+ pre-commit
+skip_install = true
+commands =
+ pre-commit run -a