Fork me on GitHub
#tools-deps
<
2018-06-25
>
hagmonk17:06:41

I've pushed a new find-deps with @pesterhazy's PR merged and a fix for no longer returning SNAPSHOT versions from clojars (hard coded for the time being)

pesterhazy17:06:19

@hagmonk just tried it, works really well

pesterhazy17:06:37

I think hardcoding the hide-SNAPSHOT feature is a much better default

hagmonk17:06:41

Yes definitely, I think the bug should not crop up in maven searches, I need to spend time finding an example there to validate that

hagmonk17:06:58

I believe maven doesn't offer snapshot results by default

pesterhazy17:06:22

good job on the library btw!

hagmonk17:06:39

Thanks! Let me know if any of the search results don't look good :)

dominicm18:06:06

@hagmonk one piece of feedback is that it will modify the deps.edn formatting.

hagmonk18:06:56

@dominicm that's worth an issue on github … appreciate any pointers you might have for how to avoid that

dominicm18:06:25

Pack avoids it (my library). Happy to try share a library for solving this problem. I'm secretly hopeful it can go into tools deps itself.

hagmonk19:06:33

Thanks @dominicm, I'll have a look after work

hagmonk19:06:20

I'm still enjoying how much time this is saving me, occasionally I'm surprised it works as well as it does 😂

hagmonk19:06:33

clj -A:find-deps "clojure cache"
{:deps {org.clojure/core.cache {:mvn/version "0.7.1"}}}

pesterhazy19:06:35

one possibility would be to run the result through zprint, a great library for re-formatting clojure code or edn

pesterhazy19:06:41

zprint is an under-appreciated gem

dominicm19:06:35

@pesterhazy the problem is that everybody does formatting a little differently. I took the approach of trying to match existing indentation at most levels.

mkvlr20:06:01

it would be so great if we could agree on a canonical way to format clojure code

mkvlr20:06:47

having worked with elm-format and exfmt I found it so nice to just not have to worry about this at all anymore

pesterhazy20:06:20

zprint gets you 90% there

dominicm20:06:18

Zprint puts my defn all on one line, which feels wrong

pesterhazy20:06:36

They are too short :)

dominicm20:06:42

Do you happen to know of a way to change that behaviour? 80 chars isn't a goal, so much as a limit.

pesterhazy20:06:01

Not off the top of my head

pesterhazy20:06:04

But if you get consistency, convenience and the end of style wars in return, wouldn’t oneliners be a small price to pay?

dominicm20:06:24

I want consistency, very much. But I first have to convince important people that they will like the formatting, and that it's worth pioneering.

kommen07:06:36

the :respect-nl config should be able to help you with “80 chars isn’t a goal”: https://github.com/kkinnear/zprint/#respect-nl-false

kommen07:06:06

it says it is meant for vectors, but might work for lists as well

dominicm07:06:19

I don't necessarily want to have it retain where I place newlines. I just find it weird to see:

(defn foo [args] body)
over
(defn foo
  [args]
  body)

kommen07:06:03

ah, I see. haven’t tried to configure that, but pretty sure it is possible

dominicm08:06:09

It would be nice to have a style which is "do what most libraries do for formatting"

kommen08:06:37

I think the :community style is meant for that. kkinnear has been open to adapt that style to fit best practices, especially if those things would be documented in the clojure community style guide

pesterhazy08:06:50

NOT respecting newlines is one of the best things about elm-format

pesterhazy08:06:15

you can totally write your code in a single line and elm-format will expand it out

pesterhazy08:06:23

it helped me a lot when I was learning the language

dominicm08:06:19

I particularly don't want my tool to look at the input beyond raw clojure forms tbh. I'd even be happy if it made decisions about #:foo {:blah 10} into {:foo/blah 10} (but that's because I don't like the syntax)

pesterhazy20:06:46

Agree about elm-format, it’s a pleasure to use

mkvlr20:06:47

we’re using zprint but there’s so many knobs. I think an autoformatter should ideally have 0 options. (or maybe one for the line width)

mkvlr20:06:06

sorry for going a bit offtopic here…

lwhorton21:06:24

i’m not sure if this is the right place to ask… but does the :git/url coordinate require a deps.edn file at that coordinate?

lwhorton21:06:55

i.e. it doesn’t try to read a project.clj or boot file… it only plays nicely with another deps.edn (or maybe a pom) file?

ghadi21:06:59

It does read deps.edn and pom.xml transitively

👍 4
Alex Miller (Clojure team)22:06:56

it’s also tolerant of finding none of those for the case of a dep with no transitive deps

cfleming22:06:05

> I think an autoformatter should ideally have 0 options. (or maybe one for the line width) Preach it! If I ever design a language, it will have a gofmt-style formatter from day 1.

👍 16
cfleming22:06:08

Indentation turns out to be one of those things that everyone thinks they care about, until they can’t control it, at which point it turns out they don’t care much as long as the results are reasonable.

❤️ 24