-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Context
Our lein-template adds ;; Please keep the dependencies sorted a-z. before the :dependencies-key in project.clj.
There's benefits for sorting this list (friction-free merges, improves readability, ..)
Task
We need a formatter to sort the dependency list
Acceptance criteria
dependency sorting:
(defproject corpus "unreleased"
:dependencies [[c]
[a]])should be formatted to
(defproject corpus "unreleased"
:dependencies [[a]
[c]]):exclusion sorting
(defproject corpus "unreleased"
:dependencies [[a
:exclusions [c b]])should be formatted to
(defproject corpus "unreleased"
:dependencies [[a
:exclusions [b
c]])note the formatted newlines
Additional resources
inspiration for replacement of the :dependencies can be found here:
| (speced/defn replace-ns-form! |
sorting might be something like:
(let [deps '[[c]
[a :exclusions [c b]]]]
(->> deps
(mapv (fn [clause]
(let [exclusion-index (.indexOf clause :exclusions)]
(if (> 0 exclusion-index)
clause
(update clause (inc exclusion-index) (comp vec sort))))))
(sort-by first)
(vec)))
=> [[a :exclusions [b c]] [c]]Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request