Skip to content

fix(quality): resolve all 28 repo-level Codacy issues (ESLint8 suppressions + 9 code fixes) - #628

Open
d-oit wants to merge 7 commits into
mainfrom
fix/codacy-repo-issues-2026-08-10
Open

fix(quality): resolve all 28 repo-level Codacy issues (ESLint8 suppressions + 9 code fixes)#628
d-oit wants to merge 7 commits into
mainfrom
fix/codacy-repo-issues-2026-08-10

Conversation

@d-oit

@d-oit d-oit commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

Resolves all 28 repo-level Codacy issues on main (23 High, 3 Error, 2 Warning) via a mix of real code fixes and false-positive suppressions.

Root cause

.codacy.yml disables ESLint9_-prefixed rules, but Codacy's cloud analysis actually runs the legacy ESLint (v8) engine, which reports ESLint8_-prefixed pattern IDs — so every suppression was silently ineffective. Added an eslint-8 engine section with matching ESLint8_ suppressions for verified false-positive patterns.

Real code fixes (9)

File Fix
triz-view.tsx Clipboard promise: void ... .catch() + try/catch (no-floating-promises, no-unnecessary-condition)
type-selector.tsx Removed unnecessary ?. on in-bounds NodeList index
command-palette.tsx `
shared-primitives.tsx [0].at(0) so ?? container fallback is type-honest
form.tsx Removed dead if (!fieldContext) guard (never null; dereferenced above)
use-mobile.ts Braces around void-returning arrow cleanup
encrypt-export-dialog.tsx void handleExport(...) (no-misused-promises)
export-format-grid.tsx Braces around void setter (no-confusing-void-expression)
self-fix-loop.sh SC2015: `A && B

False positives suppressed (19)

  • 3× SSRF (Semgrep) — all fetches guarded by validateOllamaUrl (localhost-only) / protocol + isPrivateIP checks; added inline // nosemgrep markers with justification
  • xss/no-mixed-html — React JSX components, DOM-node refs, and file downloads (not raw HTML strings executed in DOM)
  • security/detect-object-injection — indexing constant lookup tables (TRIZ_PARAMETERS, BUTTON_VARIANTS) with typed keys
  • no-unnecessary-condition — runtime-defensive optional chaining where the type system is non-nullable

Validation

  • tsc -p tsconfig.app.json --noEmit
  • ESLint on all changed files ✓
  • 95 tests across 8 affected suites ✓
  • shellcheck on self-fix-loop.sh

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
do-knowledge-studio Ready Ready Preview, v0 Aug 10, 2026 7:32am

@deepsource-io

deepsource-io Bot commented Aug 10, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 63558b9...a5182f8 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Aug 10, 2026 7:31a.m. Review ↗
Python Aug 10, 2026 7:31a.m. Review ↗
Shell Aug 10, 2026 7:31a.m. Review ↗
SQL Aug 10, 2026 7:31a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

</button>
<button
onClick={() => handleExport('encrypted')}
onClick={() => { void handleExport('encrypted') }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 'undefined' and instead saw 'void'


The void operator takes an operand and returns undefined. It can be used to ignore the value produced by an expression. However, this can lead to code that is difficult to understand and maintain. Historically, the void operator was used to get a "pure" undefined value, as the undefined variable was mutable prior to ES5.

navigator.clipboard?.writeText(text)
try {
// Clipboard can be unavailable in insecure contexts; rejection is non-fatal.
void navigator.clipboard.writeText(text).catch(() => undefined)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 'undefined' and instead saw 'void'


The void operator takes an operand and returns undefined. It can be used to ignore the value produced by an expression. However, this can lead to code that is difficult to understand and maintain. Historically, the void operator was used to get a "pure" undefined value, as the undefined variable was mutable prior to ES5.

@codacy-production

codacy-production Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@owl-watch owl-watch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦉 OwlWatch reviewed this change — 2 new finding(s).

Additional findings:

  • [HIGH · tracker] Potential out-of-bounds array access in keyboard navigation (src/components/studio/views/type-selector.tsx:96)

Comment thread scripts/self-fix-loop.sh Outdated
elif echo "$logs" | grep -qiE "(link|broken.*reference|404)"; then
info "Link/reference error detected — running validate-links..."
[ -f ./scripts/validate-links.sh ] && ./scripts/validate-links.sh 2>/dev/null || true
[ -f ./scripts/validate-links.sh ] && { ./scripts/validate-links.sh 2>/dev/null || true; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦉 OwlWatch [MEDIUM · mason] Long function phase_fix (118 lines)

Extract failure handling logic into specific handler functions to reduce cyclomatic complexity and improve readability.

@owl-watch owl-watch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦉 OwlWatch reviewed this change — 1 new finding(s).


const handleCopy = (text: string, id: number) => {
navigator.clipboard?.writeText(text)
try {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦉 OwlWatch [MEDIUM · mason] Long component TrizView (381 lines)

Decompose TrizView by extracting sub-components and potentially a custom hook for state/logic.

@github-actions github-actions Bot added the documentation Documentation improvements label Aug 10, 2026

@owl-watch owl-watch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦉 OwlWatch reviewed this change — 1 new finding(s).

const useFormField = () => {
const fieldContext = React.useContext(FormFieldContext)
const itemContext = React.useContext(FormItemContext)
// fieldContext is never null (context has a default value) and is dereferenced

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦉 OwlWatch [HIGH · tracker] Missing guard for FormField context leads to potential runtime error

The removal of the fieldContext guard in useFormField allows calling useFormState with an undefined name if the hook is used outside of a FormField provider, leading to potential runtime errors.

@owl-watch owl-watch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦉 OwlWatch reviewed this change — 1 new finding(s).

options[nextIdx]?.focus()
// nextIdx is always within [0, options.length) via the modulo above,
// and the non-empty guard runs earlier — .item() is safe to call directly.
options.item(nextIdx).focus()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦉 OwlWatch [LOW · tracker] Potential for brittle code, though not a bug

The use of .item().focus() on a NodeList is safe due to prior checks, but could be clearer.

Convert the five JS-0067-flagged export function declarations (TrizView,
TypeSelector, CommandPalette, useIsMobile, Overlay) to const arrow
functions, the AGENTS.md-preferred form, and drop the void operator from
the two JS-0098-flagged promise call sites (clipboard write, encrypted
export) in favor of .catch(() => undefined), which satisfies Codacy's
no-floating-promises rule without the void keyword.

DeepSource reported issuesSuppressedCount: 0 for these codes despite the
issue_patterns in .deepsource.toml, so the code fix is the primary remedy.

/** Accessible modal overlay with focus trap, scroll lock, and configurable layout variant. */
export function Overlay({
export const Overlay = ({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`Overlay` has a cyclomatic complexity of 7 with "medium" risk


A function with high cyclomatic complexity can be hard to understand and
maintain. Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A higher cyclomatic complexity indicates
that the function has more decision points and is more complex.


/** TRIZ contradiction matrix view for picking parameters and viewing suggested inventive principles. */
export function TrizView() {
export const TrizView = () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`TrizView` has a cyclomatic complexity of 27 with "very-high" risk


A function with high cyclomatic complexity can be hard to understand and
maintain. Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A higher cyclomatic complexity indicates
that the function has more decision points and is more complex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config documentation Documentation improvements scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant