Skip to content

Conversation

@hugoduncan
Copy link
Owner

@hugoduncan hugoduncan commented Oct 13, 2025

Summary

Improve clj-kondo static analysis and apply comprehensive linting fixes across the codebase, plus add missing tests for transport factory functions.

Changes

New Tests

  • Add comprehensive test suite for client-transport factory with dedicated tests for unregister-transport! and transport-registered?
  • Add comprehensive test suite for server-transport factory with same coverage
  • Both test suites include validation of registration, built-in transports, factory creation, and integration workflows
  • Update tests.edn to include server-transport paths

Code Quality Improvements

  • Remove unused atomic operations (compare-and-set, decrement, add-and-get)
  • Remove unused queue functions, protocol methods, and test helpers
  • Remove unused imports (clojure.java.io)
  • Prefix unused bindings with underscore
  • Remove redundant empty string checks
  • Clean up formatting and indentation issues
  • Add clojure-lsp ignore annotations for intentionally unused public functions

Impact

  • Test Coverage: 16 new tests, 101 new assertions across both factory test suites
  • Code Reduction: Net reduction of ~230 lines of dead code
  • Quality: Eliminates all clj-kondo warnings in modified files
  • Maintainability: Cleaner codebase with better test coverage

Test Results

All tests pass with 0 failures:

  • client-transport factory: 8 tests, 50 assertions ✅
  • server-transport factory: 8 tests, 51 assertions ✅

Files Changed

  • 40 files changed across components
  • Added: server-transport test suite (248 lines)
  • Modified: Remove unused code, fix linting issues, update test config

Fixes clj-kondo warnings to improve code quality and reduce noise
in linting output. Changes include:
- client-transport/http: Remove unused config binding
- http-client: Remove unused imports and build-headers function
- in-memory-transport: Remove unused bindings in server and tests,
  remove unused imports from test files

All affected component tests continue to pass.
Add dedicated test functions for registry management functions:

- unregister-transport-test: validates transport removal, idempotency,
  and isolation from other transports
- transport-registered-test: validates registration checks for registered,
  unregistered, built-in, and non-keyword types

Also includes formatting fixes and clojure-lsp ignore annotations.
Remove unused helper functions and simplify code based on clj-kondo analysis:

- Remove unused atomic operations (compare-and-set, decrement, add-and-get)
- Remove unused queue dequeue function
- Remove unused protocol methods and test helpers
- Clean up unnecessary imports and bindings
- Fix formatting and indentation issues

These changes reduce code surface area and eliminate dead code identified
by clj-kondo static analysis.
Create comprehensive test suite for server-transport factory with dedicated
tests for unregister-transport! and transport-registered?:

- unregister-transport-test: validates transport removal, idempotency,
  and isolation from other transports
- transport-registered-test: validates registration checks for registered,
  unregistered, built-in, and non-keyword types
- Additional tests for registration, built-in transports, factory creation,
  and integration workflows

Also updates tests.edn to include server-transport paths and adds
clojure-lsp ignore annotations to factory.clj.
Apply additional clj-kondo linting fixes:

- Remove unused imports (clojure.java.io)
- Prefix unused bindings with underscore
- Remove redundant empty string checks
- Clean up formatting and whitespace
- Remove unused helper functions in tests

These changes improve code quality by eliminating dead code and
following Clojure best practices.
@hugoduncan hugoduncan changed the title refactor: enable clj-kondo linting and add transport factory tests refactor: improve clj-kondo linting and add transport factory tests Oct 13, 2025
@hugoduncan hugoduncan merged commit cb402e0 into master Oct 13, 2025
2 checks passed
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.

2 participants