Skip to content

BUG: --autocorrect finds lint/if-nil-else in .cljc file reader conditionals even if it's not shown in normal mode #48

Description

@Cyrik

Me written this time, sorry for last time (also my assertion that :enabled got ignored was wrong. I didn't realize that lint/if-else-nil and lint/if-nil-else both exist and are different):

Splints --autocorrect finds and fixes issues in .cljc files that aren't issues in normal mode (and shouldn't be).

Repro src/example.cljc:

(ns example.app)

(defn pick [d]
  (if (zero? d)
    #?(:clj :clj-branch :default :default-branch)
    d))

normal run:

bb -Sdeps '{:deps {io.github.noahtheduke/splint {:mvn/version "1.24.0"}}}' \
   -m noahtheduke.splint src/

Linting took 4ms, checked 1 files, 0 style warnings

--autocorrect run:

bb -Sdeps '{:deps {io.github.noahtheduke/splint {:mvn/version "1.24.0"}}}' \
   -m noahtheduke.splint --autocorrect src/

Replacing
(if (zero? d) nil d)
 with
(when-not (zero? d) d)
in src/example.cljc:4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions