[Bug] complex_conditional scores in Vue and Svelte files although it is advisory in TypeScript and JavaScript

Open
#6,302 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@wanjinhao1 is already working on this.

Since Nov 25, 2026.

  • #6325 by @wanjinhao1 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Domain
analytics

Research direction

Start in packages/core/src/repowise/core/analysis/health/scoring.py: read _ADVISORY_BY_LANGUAGE (around lines 590-608), _SCORED_ONLY_IN, and _advisory_in, which matches the file's language tag exactly. The maintainers still need to choose between aliasing vue and svelte to the script language or adding measured cells, and linked PR #6325 is already open, so check it first. Done means the new cells or aliases are recorded in docs/architecture/code-health.md section 5.4 and tests/unit/health/test_advisory_by_language.py passes.

Written by the indexing model from the issue text.

Description

bug help wanted

Summary

_ADVISORY_BY_LANGUAGE["complex_conditional"] lists 15 language tags but not vue or svelte, so the same TypeScript condition is advisory in a .ts file and scored as a defect in a .vue or .svelte file.

packages/core/src/repowise/core/analysis/health/scoring.py:590-608

_ADVISORY_BY_LANGUAGE: dict[str, frozenset[str]] = {
    "complex_conditional": frozenset({"c", "cpp", ..., "javascript", ..., "typescript"}),

Mechanism

  • _advisory_in (scoring.py:641-646) matches the file's language tag exactly, and vue and svelte are their own tags (ingestion/languages/specs/vue.py:23, specs/svelte.py:13).
  • The table needs measured numbers in docs/architecture/code-health.md section 5.4; the complex_conditional row (:352) has javascript 2/5 and typescript 1/8 and no vue or svelte cell.
  • Vue and Svelte script blocks are parsed as JavaScript or TypeScript, so those cells describe the same code.
  • The same gap exists for primitive_obsession and god_class, and _SCORED_ONLY_IN (:635) makes dry_violation advisory in .vue although it scores in .ts.

Repro

The same function with a (a > 1 && b < 2) || (c && d === "x") || (a === b && !c) condition in src/check.ts, in <script lang="ts"> of src/Check.vue, and in src/Check.svelte. After repowise init --mode fast --no-prose on main, health_findings:

('src/Check.svelte', 'complex_conditional', 'high', 1.442, 'defect')
('src/Check.vue', 'complex_conditional', 'high', 1.442, 'defect')
('src/check.ts', 'complex_conditional', 'high', 0.0, 'advisory')

Impact

Vue and Svelte files lose score and rank as refactoring targets for a marker that does not predict defects in the language their scripts are written in.

Done looks like

  • vue and svelte follow the script language's cell for complex_conditional, either by an alias to that cell or by a measured cell of their own.
  • Apply the same decision to the other per-language tables, so a .vue file never scores differently from the .ts it contains.
  • Record the alias or the numbers in docs/architecture/code-health.md section 5.4.
  • complex_method, nested_complexity and large_method keep scoring in every language.
  • Help wanted: needs a call on alias versus measurement.

Tests

tests/unit/health/test_advisory_by_language.py: vue and svelte are advisory for complex_conditional and still scored for complex_method.

Dominant language
Python
Stars
7.1k
Forks
756
Avg merge
21h 5m
Merged PRs (30d)
797

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from repowise-dev/repowise

All issues in repowise-dev/repowise

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.