Skip to content

Comments

lint: replace 591 if-without-else with when/when-let/when-not#646

Merged
datdamnzotz merged 3 commits intoOrcpub:developfrom
codeGlaze:fix/lint-missing-else
Feb 20, 2026
Merged

lint: replace 591 if-without-else with when/when-let/when-not#646
datdamnzotz merged 3 commits intoOrcpub:developfrom
codeGlaze:fix/lint-missing-else

Conversation

@codeGlaze
Copy link

Making an effort to squash real lint errors and false positives.

Summary

  • Mechanically replace 591 single-branch ifwhen, if-let
    when-let, if-notwhen-not across 33 source files
  • Fix 2 pre-existing bugs where when was incorrectly used with two
    branches (should have been if)
  • Update .clj-kondo/config.edn: rename deprecated :if
    :missing-else-branch {:level :off}

Details

The missing-else-branch linter flags (if cond expr) without an else
— these should be (when cond expr) per Clojure idiom. This PR
addresses all 591 instances.

Applied via a Python script (scripts/fix-missing-else.py) that handles
multi-line forms, nested expressions, and preserves indentation. Each
replacement was verified to be a single-branch conditional.

Bug fixes found during review:

  • 2 places used when with two branches (both true and false paths) —
    corrected to if

35 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 pass
  • lein cljsbuild once dev — CLJS compiles with 0 errors
  • lein with-profile lint run -m clj-kondo.main --lint src — 0 errors, 0 warnings

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.
@codeGlaze codeGlaze force-pushed the fix/lint-missing-else branch from c11ab0c to 8d219d4 Compare February 20, 2026 00:53
@datdamnzotz datdamnzotz added bug Something isn't working area/application Task related to orcpub application itself labels Feb 20, 2026
@datdamnzotz datdamnzotz added this to the 2.5.0.29 milestone Feb 20, 2026
@github-project-automation github-project-automation bot moved this to In progress in Orcpub Feb 20, 2026
@github-project-automation github-project-automation bot moved this from In progress to Reviewer approved in Orcpub Feb 20, 2026
@datdamnzotz datdamnzotz merged commit 2b2e34f into Orcpub:develop Feb 20, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from Reviewer approved to Done in Orcpub Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/application Task related to orcpub application itself bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants