Skip to content

Code-smell inventory (moved out of .claude/smells-todo.md) #670

Description

@Jamie-BitFlight

Why this issue exists

.claude/smells-todo.md was a checkbox backlog committed into the repository. A task list in a tracked file goes stale the moment any of it is fixed and has to be maintained in two places, so its contents are captured here and the file is removed in #634.

Line references below are from the original sweep and have drifted — src/prettier.ts:25,41 is now lines 61 and 87, for instance. The file-and-category pairing is the durable part; re-derive the exact location before acting on an entry.

Legacy Node.js patterns

  • src/svg-editor.mts — callback-based fs.writeFile() instead of promises

TypeScript modernization

  • src/constants.ts — string enum ConfigKeys (21 values)
  • src/errors/error-type.ts — string enum ErrorType
  • src/logtask/index.ts — numeric enum LogGroup
  • src/Action.ts, src/inputs.ts, src/markdowner/index.ts, src/sections/update-branding.ts — type assertions using as where satisfies would apply

Mutable static state

  • src/logtask/index.ts — shared mutable Map as a static property
  • src/logtask/index.ts — static indentWidth mutated at runtime

Error handling

  • src/index.ts — no top-level error handler for generateReadme()
  • src/prettier.ts, src/save.ts, src/inputs.ts — errors swallowed, only logged
  • src/helpers.ts, src/readme-editor.ts, src/config.ts, src/Action.ts, src/inputs.ts — untyped error catches
  • src/helpers.ts, src/Action.ts — errors wrapped without { cause: error }

Unnecessary return await

  • src/prettier.ts — return await format()
  • src/sections/index.ts — all switch cases use return await

Complexity

  • src/helpers.ts — nested try-catch cascade, 3 levels
  • src/markdowner/index.ts — 36-line function with multiple responsibilities, 4 levels of nesting

Magic numbers

  • src/helpers.ts — const width = 80, width * 0.67
  • src/sections/update-branding.ts — '15%' duplicated
  • src/sections/update-title.ts — '60px'

Code duplication

  • src/sections/update-inputs.ts and src/sections/update-outputs.ts — identical regex pattern

Dead code

  • src/sections/index.ts — commented-out condition
  • src/sections/update-usage.ts — commented-out code

Activity

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions