Skip to content

PoC ARIT #2075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

PoC ARIT #2075

wants to merge 2 commits into from

Conversation

acamargo
Copy link
Contributor

@acamargo acamargo commented Jun 13, 2025

In order to test the integration, create the following files in your project.
Note: Do not forget to replace <project absolute path> and <absolute path to arit> with the actual paths.
Note2: This is PoC and it is not production ready.

.lsp/config.edn

{,,,
 :linters {:custom {arit/lint {:level :warning}}}
 ,,,}

resources/clojure-lsp.exports/linters/arit.clj

(ns arit
  (:require [clojure-lsp.custom-linters-api :as api]
            [clojure.java.shell :as sh]
            [cheshire.core :as json]
            [clojure.string :as str]
            ))

(defn lint
  [{:keys [db uris params reg-diagnostic!]}]
  (let [paths (reduce (fn [acc uri]
                        (assoc acc
                          (str/replace uri #"<project absolute path>" "")
                          uri))
                      {}
                      uris)
        relative-paths (keys paths)
        {:keys [out exit] :as result} (apply sh/sh
                                             (concat ["<absolute path to arit>"]
                                                     relative-paths
                                                     ["-f" "json"]))
        smells (if (zero? exit)
                 (json/parse-string out)
                 (println (pr-str result)))]
    (doseq [smell smells]
      (reg-diagnostic! {:uri (get paths (get smell "filepath"))
                        :range {:row (get-in smell ["location" "start_line"])
                                :col (get-in smell ["location" "start_col"])
                                :end-row (get-in smell ["location" "end_line"])
                                :end-col (get-in smell ["location" "end_col"])}
                        :message (get smell "message")
                        :level (:level params)
                        :code (get smell "rule_id")
                        :source "arit"}))))
  • I created an issue to discuss the problem I am trying to solve or an open issue already exists.
  • I added a new entry to CHANGELOG.md
  • I updated documentation if applicable (docs folder)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant