clj-kondo

https://github.com/clj-kondo/clj-kondo
slimslenderslacks 2020-07-12T20:51:45.176800Z

@epransky I've been working on a way to share hooks across projects. Coincidentally, mount comes up a lot (popular library!). If your .clj-kondo directory ends up being public, I'd love to try adding those hooks to other projects.

slimslenderslacks 2020-07-13T17:10:44.186100Z

Great, thanks! I'll add this hook to my tests. Appreciate it!

ep 2020-07-14T05:34:21.186300Z

can you link me to the project? ill contribute there

slimslenderslacks 2020-07-15T20:19:19.186800Z

hey @epransky, sorry for taking so long to respond. The project repo is here: https://github.com/atomist-skills/clj-kondo-skill but it probably requires a bit of explanation.

slimslenderslacks 2020-07-15T20:23:59.187100Z

The idea is to allow users to attach clj-kondo to their GitHub pushes. It produces annotated GitHub checks and ideally, makes it easy to share configuration (including hooks) across Clojure projects. On most projects, especially new ones, we want clj-kondo checks to be there by default.

slimslenderslacks 2020-07-15T20:26:43.187300Z

However, it's actually been quite a challenge to roll this out to existing clojure projects without spending some time doing some analysis of the violations, and preparing teams. One of the big challenges is that you need hooks (like your mount example) to be ready to add to all of the projects that use mount!

slimslenderslacks 2020-07-15T20:29:34.187500Z

We experimented with a few things: • only neutral checks - don't break the build until you've had a chance to work on the violations. However, the number of annotated violations can impact the usability of PRs! • don't publish annotated violations until you've at least cleared the violations in the project once, and then turn them on to help keep them at zero? And the hypotheses is that one thing we can do to be prepared to help people take advantage of this is to be ready with a good starting configuration, including hooks.

slimslenderslacks 2020-07-15T20:30:40.187700Z

So when I configured this across our team's repos, I included a reference to your gist, so that it merged your config and hooks into all of the clj-kondo run across all of our Repos.

slimslenderslacks 2020-07-15T20:33:38.187900Z

You're welcome to use this on your repos if you want to try it out. It requires that you enable our GitHub app, but it's free to use.

ep 2020-07-16T05:32:10.188100Z

ok, ill have a look. thanks for the explanation!

slimslenderslacks 2020-07-16T15:03:34.188300Z

Cool, and if you want to enable it on a Repo, you'll actually need to do 3 things: • signup with GitHub https://go.atomist.com/user/signup • enable our GitHub app (on at least a few Repos in one of your Orgs) https://go.atomist.com/r/auth/manage/integrations/add/GitHubAppResourceProvider • and then enable this clj-kondo function to run: https://go.atomist.com/catalog/skills/atomist/clj-kondo-skill The config where you can add your gist url is called "Custom configuration URL" (probably not a great name)

zilti 2020-07-12T22:08:08.177600Z

Is there some kind of option for cljc files that it only shows imports as unused if they actually are unused, and not just unused by the clj part?

borkdude 2020-07-12T22:08:37.178400Z

clj-kondo lints a .cljc file twice: once for clj and once for cljs

zilti 2020-07-12T22:10:24.179900Z

Hmm so I figure that'd be something for the flycheck plugin to "fix" then? It's just... I really enjoy having clj-kondo, but having your file littered with "unused import" and "unused argument" warnings is a tad annoying. How do people usually deal with that scenario?

borkdude 2020-07-12T22:10:35.180200Z

to answer your question: that option does not exist and the reason for it is the way .cljc files are processed (similar to how they are processed in Clojure itself)

zilti 2020-07-12T22:10:59.180700Z

Yea, it makes sense to have it linted twice, once for each "mode"

borkdude 2020-07-12T22:12:20.181600Z

you can turn off that linter for that namespace locally, using metadata config. it's implemented, but not yet released, see: https://github.com/borkdude/clj-kondo/issues/932

borkdude 2020-07-12T22:13:00.182800Z

I actually like the way clj-kondo handles .cljc and I tend to fix all warnings by marking unused bindings for one branch with _foo and the other one with foo.

zilti 2020-07-12T22:14:07.184100Z

How do you handle function args when the function body is split? Having #? inside the arg vector seems very messy

borkdude 2020-07-12T22:15:22.185100Z

if you find that too messy, you can duplicate the entire arg vector once for clj and another time for cljs, but I tend to choose the inline version.

borkdude 2020-07-12T22:15:45.185300Z

I'm afk now, sleep

zilti 2020-07-12T22:16:09.185500Z

Okay. Thanks!