Skip to content

refactor(core): replace three comment-backed workarounds - #188

Merged
PunGrumpy merged 3 commits into
mainfrom
refactor/core-workarounds
Oct 23, 2026
Merged

PunGrumpy merged 3 commits into
mainfrom
refactor/core-workarounds

Conversation

@PunGrumpy

Copy link
Copy Markdown
Owner

Description

The comment audit found three places in core where a comment exists to excuse the code next to it. This PR changes the code so the comment has nothing left to explain. Behavior does not change, and each commit adds a test that passes on the old code and on the new code.

  • loadConfig no longer awaits in a loop. It tried the seven config names one by one under /* eslint-disable no-await-in-loop */ with no reason given. findFirstConfigFile checks every name at once and takes the first that exists, in the same order, the way findRepositoryRoot in the CLI already does. A new test puts a .mjs, a .json and a .yaml config side by side and checks that the .mjs one wins.
  • volumeMount reads mappings only. It also accepted a YAML sequence, under the comment "A sequence here is invalid Compose. It has none of these keys", and returned a mount with every field undefined that all three callers then ignored. It now returns undefined for a sequence, like any other value that is not a mapping. A new test checks that the three mount rules stay silent on such an entry.
  • classifyHostPath loses an unreachable check. After path.posix.normalize and the trailing-slash trim, normalized.startsWith("./") can never match. Relative paths reach project through the last branch, whose comment already explains why. New tests pin ., ./, .//, ./src, src/data and two parent spellings.

Considered and left alone: the true-or-throw predicates in schemas/config.ts look like a workaround, but anti-slop/no-runtime-typeof only allows typeof inside a type predicate, so the lint config forces that shape.

Related Issues

N/A. Found by a comment audit of the repository.

Checklist

  • I've reviewed my code
  • I've written tests
  • I've generated a changeset file, if this changes a published package
  • I've updated the docs, if necessary

Screenshots (if applicable)

N/A

Additional Notes

  • Core tests go from 465 to 474. CLI 101 and scripts 43 are unchanged. ultracite check, typecheck and the generated docs are clean, and the PR adds no suppression.
  • skip-changeset: no behavior visible to users changes.
  • Independent of the comment-only core PR. They touch different lines and merge in either order.

@PunGrumpy PunGrumpy added pkg: core Diagnostic engine in packages/core area: rules Diagnostic rules and their findings skip-changeset This PR needs no changeset (no user-visible change to @docker-doctor/cli) labels Oct 23, 2026
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docker-doctor Ready Ready Preview Oct 23, 2026 2:32am UTC

@changeset-bot

changeset-bot Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9680110

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 369d6568-2258-4003-b92d-e83cdc3aacb9
📥 Commits

Reviewing files that changed from the base of the PR and between 8e4ba20 and 9680110.

📒 Files selected for processing: 5
  • packages/core/src/config/loader.ts
  • packages/core/src/rules/compose-mounts.ts
  • packages/core/test/compose-mounts.test.ts
  • packages/core/test/config.test.ts
  • packages/core/test/rules.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

The latest Docker Doctor scan for this pull request. Learn more about Docker Doctor.

File Status Issues Updated
Dockerfile Error 1 error, 2 info Oct 23, 2026 2:31am UTC

Score: 84 / 100 · Good

3 issues

Dockerfile

  • error Dockerfile:2 Potential secret found in ENV: 'DB_PASSWORD'. no-secrets-in-env
  • info Dockerfile:1 No HEALTHCHECK instruction found. require-healthcheck
  • info Dockerfile:1 No LABEL metadata was found in this Dockerfile. require-labels

Scanned by Docker Doctor for commit 9680110.

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@docker-doctor/cli@188

commit: 9680110

loadConfig tried each candidate name in turn, with an `await` inside a
`for` loop under an `eslint-disable no-await-in-loop` that gave no
reason. findFirstConfigFile checks every name at once and takes the
first that exists, in the same order, so the suppression goes. A new
test pins the order with a .mjs, a .json and a .yaml config side by
side.
volumeMount also accepted a YAML sequence as a long-syntax entry, with a
comment admitting that a sequence has none of the keys it reads. It
returned a mount with every field undefined, which every rule then
ignored. It now returns undefined for a sequence, as for any other value
that is not a mapping. A new test pins that the three mount rules stay
silent on such an entry.
path.posix.normalize turns `./src` into `src`, and the trailing-slash
trim turns `./` into `.`, so `normalized.startsWith("./")` could never
match. Relative paths reach `project` through the fall-through branch,
which its comment already explains. New tests pin `.`, `./`, `./src`,
`src/data` and the two parent spellings.
@PunGrumpy
PunGrumpy force-pushed the refactor/core-workarounds branch from 34ab375 to 9680110 Compare October 23, 2026 02:31
@PunGrumpy
PunGrumpy merged commit 747bd91 into main Oct 23, 2026
21 of 22 checks passed
@PunGrumpy
PunGrumpy deleted the refactor/core-workarounds branch October 23, 2026 02:33

This branch was successfully deployed

1 active deployment
Preview — 9680110f Deployed Oct 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: rules Diagnostic rules and their findings pkg: core Diagnostic engine in packages/core skip-changeset This PR needs no changeset (no user-visible change to @docker-doctor/cli)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant