All Projects → borkdude → deps-infer

borkdude / deps-infer

Licence: EPL-1.0 license
Infer mvn deps from sources

Programming Languages

clojure
4091 projects

Projects that are alternatives of or similar to deps-infer

Dependency Cruiser
Validate and visualize dependencies. Your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.
Stars: ✭ 2,326 (+6361.11%)
Mutual labels:  static-analysis, dependencies
deblibs-gradle-plugin
A Gradle plugin that creates Github issue and Slack message for outdated dependencies so they can easily be tracked and manually upgraded.
Stars: ✭ 73 (+102.78%)
Mutual labels:  dependencies
vim-phpstan
A Vim plugin for PHPStan - https://github.com/phpstan/phpstan. It calls `phpstan` to do static analysis of your PHP code and displays the errors in Vim's quickfix list.
Stars: ✭ 26 (-27.78%)
Mutual labels:  static-analysis
awesome-malware-analysis
Defund the Police.
Stars: ✭ 9,181 (+25402.78%)
Mutual labels:  static-analysis
logifix
Fixing static analysis violations in Java source code using Datalog
Stars: ✭ 17 (-52.78%)
Mutual labels:  static-analysis
gini
A fast SAT solver
Stars: ✭ 139 (+286.11%)
Mutual labels:  dependencies
gqlanalysis
gqlanalysis makes easy to develop static analysis tools for GraphQL in Go.
Stars: ✭ 36 (+0%)
Mutual labels:  static-analysis
phpstan-webmozart-assert
PHPStan extension for webmozart/assert
Stars: ✭ 132 (+266.67%)
Mutual labels:  static-analysis
sonar-scala
A free and open-source SonarQube plugin for static code analysis of Scala projects.
Stars: ✭ 113 (+213.89%)
Mutual labels:  static-analysis
phpstan-nette
Nette Framework class reflection extension for PHPStan & framework-specific rules
Stars: ✭ 87 (+141.67%)
Mutual labels:  static-analysis
klara
Automatic test case generation for python and static analysis library
Stars: ✭ 250 (+594.44%)
Mutual labels:  static-analysis
onix
A reactive configuration manager designed to support Infrastructure as a Code provisioning, and bi-directional configuration management providing a single source of truth across multi-cloud environments.
Stars: ✭ 89 (+147.22%)
Mutual labels:  dependencies
metahelm
Install dependency graphs of Kubernetes Helm Charts
Stars: ✭ 70 (+94.44%)
Mutual labels:  dependencies
save-cloud
Cluster-based cloud mechanism for running SAVE framework
Stars: ✭ 30 (-16.67%)
Mutual labels:  static-analysis
OCCAM
OCCAM: Object Culling and Concretization for Assurance Maximization
Stars: ✭ 20 (-44.44%)
Mutual labels:  static-analysis
nestif
Detect deeply nested if statements in Go source code
Stars: ✭ 30 (-16.67%)
Mutual labels:  static-analysis
phpstan
PHP Static Analysis in Github Actions.
Stars: ✭ 41 (+13.89%)
Mutual labels:  static-analysis
mllint
`mllint` is a command-line utility to evaluate the technical quality of Python Machine Learning (ML) projects by means of static analysis of the project's repository.
Stars: ✭ 67 (+86.11%)
Mutual labels:  static-analysis
rstatic
An R package for static analysis of R code.
Stars: ✭ 32 (-11.11%)
Mutual labels:  static-analysis
sonarlint4netbeans
SonarLint integration for Apache Netbeans
Stars: ✭ 23 (-36.11%)
Mutual labels:  static-analysis

deps-infer

Infer mvn deps from sources.

Status

Proof of concept, subject to change. Improvements welcome!

Use cases

This tool can be used to:

  • Make implicit deps explicit
  • Check which deps you are not using by comparing the output with your existing deps.edn
  • Port a lein project.clj or boot build.boot to deps.edn
  • Port scripts (e.g. babashka scripts) to a deps.edn project.
  • Migrate from git deps to mvn deps
  • Check if there is a newer version available

Run

$ clojure -M -m deps-infer.main

This will index your .m2/repository and will analyze your sources under src and test.

By default it will write the analysis output on a .deps-infer/ inside the --repo directory. You can change the location using the --cache-dir option.

After that it will suggest a list of dependencies that you can add to your deps.edn. It will always pick the newest version that is available in your .m2 repo.

For this project it will print:

babashka/fs {:mvn/version "0.0.1"}
clj-kondo/clj-kondo {:mvn/version "2021.02.13"}
org.clojure/clojure {:mvn/version "1.10.3-rc1"}
org.clojure/tools.cli {:mvn/version "1.0.194"}
version-clj/version-clj {:mvn/version "2.0.1"}

Namespaces that cannot be resolved will cause a warning to be printed:

$ cat corpus/non_existing.clj
(ns non-existing
  (:require [foo.bar :as x]))
$ clojure -M -m deps-infer.main --analyze corpus/non_existing.clj
WARNING: no dep found for foo.bar

CLI options

  • --repo: The location of the mvn repo.
  • --analyze: The file, directory or directories of sources to analyze. You can combine multiple files and directories using the OS-specific path separator: src:test.
  • --snapshots: Suggest SNAPSHOT versions.

Possible improvements

PRs welcome.

  • Download an index of all of Clojars for inferencing of deps that are not in your local .m2/repository. This index must be kept up to date, e.g. daily, and be committed to some git repo where we can then fetch it.

Troubleshooting

To re-index your repo, remove the index of namespaces to jars, run:

$ rm -rf .work/index.edn

and then run this tool again.

Credits

License

Copyright © 2021 Michiel Borkent

Distributed under the EPL License. See LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].