Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,37 @@ You don't have to have Leiningen to check your codebase anymore :-)
Add the following to your `deps.edn`:

```clj
:aliases {:check {:extra-deps {athos/clj-check {:git/url "https://github.com/athos/clj-check.git"
:sha "0ca84df1357d71429243b99908303f45a934654c"}}
:main-opts ["-m" "clj-check.check"]}}
:aliases
{:check
{:extra-deps
{com.github.athos/clj-check
{:git/url "https://github.com/athos/clj-check.git"
:sha "9e9282a6455f58a2015d267ad503b812ec6cdeb3"}}
:exec-fn clj-check.check/check}
```

If your project has its codebase under some directories other than `src` (say `src/clj` and `src/cljc`), specify them as the command line arguments as follows:

```clj
:aliases {:check {...
:main-opts ["-m" "clj-check.check" "src/clj" "src/cljc"]}}
:aliases
{:check
{...
:exec-args
{:source-paths ["src/clj" "src/cljc"]}}}
```


Then, run `clj-check` via the declared alias:

For clj versions 1.10.1.697 and greater:

```
clj -M:check
clj -X:check
```

For older versions:
OR

Run `clj-check` with CLI overrides
```
clj -A:check
clj -X:check :source-paths "[\"src/clj\"]"
```

## License
Expand Down
13 changes: 6 additions & 7 deletions src/clj_check/check.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@
(doto e .printStackTrace))))

(defn check
[source-paths]
[{:keys [source-paths]
:or {source-paths ["src"]}}]
(let [namespaces (bultitude/namespaces-on-classpath
:classpath (map io/file source-paths)
:ignore-unreadable? false)
failures (count
(sequence
(comp (map check-ns) (remove nil?))
namespaces))]
failures (count (keep check-ns namespaces))]
(shutdown-agents)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can get rid of this when we switch over to -X and remove support for -M

(when-not (zero? failures)
(System/exit failures))))

(defn -main [& source-paths]
(check (or (seq source-paths) ["src"])))
(defn -main
[& source-paths]
(check {:source-paths source-paths}))