Add `clojure/clojure` analysis
sheluchin opened this issue · 5 comments
The current analysis data doesn't include https://github.com/clojure/clojure. We had a quick discussion about it on Slack, and you mentioned that it might be a good idea to add it. However, there were no specific commitments made regarding the timing. Just opening this issue as a reminder. Thanks, @phronmophobic!
I was looking into this a bit and adding clojure/clojure will also require an update to the analyzer. Currently, the analyzer looks for a project basis like deps.edn
or project.clj
, but clojure/clojure doesn't have a basis.
It probably makes sense to update the analyzer in a generic way since there are also other projects that don't have a project file. I'll have to think about it more, but maybe it's sufficient to just find all clojure files in a project to supply to clj-kondo.
Maybe the analyzer could be separate from the discovery component that searches for Clojure repos. You could add a config somewhere to manually include certain repos for analysis if they are outside of the purview of the discovery algo; a blacklist and a whitelist, since I know there are some repos that are infeasible to analyze.
Maybe the analyzer could be separate from the discovery component that searches for Clojure repos.
The discovery of repos is separate from the analysis. The problem is that clj-kondo requires a list of paths to lint. Usually, the list of paths is generated by looking at the project files in a repo, but clojure/clojure doesn't have any deps.edn or project.clj file.
My naive implementation just used the repo path on disk as the :lint
:
(clj-kondo/run! {:lint [repo-path] :config {:analysis (or analysis true)}})
It's not without faults, but results were generally good enough. It's also why I didn't have the notion of a :basis
.
Yea, I'm not really sure how much the results would change if instead of trying to calculate source paths based off project files, if we just used your method and just pass the root directory of the project.
Maybe that's just a better way to do it and we can just produce one analysis per repo.
One difference might be that deps.edn
allows you to specify a :deps/root for any coordinate. One of the goals of dewey is to provide a programmatically searchable list of dependencies. If we ever did want to have a feature that let's you search for a function and automatically add it to your dependencies, then the :basis
might be helpful.
That's not necessarily a compelling reason to decide on way or the other. I'm mostly just trying to write down any relevant info.