formatting-stack
formatting-stack copied to clipboard
Merge `refer` and `as` on equal namespaces
Brief
Seperate requires with refer and as are not merged into each other. This was found in https://github.com/nedap/pep-link/pull/619/files#diff-2f1e1e5fb241876ee8df4f29f8f896f3R35-R36
Expected behavior
[medley.core :refer [deep-merge]]
[medley.core :as medley]
is formatted into
[medley.core :refer [deep-merge] :as medley]
Actual behavior
It is left untouched as:
[medley.core :refer [deep-merge]]
[medley.core :as medley]
Reproduction steps
- Put the first expected snippet in a file
- Run formatting-stack on it
Suspected cause
A missed case of all variations of requires.
Good one, yes I was aware of this. clean-ns (from refactor-nrepl) generally consolidates these, but f-s occasionally disables clean-ns for certain ns'es.
Compensating for that, there's https://github.com/nedap/formatting-stack/blob/2e5db0d71f9f0abceca88530cf650d0827a48b75/src/formatting_stack/formatters/trivial_ns_duplicates.clj but it lacks 'consolidation' logic. Could be done.