Fork me on GitHub
#clj-kondo
<
2023-01-24
>
escherize01:01:50

I reinstalled emacs, and something is off. The static linting I get seems to be ignoring my project’s .clj-kondo/config.edn file. I have been tracking down a way to pass it into clojure-lsp but I don’t think there’s a way to do that. Maybe it’s flycheck-clj-kondo? What can I use to track this down? I’ve read a bunch of docs, but no leads.

ericdallo01:01:07

first double check if you are using flyckeck-clj-kondo or flycheck-lsp

ericdallo01:01:29

Clojure-lsp uses kondo under the hood which will check your local kondo config file as well

🆗 2
ericdallo01:01:53

That sounds more like a wrong project-root so you can lsp-clojure-server-info and confirm project root is correct

2
escherize02:01:23

Good! the project root is incorrect.

escherize02:01:06

:project-root-uri "file:///Users/me/dv",

escherize02:01:43

I have a .clj-kondo .lsp dirs in that path ^. Gonna delete them

escherize02:01:36

Hmm, still getting :project-root-uri "file:///Users/me/dv". When I select the project with projectile, then select a clojure file, I see that those dirs are recreated in dv.

LSP :: Connected to [clojure-lsp:82189/starting].
LSP :: clojure-lsp:82189 initialized successfully in folders: (/Users/bcm/dv)

escherize02:01:23

as for flycheck-clj-kondo or flycheck-lsp. How do I check? I can say that lsp-ui-flycheck-list shows me the errors (that should be correct).

escherize02:01:06

I’m using flycheck-lsp.

escherize02:01:14

I removed all .clj-kondo dirs from , /a, /a/b, /a/b/c. (project is in ~/a/b/c/project). no luck.

escherize03:01:51

tried symlinking in my .lsp/.clj-kondo dirs, and editing lsp-clojure-server-command. but not luck.

escherize03:01:06

Here’s the log:

2023-01-24T03:07:19.640Z  INFO [clojure-lsp.server:601] - [SERVER] Starting server...
2023-01-24T03:07:19.641Z  DEBUG [clojure-lsp.nrepl:21] - nrepl not found, skipping nrepl server start...
2023-01-24T03:07:19.642Z  INFO [clojure-lsp.server:486] - Initializing...
2023-01-24T03:07:19.643Z  INFO [clojure-lsp.startup:122] - Folder /Users/bcm/dv/.clj-kondo not found, creating for necessary clj-kondo analysis...
2023-01-24T03:07:19.643Z  ERROR [clojure-lsp.db:73] - [DB] No cache DB file found
2023-01-24T03:07:19.643Z  INFO [clojure-lsp.db:66] - [DB] Reading transit analysis cache from /Users/bcm/dv/.lsp/.cache/db.transit.json db took 0ms
2023-01-24T03:07:19.649Z  INFO [clojure-lsp.classpath:103] - Finding classpath via `/opt/homebrew/bin/clojure -A:test:dev -Spath`
2023-01-24T03:07:23.974Z  DEBUG [clojure-lsp.classpath:115] - Classpath found, paths:  ["test" "src" "/Users/bcm/.m2/repository/com/github/askonomm/clarktown/2.0.0/clarktown-2.0.0.jar" "/Users/bcm/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar" "/Users/bcm/.m2/repository/org/clojure/core.specs.alpha/0.2.62/core.specs.alpha-0.2.62.jar" "/Users/bcm/.m2/repository/org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar"]
2023-01-24T03:07:23.975Z  INFO [clojure-lsp.source-paths:85] - [Startup] Using source-paths from classpath: ["/Users/bcm/dv/src" "/Users/bcm/dv/test"]
2023-01-24T03:07:23.975Z  INFO [clojure-lsp.startup:114] - Copying kondo configs from classpath to project if any...
2023-01-24T03:07:23.989Z  WARN [clojure-lsp.kondo:305] - Non-fatal error from clj-kondo: No configs copied.

2023-01-24T03:07:23.989Z  INFO [clojure-lsp.startup:116] - Copied kondo configs, took 14ms secs.
2023-01-24T03:07:23.989Z  INFO [clojure-lsp.startup:86] - Analyzing classpath for project root #object[sun.nio.fs.UnixPath 0x5ef1b182 "/Users/bcm/dv"]
2023-01-24T03:07:23.990Z  INFO [clojure-lsp.kondo:332] - Analyzing 4 paths with clj-kondo
2023-01-24T03:07:24.482Z  WARN [clojure-lsp.kondo:305] - Non-fatal error from clj-kondo: No configs copied.

escherize03:01:32

for some reason it keeps picking ~/dv. not sure why 🙂

escherize03:01:39

copying /dv/b/c/project/.clj-kondo into /dv/.clj-kondo gets it working. verysweat_g

pithyless06:01:41

try touch ~/dv/b/c/project/.projectile and deleting all the lsp and kondo caches higher up the tree

pithyless06:01:27

I’ve had issues with projectile and lsp in monorepos where it would focus on the .git root instead of the inner project. I’ve found the empty .projectile as a duct tape solution to telling it where the root is. Note: you need to make sure all other caches will be gone else you may not see the expected result in testing

ericdallo10:01:12

LSP project root is different than projectile one. try lsp-workspace-folders-remove to remove the wrong one, then lsp and choose the correct root when lsp-mode prompts

escherize16:01:29

I’ll try this now

escherize16:01:10

lsp-workspace-folders-remove fixed it! Thanks @UKFSJSM38 and thanks for helping, @U05476190.

👍 2
🙏 2
emccue03:01:13

I think this linter is triggering incorrectly :aliased-namespace-var-usage.

emccue03:01:12

getting it for this usage, which seems wrong

(ns enterprise.routes.status
  (:require [health-check]
            [enterprise.system :as-alias system]
            [next.jdbc :as jdbc]))

(set! *warn-on-reflection* true)

(defn health-checker
  [{::system/keys [db]}]
  (health-check/health-checker
   {:db (fn []
          (jdbc/execute! db ["SELECT 1;"])
          {:healthy true})}))

(defn routes
  [system]
  [""
   (health-check/reitit-route (health-checker system))])

emccue03:01:29

using `

clj-kondo/clj-kondo {:mvn/version "2023.01.12"}

borkdude08:01:47

Probably fixed in newer version