8000 Release 0.21.1: Custom linting via clj-kondo · sicmutils/sicmutils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

0.21.1: Custom linting via clj-kondo

Compare
Choose a tag to compare
@sritchie sritchie released this 16 Feb 14:17
· 30 commits to main since this release
35c6c06

The big feature of this release is a custom clj-kondo config for sicmutils. All macros in the library (let-coordinates, with-coordinate-functions, all of the pattern matching macros and more) now show proper linter warnings; the pattern matching macros in particular will now show helpful warnings on cases where you've made an easy-to-correct mistake in your pattern syntax.

For example, the following form:

(require '[sicmutils.rule :as r])

(r/rule (+ (? x) (? y)) => (+ (? y odd?) (? x)))

Will provide this inline linter warning, appearing as you type:

Restrictions are not allowed in consequence bindings: odd?

See here for the full list of macros handled by the config.

Linting

  • #477 adds tight integration with the clj-kondo linter via an exported clj-kondo configuration in the resources directory. All macros in the library now offer pleasant linting to users. This is especially helpful for the macros in pattern.rule, which now can offer live feedback to pattern-matching authors.

    See doc/linting.md for details on various warnings reported, and installation instructions for the clj-kondo config.

    Thanks to @borkdude for all of his help getting this working, and making this amazing project!

    • All linter errors and warnings are now addressed, fixed and silenced for the entire codebase, both test and src directories.

    • A new Github Action will run the linter for every PR and push to master, and annotate PRs with linter warnings and errors.

Additions

  • #481 adds a new x-degree argument to sicmutils.polynomial/univariate->dense, for padding the result with zeros in the case that you want to guarantee a certain dense degree in the result.

  • #477:

    • com.gfredericks/test.chuck dev dependency upgraded to 0.2.13 to grab its clj-kondo exported config.

    • pattern.rule patterns can now handle spliced and unquote-spliced inputs in their symbol position.

Bug Fixes

  • #481 fixes a long-standing (test-only) bug in sicmutils.polynomial-test around palindromic polynomials

  • #480: sicmutils.numerical.quadrature/definite-integral now coerces the result of non-compiled integrands in cljs to double. This prevents the @kloimhardt bug where certain paths would produce BigInt instances and fail in quadrature calls.

  • in #477, I found the following bugs with the help of the linter:

    • Deleted the unused sicmutils.differential/d:apply.

    • Fixed a bug with sicmutils.expression.render/->JavaScript not using the second argument to remainder.

    • deleted sicmutils.numerical.quadrature.common in favor of sicmutils.generic/infinite?

    • Fixed a broken integrator in sicmutils.numerical.quadrature.simpson38, and fixed the tests to actually stress this code.

    • Fixed a bug where sicmutils.numerical.quadrature.substitute/exponential-upper was not actually using its input function!

    • unused simplify argument removed from sicmutils.simplify.rules/non-negative-factors! and all uses.

    • Bug fix in sicmutils.special.elliptic/jacobi-elliptic-functions; deep in the gnarly fn, one of the branches returned nil instead of its required values. Thank you, linter!

    • sicmutils.pattern/template will no longer error in the 1-arity case when some form contains a binding entry like (? (fn [m] ...)). Instead, the function will be passed an empty map.

0