leiningen

N.B. The maintainers are on #leiningen on Libera chat IRC. Go there for direct support/bug reports.
kingmob 2020-01-29T16:09:43.033500Z

What is the purpose of lein check? Does it catch anything that would be missed by compile or uberjar?

2020-01-29T16:39:42.034Z

@kingmob compile only compiles explicit :aot classes

2020-01-29T16:40:10.034600Z

so if you have a project that doesn’t use :aot (typical), then you haven’t necessarily ensured all your source files can compile

2020-01-29T16:40:38.035100Z

also, lein check will always enable *warn-on-reflection* it seems

2020-01-29T16:41:03.035700Z

and lastly, lein check will try to gather up all failures in one pass I believe. so it won’t necessarily stop after one and wait for a fix there, then have to rerun it for next one, etc

2020-01-29T16:43:17.036800Z

since you mentioned uberjar above, it maybe the case you are using lein uberjar with something like :aot :all - which in that case the compile prep-tasks that is ran (by default) would catch most of the things lein check would - but it’s only due to you having more things happening in that profile setup in this case.

2020-01-29T16:43:49.037500Z

and it’s still a potentially slower way, and more step-by-step failing way, to get similar info you’d get by lein check

kingmob 2020-01-29T16:56:21.038500Z

Thanks @mikerod. We’re calling lein check as part of our CICD process, and I’m wondering if lein check is redundant with all the later steps (compile, uberjar, etc)

2020-01-29T17:03:53.039400Z

if you are using uberjar + :aot :all or some sort of :aot that includes all your relevant source files you want to ensure can compile, eg :aot [my.top.level.ns], then it is somewhat redundant for those cases

🙏 1
2020-01-29T17:04:09.039800Z

with the exception that you won’t get *warn-on-reflection* for “free” if that matters to you

2020-01-29T17:04:45.040400Z

you can set :global-vars {*warn-on-reflection* true} in the project.clj as well though to get similar even without necessarily using lein check (I think it’ll be used during compile as well this way)

2020-01-29T18:57:46.041500Z

I like having check as a separate step, because there's information in that failure (your code isn't loadable as it sits in the repo), while uberjar has other kinds of potential failure

2020-01-29T18:58:05.041900Z

I have a custom version of check which also looks at test files

2020-01-29T18:59:02.042800Z

@kingmob for a use case example: I'm doing a big whole-project refactor and as I iterate I want to ensure I don't break the codebase, so I do one part of the change at a time, and ensure lein check passes

2020-01-29T18:59:24.043300Z

I don't need to make uberjars or compile classes - that's unrelated to my task

2020-01-29T19:04:58.043700Z

@noisesmith you can get lein check to check more ns’s by adding them to :source-paths - like in a profile

2020-01-29T19:05:07.044Z

but yeah, I do like the seprate step in many situations too