Fork me on GitHub
#clj-kondo
<
2020-04-18
>
codonnell12:04:16

I'm seeing some odd behavior with a :lint-as rule. In my config, I have {:lint-as {com.fulcrologic.fulcro.components/defsc clojure.core/defn}}. Oddly enough, I get an unused namespace warning for df with the form

(defn Home [_this _]
  {:lifecycle-method (df/load! "foo")}
  (dom/div {} "Home"))
but not with
(defsc Home [_this _]
  {:lifecycle-method (df/load! "foo")}
  (dom/div {} "Home"))
Interestingly, I uncovered this because I was getting an unused namespace warning for df with
(defsc Home [_this _]
  {:query []
   :ident nil
   :initial-state nil
   :route-segment []
   :will-enter (fn [app _]
                 (df/load! app [:component/id :created-gift-lists]
                   ui.gift-list/CreatedGiftLists))}
  (dom/div {} "Home"))
However, this warning goes away if I delete any of the keys from the component options map (other than :will-enter of course).

borkdude12:04:44

@codonnell Maybe it's because clj-kondo tries to parse the first map in defn as a pre-post map

codonnell12:04:12

Ah, that's a good thought.

borkdude12:04:50

but it's a bug nonetheless probably

codonnell12:04:08

Happy to make a github issue if that would be helpful

codonnell13:04:13

Sure thing, thanks for all the work you've put into clj-kondo! 🙂

dgonsalves2216:04:54

having trouble getting kondo to work I installed with homebrew and ~/.lein/profiles.clj looks like

{:user
 {:dependencies [[clj-kondo "RELEASE"]]
  :aliases {"clj-kondo" ["run" "-m" "clj-kondo.main"]}}}
lein clj-kondo --lint src works and returns errors in command line, but there is no linting going on in my editor.

borkdude16:04:34

@dgonsalves22 I don't recommend running clj-kondo with leiningen for editor integration. Installing the binary is a much faster and better experience

dgonsalves2216:04:50

ok. I installed with brew and it is in bin/. is that not what i should be doing?

borkdude16:04:17

@dgonsalves22 If you installed it with brew, and it's on your path, then you're set. But it depends on your editor if you enable the right plugin, etc. What editor are you using?

borkdude16:04:40

@dgonsalves22 Also the people in #spacemacs are really helpful about clj-kondo

dgonsalves2216:04:18

thanks @borkdude

lvh17:04:39

Hi! I'm trying to disable a particular checker for some source files (my tests touch private vars and that's intentional/OK), and I figured a separate config file would work. It seems to work locally on my machine, but DeLaGuardo/[email protected] appears to be ignoring the command line option: https://github.com/latacora/wernicke/runs/598161720?check_suite_focus=true

borkdude18:04:36

Maybe ask @ if he can support additional command line args. Or roll your own thing. See https://github.com/borkdude/clj-kondo/blob/master/doc/ci-integration.md#linter-output-integration

delaguardo19:04:13

Hi) cli args should work as expected. I'll check this tomorrow

delaguardo13:04:20

@lvh please check DeLaGuardo/[email protected] I changed how the options passed to runner internally. Now it should respect your configuration

lvh17:04:52

this didn't fix the issue for me

lvh17:04:53

I considered trying a YAML vector of args instead of a single string but if that was the issue, --lint src working wouldn't make sense either

lvh17:04:00

(base) [email protected] ~/s/L/wernicke $ clj-kondo --lint test
test/latacora/wernicke/cli_test.clj:24:18: error: #'latacora.wernicke.cli/exit! is private
linting took 29ms, errors: 1, warnings: 0
(base) [email protected] ~/s/L/wernicke $ clj-kondo --config .clj-kondo/test-config.edn --lint test
linting took 33ms, errors: 0, warnings: 0

lvh17:04:03

(that's locally, works fine)

dgonsalves2218:04:50

@borkdude just to follow up. My previous issues were definitely spacemacs related and not kondo related. Thought you would like to know.

borkdude18:04:02

@lvh To disable this linter in specific namespaces you can use one of these two ways:

(ns foo)

(defn- foo [])
(foo)

(ns bar
  {:clj-kondo/config {:linters {:private-call {:level :off}}}} ;; 1
  (:require [foo]))

(foo/foo)   ;; 1
(#'foo/foo) ;; 2

borkdude14:04:17

@lvh Did this work for you?

lvh17:04:30

hey! yeah I managed to work around the bug in the github action w/ this, thank you!