Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps.edn / clj support #221

Closed
eigenhombre opened this issue Dec 3, 2018 · 6 comments · Fixed by #251
Closed

deps.edn / clj support #221

eigenhombre opened this issue Dec 3, 2018 · 6 comments · Fixed by #251

Comments

@eigenhombre
Copy link

eigenhombre commented Dec 3, 2018

c.f. #197; as a proof-of-concept, I was able to adapt Sean Corfield's snippet for boot to deps.edn fairly easily, but it probably merits a mod to the Kibit documentation as well.

A working example, with relevant parts:
https://github.com/eigenhombre/trav/blob/master/deps.edn#L7
https://github.com/eigenhombre/trav/blob/master/lint/kibit.clj#L5

@eigenhombre eigenhombre changed the title deps.edn / clj support deps.edn / clj support Dec 3, 2018
@aviflax
Copy link

aviflax commented Dec 13, 2018

FWIW, I got it working from bash with this one-liner:

clojure -Sdeps "{:deps {jonase/kibit {:mvn/version \"0.1.6\"}}}" -e "(require '[kibit.driver :as k]) (k/external-run [\"src\"] nil)"

I’ve not yet managed to get it to work from within a profile in a deps.edn file, but I suspect it should be doable.

@aviflax
Copy link

aviflax commented Dec 13, 2018

Aha, I was able to get it to work via this profile in my deps.edn:

:kibit
{:extra-deps {jonase/kibit {:mvn/version "0.1.6"}}
 :main-opts ["-e"
             "(require,'[kibit.driver,:as,k]),(k/external-run,[\"src\"],nil)"]}

Granted this is nearly functionally identical to the example linked above; the only functional difference is that it doesn’t require downloading and caching the lein-kibit dependency. That’s a minor plus, but there’s also the minor minus that this is nearly unreadable.

Still, given that projects using tools.deps can fairly easily use Kibit with this technique without any changes to Kibit itself, it seems like it might be worth adding this to the readme? I’d be happy to contribute such a PR if there’s interest.

Thanks to @matthias-margush for pointing out the using-commas-instead-of-spaces trick to work around shell escaping issues in the CLI tools scripts.

@aviflax
Copy link

aviflax commented Dec 14, 2018

Ah, another downside of the lein-kibit-free example above: it won’t pick up on command-line args like --replace — they’d have to be added explicitly to the code passed to -e which is pretty rigid. So at this point I’m leaning more towards recommending using lein-kibit as in your example, @eigenhombre.

@carrete
Copy link
Contributor

carrete commented May 18, 2019

I created https://gitlab.com/tvaughan/kibit-runner as a short-term solution to this problem. (I think it would be better to incorporate this into kibit itself.) From its README:

Add:

:kibit {:extra-deps {tvaughan/kibit-runner {:mvn/version "0.1.0"}}
        :main-opts ["-m" "kibit-runner.cmdline"]}

to :aliases in deps.edn.

Run:

clojure -A:kibit

This will run kibit over the current
working directory and all of its sub-directories.

To specify one or more different directories, run:

clojure -A:kibit --paths src,test,resources,some/other/path

To pass options to kibit, add -- to the end of the command-line and then add
options to kibit. Like:

clojure -A:kibit -- --reporter markdown

Or:

clojure -A:kibit --paths src,test -- --replace --interactive

@aviflax Please note the ability to pass options to kibit ˆˆˆ. Also, Hi! 👋

@carrete
Copy link
Contributor

carrete commented May 19, 2024

With the recent release of v0.1.10 which includes #252, kibit-runner is now obsolete and has been archived. No more updates will be made to it.

Please note, kibit itself has now been placed in maintenance mode.

@NoahTheDuke
Copy link
Collaborator

Thank you for your work writing and supporting kibit-runner!

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 a pull request may close this issue.

4 participants