Splint 1.3.0 and 1.4.0 and 1.50

Gonna put the patch notes below the fold


v1.3.0 is all new rules, some of which might be helpful! These are all pretty self-explanatory:

  • naming/single-segment-namespace: Prefer (ns foo.bar) to (ns foo).
  • lint/prefer-require-over-use: Prefer (:require [clojure.string ...]) to (:use clojure.string). Accepts different styles in the replacement form: :as, :refer [...] and :refer :all.
  • naming/conventional-aliases: Prefer idiomatic aliases for core libraries ([clojure.string :as str] to [clojure.string :as string]).
  • naming/lisp-case: Prefer kebab-case over other cases for top-level definitions. Relies on camel-snake-kebab.
  • style/multiple-arity-order: Function definitions should have multiple arities sorted fewest arguments to most: (defn foo ([a] 1) ([a b] 2) ([a b & more] 3))

v1.4.0 added -v and --version to the cli, which is obvious in hindsight. Also adds config TYPE to print either the full config (any local merged on top of default), the local (just the local file), and the diff (to only see where the local is different from default when explicitly setting local config to match defaults).

I also fixed a couple small bugs.

v1.5.0 adds a new genre! metrics will handle rules that are like style rules but meant to help give you rough measures of code quality (complexity, etc). metrics/fn-length is my first attempt to see how it works and how it looks. I suspect I won't like it but we'll see lol.

  • metrics/fn-length: Function bodies shouldn't be longer than 10 lines. Has :body and :defn styles, and :length configurable value to set maximum length.

Changed how I write tests to make it better: Now I'm using nubank/matcher-combinators to do sub-matching, meaning I can check multiple things at once in a single assertion. Love it. Here's some other changes:

  • Track end position of diagnostics.
  • Attach location metadata to function "arities" when a defn arg+body isn't wrapped in a list.
  • Parse defn forms in postprocessing and attach as metadata instead of parsing in individual rules.

Fixed some bugs:

  • Fix style/multiple-arity-order with :arglists metadata.
  • Fix binding pattern when binding is falsey.
  • Skip #(.someMethod %) in lint/fn-wrapper.
  • Skip and and or in style/prefer-condp.
Liked the post? Hated the post? Felt nothing whatsoever about the post? Email me, and let me know!


Copyright © 2024 Noah Bogart
Website credits