Splint v1.16.0

The --only cli flag is one I've been meaning to implement for a while but just hadn't gotten around to. It's really only helpful when you're zeroing in on a problem rule, but there will always be uses.

The rule lint/duplicate-case-test is already checked by case's expansion, but I think it's good for static analysis tools to verify that stuff too. And lint/locking-object should help uncover subtle bugs, especially in concurrent situations.

Honestly, having been fired, I just don't have the strong drive to work on this like I did. I no longer have a 140k sloc project to test against, so there's less for me to look at and find inspiration from. I'm trying to keep up with it tho, it's helpful to not get rusty.

Full changelog under the cut


New rules

  • lint/redundant-call-str: Don't call str on input that's guaranteed to be a string: Prefer "foo" to (str "foo"), (str "foo" bar) to (str (str "foo" bar)), and (format "foo%s" bar) to (str (format "foo%s" bar)). (See clj-kondo#2323 for inspiration.)
  • lint/duplicate-case-test: Don't use the same case test constant more than once.
  • lint/locking-object: Prefer to lock on a symbol bound to (Object.).

Added

  • --only RULE cli flag to run only specified rules or genres. Can be used multiple times. (#13)

Changed

  • Switched from clojure.pprint to fipp for pretty-printing code. Fast and easy to extend.
  • Use org.flatland/ordered (when run in Clojure) to keep parsed maps and sets in their read order.
  • Add exceptions to diagnostics and print stack traces in all errors. Should fix bugs where all that's printed is Splint encountered an error: "" which is unhelpful and shameful.
  • External links in default.edn are now :links, a vector of strings. This allows for listing multiple references.
  • Switch all tests to Lazytest to do some dogfooding.
  • Enforce that ?? only 1 or 2 arguments, and if provided, that the predicate is a symbol.
  • Updated all dependencies.

Fixed

  • Outputs json and json-pretty now work with Babashka, by relying on Babashka's built-in chehire.core instead of clojure.data.json. This shouldn't result in any observable differences. I'd use cheshire.core for both, but cheshire.core is much bigger and more complicated than clojure.data.json, and it's a pain in the ass imo.
Liked the post? Hated the post? Felt nothing whatsoever about the post? Email me, and let me know!


Copyright © 2024 Noah Bogart
Website credits