Skip to content

Commit f212a5a

Browse files
committed
More linting fixes
Signed-off-by: Eric Searcy <[email protected]>
1 parent a05f513 commit f212a5a

File tree

11 files changed

+87
-52
lines changed

11 files changed

+87
-52
lines changed

.cspell.json

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,55 @@
22
"language": "en",
33
"dictionaries": ["companies", "filetypes", "fullstack", "softwareTerms"],
44
"words": [
5-
"lfx"
5+
"authelia",
6+
"aquasecurity",
7+
"dotenv",
8+
"excepthook",
9+
"gaudin",
10+
"isoformat",
11+
"iubp",
12+
"jetstream",
13+
"lfx",
14+
"lfprojects",
15+
"linuxfoundation",
16+
"meltano",
17+
"mockdata",
18+
"searchpath",
19+
"subproject",
20+
"representer",
21+
"timestamper",
22+
"timedelta",
23+
"uuidgen"
624
],
725
"flagWords": [
8-
"abort",
9-
"abortion",
10-
"blackhat",
11-
"black-hat",
12-
"whitehat",
13-
"white-hat",
14-
"cripple",
15-
"crippled",
16-
"master",
17-
"slave",
18-
"tribe",
19-
"sanity-check",
20-
"whitelist",
21-
"white-list",
22-
"blacklist",
23-
"black-list"
26+
"abort: cancel, end, fail, halt, stop, terminate",
27+
"abortion: cancelation, ending, failure, halting, stopping, termination",
28+
"blackhat: attacker, malicious",
29+
"black-hat: attacker, malicious",
30+
"whitehat: ethical, security, researcher",
31+
"white-hat: ethical, security, researcher",
32+
"cripple: disable, degrade, impact",
33+
"crippled: disabled, degraded, impacted",
34+
"grandfathered: legacy, exempted, preauthorized",
35+
"master: controller, primary, main, leader, parent",
36+
"slave: agent, replica, secondary, follower, child",
37+
"tribe: squad, team, group",
38+
"sanity-check: test, verify, validate",
39+
"whitelist: allowlist",
40+
"white-list: allow-list",
41+
"blacklist: denylist",
42+
"black-list: deny-list"
2443
],
2544
"ignorePaths": [
2645
".cspell.json",
46+
".gitignore",
47+
".mega-linter.yml",
48+
".yamllint.yml",
2749
"CODEOWNERS",
2850
"LICENSE",
2951
"LICENSE-docs",
3052
"megalinter-reports",
53+
"pyproject.toml",
3154
"styles"
3255
],
3356
"languageSettings": [

.github/workflows/mega-linter.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ jobs:
3333
- name: MegaLinter
3434
id: ml
3535
# Use the Python flavor.
36-
uses: oxsecurity/megalinter/flavors/python@5a91fb06c83d0e69fbd23756d47438aa723b4a5a # 8.7.0
36+
uses: oxsecurity/megalinter/flavors/python@62c799d895af9bcbca5eacfebca29d527f125a57 # 9.1.0
3737
env:
38-
# All available variables are described in documentation
39-
# https://megalinter.io/configuration/
38+
# Pass token for better rate limits.
4039
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
# Allow GITHUB_TOKEN for working around rate limits (aquasecurity/trivy#7668).
42-
REPOSITORY_TRIVY_UNSECURED_ENV_VARIABLES: GITHUB_TOKEN

.lycheeignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore local Kubernetes paths.
2+
^https?://[a-zA-Z0-9.-]+\.svc\.cluster\.local

.mega-linter.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ DISABLE_LINTERS:
77
- PYTHON_PYLINT
88
# Pyright errors on missing dependencies.
99
- PYTHON_PYRIGHT
10-
# Repository-wide link checking returns mostly false positives (like internal
11-
# service URLs in templates).
12-
- SPELL_LYCHEE
1310
# yamllint is sufficient for us.
1411
- YAML_PRETTIER
1512
DISABLE_ERRORS_LINTERS:
1613
# This may be informative but doesn't need to break the build.
1714
- COPYPASTE_JSCPD
18-
# Warn on spelling only until we set up a local wordlist.
15+
# Making optional to not block builds, even though it's still important!
1916
- SPELL_CSPELL
17+
PYTHON_ISORT_ARGUMENTS: "--src src"

.yamllint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
# Copyright The Linux Foundation and each contributor to LFX.
3+
# SPDX-License-Identifier: MIT
24
extends: default
35
ignore: |
46
.git

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This tool generates mock data for the LFX v2 platform by running playbooks that
1111
- `uv` package manager installed
1212
- `jwt` CLI from [jwt-cli](https://github.com/mike-engel/jwt-cli) Rust crate available in your $PATH
1313

14-
These instructions and playbooks assume the script's execution environment has access to `*.*.svc.cluster.local` Kubernetes service URLs. These URLs in the playbooks can be overriden with environmental variables as needed.
14+
These instructions and playbooks assume the script's execution environment has access to `*.*.svc.cluster.local` Kubernetes service URLs. These URLs in the playbooks can be overridden with environmental variables as needed.
1515

1616
## Setup
1717

@@ -56,7 +56,7 @@ export PROJECTS_TOKEN COMMITTEES_TOKEN
5656
Use uv to run the mock data tool (uv will automatically manage Python versions and virtual environments):
5757

5858
```bash
59-
# Test the script (uv will create the venv automatically).
59+
# Test the script (uv will create the virtual environment automatically).
6060
uv run lfx-v2-mockdata --help
6161
# Load some data!
6262
uv run lfx-v2-mockdata -t playbooks/projects/{root_project_access,base_projects,extra_projects} playbooks/committees/base_committees

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ select = ["E", "F", "UP", "B", "G", "I"]
4040

4141
[dependency-groups]
4242
dev = [
43+
"isort>=7.0.0",
4344
"mypy>=1.17.1",
4445
"ruff>=0.6.2",
4546
"types-jmespath>=1.0.2.20250809",

scripts/mock-heimdall-jwt.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,42 @@
88

99
# Ensure we were passed at least 2 arguments.
1010
if [ "$#" -lt 2 ]; then
11-
echo "Usage: $0 <audience> <principal> [<email>]"
12-
exit 1
11+
echo "Usage: $0 <audience> <principal> [<email>]"
12+
exit 1
1313
fi
1414

1515
aud=$1
1616
principal=$2
1717
email=$3
1818

1919
if [ -n "$email" ]; then
20-
payload="{\"email\": \"$email\"}"
20+
payload="{\"email\": \"$email\"}"
2121
else
22-
payload='{}'
22+
payload='{}'
2323
fi
2424

2525
key_id="$(curl -s http://lfx-platform-heimdall.lfx.svc.cluster.local:4457/.well-known/jwks | jq -r '.keys.[0].kid')"
2626

2727
if [ -z "$key_id" ]; then
28-
echo "Failed to retrieve key ID from Heimdall"
29-
exit 1
28+
echo "Failed to retrieve key ID from Heimdall"
29+
exit 1
3030
fi
3131

3232
pem_temp_dir=$(mktemp -d)
33-
kubectl get secret/heimdall-signer-cert -n lfx -o json | jq -r '.data["signer.pem"]' | base64 --decode > "${pem_temp_dir}"/signer.pem
33+
kubectl get secret/heimdall-signer-cert -n lfx -o json | jq -r '.data["signer.pem"]' | base64 --decode >"${pem_temp_dir}"/signer.pem
3434

3535
jwt encode \
36-
--alg PS256 \
37-
--kid "$key_id" \
38-
--exp=+300s \
39-
--nbf +0s \
40-
--jti "$(uuidgen)" \
41-
--payload "aud=$aud" \
42-
--payload "iss=heimdall" \
43-
--payload "sub=${principal#clients@}" \
44-
--payload "principal=$principal" \
45-
--secret "@${pem_temp_dir}/signer.pem" \
46-
"${payload}"
36+
--alg PS256 \
37+
--kid "$key_id" \
38+
--exp=+300s \
39+
--nbf +0s \
40+
--jti "$(uuidgen)" \
41+
--payload "aud=$aud" \
42+
--payload "iss=heimdall" \
43+
--payload "sub=${principal#clients@}" \
44+
--payload "principal=$principal" \
45+
--secret "@${pem_temp_dir}/signer.pem" \
46+
"${payload}"
4747

4848
jwt_result=$?
4949

src/custom_logging/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def setup_logging(log_level: str = "INFO") -> None:
6767
structlog.configure(
6868
processors=shared_processors
6969
+ [
70-
# If log level is too low, abort pipeline and throw away log entry.
70+
# If log level is too low, halt the pipeline and throw away the log
71+
# entry.
7172
structlog.stdlib.filter_by_level,
7273
# Prepare event dict for `ProcessorFormatter`.
7374
structlog.stdlib.ProcessorFormatter.wrap_for_formatter,

src/lfx_v2_mockdata/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class JMESPathEncoder(json.JSONEncoder):
226226
"""Extend the default JSON encoder for JMESPath macros.
227227
228228
Supports both the JMESPath (!ref) and JMESPathSubstitution (!sub)
229-
objects used by lfx_v2_mockdata.
229+
macros.
230230
"""
231231

232232
def default(self, obj):
@@ -318,7 +318,7 @@ def yaml_include(loader, node):
318318
def yaml_render(template_dir, yaml_file):
319319
"""Setup Jinja2 and render and parse a YAML file."""
320320
logger.info("Loading template", template_dir=template_dir, yaml_file=yaml_file)
321-
# Check if we have already created a sandboxed Jinja2 environment for this
321+
# Check if we have already created a sandbox Jinja2 environment for this
322322
# context/directory.
323323
env = jinja_env.get(None)
324324
if env is None:
@@ -956,13 +956,13 @@ def parse_args() -> UploadMockDataArgs:
956956
action="store_true",
957957
help="dump the parsed templates as JSON to stdout (with !ref expansion)",
958958
)
959-
dryrun_group = parser.add_mutually_exclusive_group()
960-
dryrun_group.add_argument(
959+
dry_run_group = parser.add_mutually_exclusive_group()
960+
dry_run_group.add_argument(
961961
"--dry-run",
962962
action="store_true",
963963
help="do not upload any data to endpoints",
964964
)
965-
dryrun_group.add_argument(
965+
dry_run_group.add_argument(
966966
"--upload",
967967
action="store_true",
968968
help="upload to endpoints even when dumping",

0 commit comments

Comments
 (0)