launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28365
[Merge] ~cjwatson/lp-codeimport:woke into lp-codeimport:master
Colin Watson has proposed merging ~cjwatson/lp-codeimport:woke into lp-codeimport:master.
Commit message:
Apply inclusive naming via the woke pre-commit hook
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/lp-codeimport/+git/lp-codeimport/+merge/420023
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/lp-codeimport:woke into lp-codeimport:master.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 54a41b0..aee2447 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -20,3 +20,7 @@ repos:
rev: 5.10.1
hooks:
- id: isort
+- repo: https://github.com/get-woke/woke
+ rev: v0.18.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/lib/lp/code/enums.py b/lib/lp/code/enums.py
index d2a9262..313c12b 100644
--- a/lib/lp/code/enums.py
+++ b/lib/lp/code/enums.py
@@ -1042,7 +1042,7 @@ class CodeImportResultStatus(DBEnumeratedType):
Forbidden URL
The import failed because the URL of the branch that is imported
- or the URL of one of the branches that it references is blacklisted.
+ or the URL of one of the branches that it references is denylisted.
""")
FAILURE_REMOTE_BROKEN = DBItem(250, """
diff --git a/lib/lp/codehosting/codeimport/tests/test_worker.py b/lib/lp/codehosting/codeimport/tests/test_worker.py
index 89a1212..46ff8da 100644
--- a/lib/lp/codehosting/codeimport/tests/test_worker.py
+++ b/lib/lp/codehosting/codeimport/tests/test_worker.py
@@ -43,12 +43,13 @@ from bzrlib.transport import (
get_transport_from_url,
)
from bzrlib.url_policy_open import (
- _BlacklistPolicy,
AcceptAnythingPolicy,
BadUrl,
BranchOpener,
BranchOpenPolicy,
)
+from bzrlib.url_policy_open import \
+ _BlacklistPolicy as DenylistPolicy # wokeignore:rule=blacklist
from bzrlib.urlutils import (
join as urljoin,
local_path_from_url,
@@ -1356,7 +1357,8 @@ class TestBzrImport(WorkerTest, TestActualImportMixin,
reference_url, target_url = self.createBranchReference()
source_details = self.factory.makeCodeImportSourceDetails(
url=reference_url, rcstype='bzr')
- policy = _BlacklistPolicy(True, [target_url])
+ # wokeignore:rule=blacklist
+ policy = DenylistPolicy(True, [target_url])
worker = self.makeImportWorker(source_details, opener_policy=policy)
self.assertEqual(
CodeImportWorkerExitCode.FAILURE_FORBIDDEN, worker.run())
@@ -1518,7 +1520,7 @@ class RedirectTests(http_utils.TestCaseWithRedirectedWebserver, TestCase):
self.assertEqual(self.revid, branch.last_revision())
def test_redirect_to_forbidden_url(self):
- class NewUrlBlacklistPolicy(BranchOpenPolicy):
+ class NewUrlDenylistPolicy(BranchOpenPolicy):
def __init__(self, new_url):
self.new_url = new_url
@@ -1533,7 +1535,7 @@ class RedirectTests(http_utils.TestCaseWithRedirectedWebserver, TestCase):
def transform_fallback_location(self, branch, url):
return urlutils.join(branch.base, url), False
- policy = NewUrlBlacklistPolicy(self.get_new_url())
+ policy = NewUrlDenylistPolicy(self.get_new_url())
worker = self.makeImportWorker(self.get_old_url(), policy)
self.assertEqual(
CodeImportWorkerExitCode.FAILURE_FORBIDDEN, worker.run())
diff --git a/lib/lp/codehosting/tests/helpers.py b/lib/lp/codehosting/tests/helpers.py
index 7d84e11..7173e74 100644
--- a/lib/lp/codehosting/tests/helpers.py
+++ b/lib/lp/codehosting/tests/helpers.py
@@ -18,7 +18,7 @@ import os
def create_branch_with_one_revision(branch_dir, format=None):
- """Create a dummy Bazaar branch at the given directory."""
+ """Create a test Bazaar branch at the given directory."""
# XXX cjwatson 2019-06-13: This still uses bzrlib until such time as the
# code import workers are ported to Breezy.
from bzrlib.bzrdir import BzrDir
diff --git a/lib/lp/services/scripts/__init__.py b/lib/lp/services/scripts/__init__.py
index 780803b..7dd28ad 100644
--- a/lib/lp/services/scripts/__init__.py
+++ b/lib/lp/services/scripts/__init__.py
@@ -7,16 +7,16 @@
__metaclass__ = type
__all__ = [
- 'dummy_logger_options',
'log',
'logger',
'logger_options',
+ 'placeholder_logger_options',
]
# these are intentional re-exports, apparently, used by *many* files.
from lp.services.scripts.logger import (
- dummy_logger_options,
log,
logger,
logger_options,
+ placeholder_logger_options,
)
diff --git a/lib/lp/services/scripts/base.py b/lib/lp/services/scripts/base.py
index 5134d25..55d7ff0 100644
--- a/lib/lp/services/scripts/base.py
+++ b/lib/lp/services/scripts/base.py
@@ -160,7 +160,7 @@ class LaunchpadScript:
"Run the script under the profiler and save the "
"profiling stats in FILE."))
else:
- scripts.dummy_logger_options(self.parser)
+ scripts.placeholder_logger_options(self.parser)
self.add_my_options()
self.options, self.args = self.parser.parse_args(args=test_args)
diff --git a/lib/lp/services/scripts/logger.py b/lib/lp/services/scripts/logger.py
index dfb4dc0..ea7b990 100644
--- a/lib/lp/services/scripts/logger.py
+++ b/lib/lp/services/scripts/logger.py
@@ -18,12 +18,12 @@ __all__ = [
'DEBUG7',
'DEBUG8',
'DEBUG9',
- 'dummy_logger_options',
'LaunchpadFormatter',
'log',
'logger',
'logger_options',
'OopsHandler',
+ 'placeholder_logger_options',
]
@@ -162,8 +162,8 @@ def do_nothing(*args, **kwargs):
"""Do absolutely nothing."""
-def dummy_logger_options(parser):
- """Add dummy --verbose and --quiet options to `parser`."""
+def placeholder_logger_options(parser):
+ """Add placeholder --verbose and --quiet options to `parser`."""
define_verbosity_options(parser, None, do_nothing, do_nothing)
diff --git a/lib/lp/services/scripts/tests/__init__.py b/lib/lp/services/scripts/tests/__init__.py
index 8b7e708..558455f 100644
--- a/lib/lp/services/scripts/tests/__init__.py
+++ b/lib/lp/services/scripts/tests/__init__.py
@@ -27,8 +27,7 @@ SCRIPT_LOCATIONS = [
def find_lp_scripts():
"""Find all scripts/ files in the current tree.
- Skips filename starting with '_' or not ending with '.py' or
- listed in the KNOWN_BROKEN blacklist.
+ Skips filename starting with '_' or not ending with '.py'.
"""
scripts = []
for script_location in SCRIPT_LOCATIONS: