-
Notifications
You must be signed in to change notification settings - Fork 0
Turn the Codacy tool toggles on, with every baseline measured #950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
loganfinney27
wants to merge
35
commits into
main
from
claude/lint-config-stubs-qzt7le
base: main
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,846
−45
Open
Changes from 27 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
6adb0d6
Add twelve linter config stubs, inert by construction
claude f977163
Set the Codacy toggles ON, and add ruff and bandit
claude 1b39d3d
Install the config packages instead of writing around them
claude e8f104e
Describe the redaction damage without reproducing its signature
claude dd9a8d1
Cut the configs to what cannot be derived from the files themselves
claude 0eaed05
Correct four "reach is zero" claims that were never checked
claude cb5580f
Fix six CodeRabbit findings; the reach four were already corrected
claude 5f376be
Move a stranded comment onto the block it describes
claude ff7db3e
Correct an understated note in .semgrep.yaml
claude 44b393f
Record what actually makes Codacy read these files
claude 1e2c676
Fix three defects reviewers raised and I never answered
claude 4c4f7c7
Close three more reviewer findings, and measure the pylint baseline
claude a924cf1
Fix a .bandit exclude list that excluded nothing, and measure bandit
claude 49d2f6e
Measure semgrep and shellcheck; nothing left assumed uninstallable
claude 0a7d460
.eslintrc.js is not inert — it breaks modern ESLint runs
claude 900c6c6
Correct the .eslintrc.js header: the file stays, and here is why
claude f9d3aa7
Add yaml.CUnsafeLoader to the unsafe-loader rule
claude 4cc2a87
Remove a duplicated, self-contradicting block from .eslintrc.js
claude 51eb8ba
Get the missing tools instead of documenting their absence
claude 3b554dc
Close a keyword-argument hole that made three unsafe calls invisible
claude 2ec4345
Declare the Node globals Codacy's generated ESLint config lacks
claude ddcc877
Re-measure four config claims that main invalidated under them
claude 6cfa201
Re-measure the loader table on a version the manifest permits
claude b8b4796
Correct the file count in the pylint baseline note I just added
claude 94e6f38
Stop my own no-undef fix from drawing no-redeclare locally
claude 7f0fa60
fix: validate lint configs and formatting
5d3084c
fix: harden workflow event handling
0745d00
fix: remove redundant module global declarations
6b3c112
fix: safely parse secret policy event data
678c09f
Merge remote-tracking branch 'origin/main' into pr950-main-update
14cd563
fix: align lint baseline and remove unused remark cli
ee90869
fix: use supported lint configuration formats
28642b9
chore: update branch with current main
d787708
Merge branch 'main' into claude/lint-config-stubs-qzt7le
loganfinney27 261fc9b
fix(eslint): make the slides-templates override reachable — ignore la…
loganfinney27 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Bandit — Codacy toggle. INI. Read with `bandit --ini .bandit <targets>`. | ||
| # | ||
| # NOT `-c .bandit`: that flag parses YAML and dies on line 12 with | ||
| # "expected '<document start>', but found '<scalar>'". And there is no | ||
| # auto-discovery — plain `bandit -r .` from this directory never reads this | ||
| # file. An earlier version of this header said INI "is the form bandit reads | ||
| # from a file named .bandit", which skipped the part that matters: WHICH flag. | ||
| # Measured on bandit 1.9.4. | ||
| # | ||
| # No `skips`: every test bandit enables by default runs. | ||
| # | ||
| # MEASURED — 156 findings over 136 files / 26,238 LOC, with the exclusion | ||
| # below actually working: | ||
| # | ||
| # 0 HIGH · 13 MEDIUM · 143 LOW | ||
| # 47 B603 subprocess_without_shell_equals_true | ||
| # 30 B404 blacklist (import subprocess) | ||
| # 29 B607 start_process_with_partial_path | ||
| # 23 B101 assert_used | ||
| # 7 B310 urlopen audit · 6 B105 hardcoded_password_string | ||
|
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
|
||
| # | ||
| # B404/B603 lead, as predicted — this repo drives git and uv through | ||
| # subprocess. Those are probably fine (literal argument lists, never shell | ||
|
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
|
||
| # strings), but that is a judgement to record per call site with | ||
| # `# nosec B603 - reason`, not to assume repo-wide. The 13 MEDIUMs are worth | ||
| # a real look: B310 urlopen without scheme restriction in wayback_audit.py, | ||
|
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
|
||
| # janitor_sweep.py and obsidian_rest_api_client.py; B314 XML parsing in | ||
|
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
|
||
| # build_knowledge_graph.py; B108 temp-file usage in codex_work_guard.py; | ||
|
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
|
||
| # B104 bind-all-interfaces in main.py. | ||
|
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
|
||
| # | ||
| # THE EXCLUDE FORM IS LOAD-BEARING. Bare directory names DO NOT MATCH. | ||
| # Measured over the same tree: | ||
| # | ||
| # -x .venv -> 987 findings, 831 of them inside .venv (inert) | ||
| # -x ./.venv -> 156 findings, 0 inside .venv (works) | ||
| # -x '*/.venv/*' -> 156 findings, 0 inside .venv (works) | ||
| # | ||
| # This file previously read `exclude = THE-GEMSTONE,node_modules,.venv,...`, | ||
| # which excluded nothing: 84% of the findings came from .venv, the very | ||
| # directory it named. The other four names looked like they worked only | ||
| # because none of them contains any Python. Globs are used here rather than | ||
| # `./` prefixes so the match holds however bandit is invoked. | ||
| # | ||
| # `.git` is dropped from the list — bandit excludes it by default, along with | ||
| # .svn, CVS, .bzr, .hg, __pycache__, .tox, .eggs and *.egg. Naming it here | ||
| # added nothing and made the list look more load-bearing than it was. | ||
|
|
||
| [bandit] | ||
| exclude = */THE-GEMSTONE/*,*/node_modules/*,*/.venv/*,*/.uv-cache/* | ||
|
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Checkov — Codacy toggle. `skip-check: []` suppresses nothing, and keeps the | ||
| # file a valid mapping. | ||
| # | ||
| # TWO SURFACES, not one. An earlier version of this file said workflows were | ||
| # the only one — written without looking: | ||
| # | ||
| # .github/workflows/ CKV_GHA_* checks | ||
| # Dockerfile root, FROM python:3.13-slim, built by | ||
| # .github/workflows/cloud-run-deploy.yml | ||
| # | ||
| # The workflow surface is already guarded twice, by | ||
| # .github/workflows/action-pin-policy.yml and by CodeQL's `actions` analysis. | ||
| # When the three disagree, the repo's own policy workflow wins — it is the one | ||
| # that gates merges. The Dockerfile surface is guarded by nothing else, which | ||
| # makes it the part of this toggle that actually earns its keep. | ||
| # | ||
| # MEASURED — checkov 3.3.10, both surfaces, with this config: | ||
| # | ||
| # .github/workflows/ 1039 passed, 25 failed | ||
| # 16 CKV2_GHA_1 top-level permissions set to | ||
|
loganfinney27 marked this conversation as resolved.
|
||
| # write-all | ||
| # 9 CKV_GHA_7 build output can be affected by | ||
|
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
|
||
| # user parameters | ||
|
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
|
||
| # Dockerfile 51 passed, 1 failed | ||
|
loganfinney27 marked this conversation as resolved.
|
||
| # 1 CKV_DOCKER_2 no HEALTHCHECK instruction | ||
|
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
|
||
| # | ||
| # The 16 write-all findings are the ones to look at first, and they are the | ||
| # kind the two existing workflow guards do not catch: action-pin-policy.yml | ||
| # checks SHA pinning, not permission scope. | ||
| # | ||
| # NOTE ON INVOCATION: `-d .github/workflows -f Dockerfile` in one run silently | ||
| # reports only the github_actions framework — the Dockerfile is dropped without | ||
| # a word. The two numbers above come from two separate runs. A single combined | ||
| # run would have looked complete and quietly omitted half the surface. | ||
| # | ||
| # An earlier version of this note said checkov "could not be obtained in the | ||
| # environment this was written in." It could: the pip install fails only | ||
| # because it cannot uninstall a system PyJWT, and a venv sidesteps that | ||
| # entirely. The obstacle was real and thirty seconds deep; recording it as an | ||
| # unknown baseline made a gap look like a finding (AGENTS.md, "Fix Errors - Do | ||
| # NOT Disable"). | ||
| # | ||
| # `check:` is exclusive, not additive: setting one id disables every other | ||
| # check while reading like you enabled something. `skip-check:` is the additive | ||
| # one. | ||
|
|
||
| skip-check: [] | ||
|
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
loganfinney27 marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| /* global module */ | ||
| // | ||
| // Codacy does not read this repository's ESLint config. Its CLI prints | ||
| // "ESLint configuration created based on Codacy settings" and generates its own | ||
| // from the Code patterns page, so the `sourceType: "commonjs"` and | ||
| // `globals.node` declared in eslint.config.js never reach Codacy's run. These | ||
| // files really are CommonJS, so Codacy's generated config drew no-undef on | ||
| // `module` and `require`. Reproduced locally with codacy-cli-v2: exactly the | ||
| // four alerts code scanning reported, same files, same lines. | ||
| // | ||
| // The directive above states a fact rather than silencing a rule -- both are | ||
| // Node CommonJS modules and both globals exist at run time. `/* global */` is | ||
| // honoured by every ESLint config including a generated one; `eslint-env node` | ||
| // would not be, having been removed in ESLint 9. | ||
|
|
||
| // ESLint legacy config — NOT MERELY INERT. IT BREAKS MODERN ESLINT RUNS. | ||
| // | ||
| // Measured on eslint 10.8.1 (pinned in package.json): eslint.config.js is the | ||
| // only format read. Move it aside and ESLint refuses to run — "couldn't find | ||
| // an eslint.config.(js|mjs|cjs) file" — rather than falling back here. The | ||
|
loganfinney27 marked this conversation as resolved.
Outdated
|
||
| // ESLINT_USE_FLAT_CONFIG=false escape hatch is gone, and `eslint --help` lists | ||
| // no eslintrc options. | ||
| // | ||
| // THE COST IS NOT ZERO, and an earlier version of this header said it was. | ||
| // "Inert" is only true while nothing points ESLint at this file. The moment | ||
| // something does, the whole run dies: | ||
| // | ||
| // $ eslint --config .eslintrc.js <anything> | ||
| // A config object is using the "root" key, which is not supported in | ||
| // flat config system. | ||
| // | ||
| // Not one bad key, either — removing `root` moves the error to `env`, and | ||
| // after that would come `extends`, `overrides`, `ignorePatterns`. This is an | ||
| // eslintrc file; ESLint 10 cannot load it at all, by design. | ||
| // | ||
| // This is not hypothetical. CodeRabbit's ESLint integration detects this file, | ||
| // points ESLint 10.8.1 at it, and fails — so its ESLint tool currently reports | ||
| // nothing on this repo, on every PR, because this file exists. Reproduced | ||
| // locally with the exact error above. | ||
| // | ||
| // WHY THE FILE STAYS ANYWAY. Codacy runs two separate ESLint tools, and each | ||
| // reads a different filename: | ||
| // | ||
| // Codacy ESLint 8.57.0 -> .eslintrc.js, .eslintrc.cjs, .eslintrc.{yaml,yml,json} | ||
| // Codacy ESLint 9.39.5 -> eslint.config.js, eslint.config.mjs, eslint.config.cjs | ||
| // | ||
| // So this file is the config for a toggle that is available to enable, not a | ||
| // relic. An earlier version of this header argued the opposite — that upstream | ||
| // ESLint 8 going EOL in October 2024 made the file dead weight. That is a fact | ||
| // about upstream and says nothing about which tools Codacy offers; deleting | ||
| // the file would silently remove one of the two options. | ||
| // | ||
| // Note also that Codacy's v9 is 9.39.5, NOT the 10.8.1 pinned in package.json. | ||
| // eslint.config.js is verified against 9.39.5 as well: it loads, applies | ||
| // js.configs.recommended, and correctly leaves `document` undefined outside | ||
| // .obsidian/plugins/** — checked against fixtures, since a clean exit and "no | ||
| // files matched" produce identical output. | ||
| // | ||
| // The CodeRabbit breakage is therefore not an argument for deleting this file. | ||
| // It is an argument for telling CodeRabbit not to run its own ESLint, which is | ||
| // duplicating Codacy and currently reporting nothing: | ||
| // | ||
| // # .coderabbit.yaml | ||
| // reviews: | ||
| // tools: | ||
| // eslint: | ||
| // enabled: false | ||
| // | ||
| // (`reviews.tools.eslint.enabled` confirmed against CodeRabbit's published | ||
| // schema.v2.json.) That change belongs in .coderabbit.yaml, a shared surface, | ||
| // and has not been made here. | ||
| // | ||
| // Which of the two files governs therefore depends on which ESLint tool is | ||
| // enabled on the Code patterns page, not on a version guess. Both are present | ||
| // so either choice finds a config, and a rule added here but not to | ||
| // eslint.config.js affects nothing when the v9 tool is the one enabled. | ||
| // | ||
| // This file is verified against the tool it exists for. eslint 8.57.0 loads it | ||
| // and reports through it: | ||
| // | ||
| // $ eslint@8.57.0 --no-eslintrc -c .eslintrc.js broken.js | ||
| // 1:13 error 'undefinedThing' is not defined no-undef | ||
| // 2:5 error 'x' is assigned a value but never used no-unused-vars | ||
| // | ||
| // including `env.es2024`, which a reviewer believed ESLint 8 did not define. A | ||
| // clean run alone would not have settled that — an ignored key and an accepted | ||
| // key look identical — so the control: the same file with `es2024` changed to | ||
| // a bogus `es9999` fails hard with "Error: --config". ESLint 8.57.0 rejects | ||
| // unknown environments, so es2024 passing means it is really in the table. | ||
| // | ||
| // It mirrors eslint.config.js so the two cannot disagree: `eslint:recommended` | ||
| // is the eslintrc spelling of what @eslint/js provides there, and `env` | ||
| // supplies what the `globals` package supplies there. | ||
|
|
||
| module.exports = { | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| root: true, | ||
| env: { node: true, es2024: true }, | ||
|
loganfinney27 marked this conversation as resolved.
Outdated
|
||
| parserOptions: { ecmaVersion: 2024, sourceType: "script" }, | ||
| extends: ["eslint:recommended"], | ||
| ignorePatterns: [ | ||
| "THE-GEMSTONE/", | ||
| "node_modules/", | ||
| ".venv/", | ||
| ".uv-cache/", | ||
| ], | ||
| overrides: [ | ||
| { | ||
| // Electron renderer: browser globals ON TOP of node. Scoped here rather | ||
| // than set at the root, so a stray `window` in a non-plugin script is | ||
| // still reported. Mirrors the flat config's per-path globals block. | ||
| files: [".obsidian/plugins/**/*.js"], | ||
| env: { browser: true }, | ||
| }, | ||
| { | ||
| // Mirrors the flat config's ESM block; see eslint.config.js. | ||
| // Recursive, matching the flat config's glob exactly. The two select the | ||
| // same file today -- templates/ has no subdirectories -- so this is | ||
| // correct-by-construction rather than a live fix: it keeps the pair from | ||
| // silently diverging the first time a nested template lands. | ||
| files: [".codex/skills/codex-primary-runtime/slides/templates/**/*.js"], | ||
| parserOptions: { sourceType: "module" }, | ||
| globals: { | ||
| __DECK_ID_JSON__: "readonly", | ||
| __OUT_DIR_JSON__: "readonly", | ||
| __REFERENCE_DIR_JSON__: "readonly", | ||
| __SLIDES_JSON__: "readonly", | ||
| }, | ||
| }, | ||
| ], | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.