Liking cljdoc? Tell your friends :D
Clojure only.

clj-depend.api


analyzeclj

(analyze {:keys [project-root config files namespaces] :as options})

Analyze namespaces dependencies.

Takes a map with:

  • :project-root required, a java.io.File representing the project root.

  • :config optional, a configuration map. Otherwise, it will try to resolve the configuration using .clj-depend/config.edn in :project-root directory.

  • :files optional, a set of files or directories (java.io.File) representing files to be analyzed. If empty, all files in source paths declared in config will be considered.

  • :namespaces optional, a set of symbols representing namespaces to be analyzed. If empty, all project namespaces will be considered.

Returns a map with:

  • :result-code required, an integer:
    • 0: no violations were found
    • 1: one or more violations were found
    • 2: error during analysis
  • :message required, a string with message.
  • :violations a set of maps with :namespace and :violation.

Example

(clj-depend.api/analyze {:project-root (io/file ".")
                         :config {:source-paths #{"src"
                                  :layers {:foo {:defined-by "foo\..*" :accessed-by-layers #{}}
                                           :bar {:defined-by "bar\..*" :accessed-by-layers #{:foo}}}}}
                         :namespaces #{foo.x bar.y}})
Analyze namespaces dependencies.

Takes a map with:

- `:project-root` required, a java.io.File representing the project root.

- `:config` optional, a configuration map. Otherwise, it will try to resolve the configuration using `.clj-depend/config.edn` in `:project-root` directory.

- `:files` optional, a set of files or directories (java.io.File) representing files to be analyzed. If empty, all files in source paths declared in config will be considered.

- `:namespaces` optional, a set of symbols representing namespaces to be analyzed. If empty, all project namespaces will be considered.

Returns a map with:

- `:result-code` required, an integer:
  - 0: no violations were found
  - 1: one or more violations were found
  - 2: error during analysis
- `:message` required, a string with message.
- `:violations` a set of maps with `:namespace` and `:violation`.

**Example**

```clojure
(clj-depend.api/analyze {:project-root (io/file ".")
                         :config {:source-paths #{"src"
                                  :layers {:foo {:defined-by "foo\..*" :accessed-by-layers #{}}
                                           :bar {:defined-by "bar\..*" :accessed-by-layers #{:foo}}}}}
                         :namespaces #{foo.x bar.y}})
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close