Skip to content

Code and test quality cleanup#3859

Merged
bbatsov merged 9 commits intomasterfrom
code-cleanup
Feb 8, 2026
Merged

Code and test quality cleanup#3859
bbatsov merged 9 commits intomasterfrom
code-cleanup

Conversation

@bbatsov
Copy link
Member

@bbatsov bbatsov commented Feb 8, 2026

Summary

A collection of small code quality improvements across the codebase:

  • Remove dead Emacs version checks — CIDER requires Emacs 28+, so (version< emacs-version "26") branches in cider.el can never be taken
  • Remove stale obsolete function aliases — 5 aliases deprecated since version 0.18 (current is 1.21)
  • Modernize buffer-local variable pattern — replace make-local-variable + push with setq-local
  • Fix test quality issues — typo in test description, copy-paste bug (duplicate -T:test instead of -X:test), describe incorrectly nested inside it, and fset polluting global function namespace replaced with properly namespaced helpers
  • Replace (when (not ...)) with (unless ...) — 7 instances across 4 files
  • Fix minor antipatterns(not (null x))x, (= (length path) 0)(string-empty-p path), merge adjacent string literal concatenations
  • Remove unused definitions — 4 dead defvar/defcustom/defconst, 6 unused require statements, 4 unused declare-function statements

Test plan

  • All 426 unit tests pass (0 failures)
  • No new byte-compilation errors introduced (only pre-existing warnings in cider-stacktrace.el remain)

CIDER requires Emacs 28+, so `(version< emacs-version "26")` branches
can never be taken. Simplify `cider--ssh-hosts` to use a plain `let`
binding for `non-essential` instead of `cl-progv`, and simplify
`cider--tramp-file-name` to call `make-tramp-file-name` directly.
These aliases were deprecated since CIDER 0.18. The current version is
1.21, so any external code has had ample time to update.
Replace the two-step pattern of make-local-variable followed by push
with a single setq-local call in cider-repl-setup-paredit.
- Fix typo "returrns" -> "returns" in test description
- Fix copy-paste bug: duplicate -T:test alias test, second should be -X:test
- Remove describe block incorrectly nested inside an it block
- Replace fset on global names (file-name, line-num, col-num, face) with
  properly namespaced test helper functions to avoid polluting the global
  function namespace
Use the more idiomatic (unless ...) form instead of (when (not ...))
across cider-xref.el, cider-repl.el, nrepl-client.el, and
cider-stacktrace.el.
- Simplify (not (null dir)) to just dir in boolean context
- Use string-empty-p instead of (= (length path) 0)
- Merge adjacent string literal concatenations into single strings
- Remove cider-inspector-spacious-collections (defvar never referenced;
  code that used it was removed in a prior refactoring)
- Remove cider-repl-history-separator-face (defcustom never wired up;
  the face is defined but never applied to the separator text)
- Remove cider--clojure-execution-error and
  cider--clojure-spec-execution-error (rx fragments defined but never
  composed into any regexp)
- Remove (require 'url-vars) from cider-clojuredocs.el
- Remove (require 'map) and (require 'seq) from cider-debug.el
- Remove (require 'map) and (require 'seq) from cider-format.el
- Remove (require 'map) from cider-stacktrace.el
- Remove (declare-function cider-mode ...) from cider-xref.el
- Remove (declare-function cider-nrepl-request:eval ...) from
  cider-connection.el
- Remove (declare-function cider-classpath-entries ...) from
  cider-connection.el
- Remove (declare-function cider-repl-emit-interactive-stderr ...) from
  nrepl-client.el
@bbatsov
Copy link
Member Author

bbatsov commented Feb 8, 2026

In case someone's wondering - I'm trying to determine how well does Claude Code work with Elisp these days and a bulk attempt to fix some small problems seemed like a good starting point. I have to say I'm pleasantly surprised that it actually discovered many small issues, even if it clearly is not well-versed in Elisp, compared to something like Python or Rust.

@bbatsov bbatsov merged commit 11ad637 into master Feb 8, 2026
9 of 10 checks passed
@bbatsov bbatsov deleted the code-cleanup branch February 9, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant