Strategies are concerned with generating a seq of filenames to process (format, lint, or compile).
Said filenames must satisfy the ::protocols.spec/filename
spec, and represent an existing file.
They are configured to run in a determinate order.
In practice, a strategy is function that receives a seq of filenames, and returns another:
filter
ed.A strategy may not return nil.
Strategies are concerned with generating a seq of filenames to process (format, lint, or compile). Said filenames must satisfy the `::protocols.spec/filename` spec, and represent an existing file. They are configured to run in a determinate order. In practice, a strategy is function that receives a seq of filenames, and returns another: * more filenames may be added; and or * the passed filenames may be `filter`ed. A strategy may not return nil.
(all-files & {:keys [files]})
This strategy unconditionally processes all Clojure and ClojureScript files.
This strategy unconditionally processes all Clojure and ClojureScript files.
(do-not-use-cached-results! & {:keys [files]})
Normally, subsequent 'members' (formatters, linters, processors) using identical strategies will cache the results of those strategies. That is apt for formatters that do safe modifications, but not for more dangerous formatters.
By adding this empty strategy, it is signaled that the member using it should not use a cached result.
You can find a detailed explanation/example in https://git.io/fh7E0 .
Normally, subsequent 'members' (formatters, linters, processors) using identical strategies will cache the results of those strategies. That is apt for formatters that do safe modifications, but not for more dangerous formatters. By adding this empty strategy, it is signaled that the member using it should not use a cached result. You can find a detailed explanation/example in https://git.io/fh7E0 .
(exclude-clj & {:keys [files]})
This strategy excludes .clj files; .cljc files are not excluded in any case.
This strategy excludes .clj files; .cljc files are not excluded in any case.
(exclude-cljc & {:keys [files]})
This strategy excludes .cljc files; .cljs files are not excluded in any case.
This strategy excludes .cljc files; .cljs files are not excluded in any case.
(exclude-cljs & {:keys [files]})
This strategy excludes .cljs files; .cljc files are not excluded in any case.
This strategy excludes .cljs files; .cljc files are not excluded in any case.
(exclude-edn & {:keys [files]})
This strategy excludes .edn files.
This strategy excludes .edn files.
(exclusively-cljs & {:keys [files]})
This strategy excludes files not suffixed in .cljs or .cljc
This strategy excludes files not suffixed in .cljs or .cljc
(files-with-a-namespace & {:keys [files]})
This strategy excludes files that don't begin with a (ns ...)
form.
This strategy excludes files that don't begin with a `(ns ...)` form.
(git-completely-staged
&
{:keys [files impl]
:or {impl (impl/file-entries git-command "status" "--porcelain")}})
This strategy processes the new or modified files that are completely staged with git.
This strategy processes the new or modified files that are _completely_ staged with git.
(git-diff-against-default-branch
&
{:keys [target-branch impl files blacklist]
:or {target-branch (default-branch-name)
impl (impl/file-entries git-command
"diff"
"--name-only"
"--diff-filter=ACMR"
target-branch
"--")
blacklist (git-not-completely-staged :files [])}})
This strategy processes all files that this branch has modified.
The diff is compared against the :target-branch
option.
This strategy processes all files that this branch has modified. The diff is compared against the `:target-branch` option.
(git-not-completely-staged
&
{:keys [files impl]
:or {impl (impl/file-entries git-command "status" "--porcelain")}})
This strategy processes all files that are not completely staged with git. Untracked files are also included.
This strategy processes all files that are not _completely_ staged with git. Untracked files are also included.
(jvm-requirable-files & {:keys [files]})
This strategy excludes files that can't be require
d under JVM Clojure.
This strategy excludes files that can't be `require`d under JVM Clojure.
(namespaces-within-refresh-dirs-only
&
{:keys [files refresh-dirs]
:or {refresh-dirs tools.namespace.repl/refresh-dirs}})
This strategy excludes the files that are Clojure/Script namespaces
but are placed outside #'clojure.tools.namespace.repl/refresh-dirs
.
This variable must be set beforehand, and all its values should correspond to existing folders (relative to the project root).
Files such as project.clj, or .edn files, etc are not excluded, since they aren't namespaces.
The rationale for this strategy is allowing you to create clj namespace directories that are excluded from refresh-dirs
.
e.g. protocol definitions,
and then ensuring that code-evaluating tools such as refactor-nrepl or Eastwood also respect that exclusion.
That can avoid some code-reloading issues related to duplicate defprotocol
definitions, etc.
This strategy excludes the files that are Clojure/Script namespaces but are placed outside `#'clojure.tools.namespace.repl/refresh-dirs`. This variable must be set beforehand, and all its values should correspond to existing folders (relative to the project root). Files such as project.clj, or .edn files, etc are not excluded, since they aren't namespaces. The rationale for this strategy is allowing you to create clj namespace directories that are excluded from `refresh-dirs`. e.g. protocol definitions, and then ensuring that code-evaluating tools such as refactor-nrepl or Eastwood also respect that exclusion. That can avoid some code-reloading issues related to duplicate `defprotocol` definitions, etc.
(when-refactor-nrepl & {:keys [files]})
This strategy leaves all files
as-is iff the refactor-nrepl
library is in the classpath;
else all files
will be filtered out.
This strategy leaves all `files` as-is iff the `refactor-nrepl` library is in the classpath; else all `files` will be filtered out.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close