lint: replace 591 if-without-else with when/when-let/when-not#646
Merged
datdamnzotz merged 3 commits intoOrcpub:developfrom Feb 20, 2026
Merged
lint: replace 591 if-without-else with when/when-let/when-not#646datdamnzotz merged 3 commits intoOrcpub:developfrom
datdamnzotz merged 3 commits intoOrcpub:developfrom
Conversation
Mechanical substitution: (if cond body) -> (when cond body) across 33 source files. Zero behavioral change — when is the idiomatic Clojure form for single-branch conditionals. Also updates .clj-kondo/config.edn to enable missing-else-branch warnings and other linter improvements from the modernization branch. Brings lint warnings from 591 to 0.
Add LSP false-positive suppression from lint-dead-code branch: exclude-when-defined-by for re-frame registrations, specific var exclusions for cross-file macro references. Ensures both lint branches share identical kondo config to avoid merge conflicts.
Removed broken with-conn lint-as, added orcpub.errors unresolved-var exclude, added spell_subs cross-file refs to unused-public-var exclude.
c11ab0c to
8d219d4
Compare
datdamnzotz
approved these changes
Feb 20, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Making an effort to squash real lint errors and false positives.
Summary
if→when,if-let→when-let,if-not→when-notacross 33 source fileswhenwas incorrectly used with twobranches (should have been
if).clj-kondo/config.edn: rename deprecated:if→:missing-else-branch {:level :off}Details
The
missing-else-branchlinter flags(if cond expr)without an else— these should be
(when cond expr)per Clojure idiom. This PRaddresses all 591 instances.
Applied via a Python script (
scripts/fix-missing-else.py) that handlesmulti-line forms, nested expressions, and preserves indentation. Each
replacement was verified to be a single-branch conditional.
Bug fixes found during review:
whenwith two branches (both true and false paths) —corrected to
if35 files changed, 702 insertions / 595 deletions.
Verified: 0 lint errors, 0 lint warnings, 102 JVM tests pass, CLJS compiles clean.
Test plan
lein test— 102 tests passlein cljsbuild once dev— CLJS compiles with 0 errorslein with-profile lint run -m clj-kondo.main --lint src— 0 errors, 0 warnings