greglook / cljstyle

A tool for formatting Clojure code
Eclipse Public License 1.0
293 stars 39 forks source link

Add deps.edn for usage as a library #33

Closed jeroenvandijk closed 4 years ago

jeroenvandijk commented 4 years ago

Adding a deps.edn file allows me to use this code as a library to print formatted code:

(require 'cljstyle.format.core)
(defn reformat-code [code]
  (str (cljstyle.format.core/reformat-string (pr-str code))))

Thank you!

codecov-io commented 4 years ago

Codecov Report

Merging #33 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #33   +/-   ##
=======================================
  Coverage   92.65%   92.65%           
=======================================
  Files          13       13           
  Lines        1511     1511           
  Branches       44       44           
=======================================
  Hits         1400     1400           
  Misses         67       67           
  Partials       44       44

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 584acaf...8879744. Read the comment docs.

jeroenvandijk commented 4 years ago

Hi Greg,

Yeah I'm using it locally via tools.deps. Unfortunately tools.deps doesn't work for git libs when the deps.edn is a nested dir. But if you use git submodules for instance and a local path it works:

mkdir vendor
git submodule add git@github.com:jeroenvandijk/cljstyle.git vendor/cljsstyle
git submodule update

Then I have the following deps.edn:

{:paths ["src"]
 :deps {
   cljstyle { :local/root "vendor/cljstyle/core" }
 }
}

(I actually think it would be nice if submodule stuff was supported out of the tools.deps box)

greglook commented 4 years ago

I'll merge this as-is, but I have been considering merging the core and tool projects anyway, which would simplify this a lot.

greglook commented 4 years ago

Merged into one top-level project in cb1e9b7.