For a list of validations, see the check command. You can show the same help at your terminal via:
poly help check
The check
command returns a non-zero exit code on errors only (not warnings).
See check for details.
The info command shows errors and warnings, but they do not affect its exit code.
Tip
|
By default, check only runs against projects under the projects directory.
Specify the :dev argument, and poly will also check your development project.
|
The poly
tool stores all errors and warnings in the workspace structure; you can list them via the ws command:
poly ws get:messages
An example output:
If your workspace doesn’t have any active warnings or errors, you will see an empty result:
[]
The check command generates a Warning 207 - Unnecessary components were found in project
when it finds components unused by any bricks in a project.
Suppose you get warning 207 for a project but know the component is needed (e.g., it is used dynamically but not explicitly called).
In that case, you can suppress the warning by specifying that it is :necessary
to the project in your workspace.edn
:
{...
:projects {"poly" {:alias "poly"
:necessary ["api" "clojure-test-test-runner"] ;; (1)
:test {:setup-fn project.poly.hto/activate!}}
"polyx" {:alias "polyx" :test [] :necessary ["clojure-test-test-runner"]} ;; (1)
"development" {:alias "dev"}}
...}
-
Example usages from the
poly
tool itself
If poly
finds that a .clj
or .cljc
source file is unreadable or its namespace is missing, you will see Error 111: Unreadable namespace
.
Let’s explore this error with our example
tutorial workspace.
The example
workspace source is here if you have not been following along.
Note
|
If you follow along, remember to revert your changes to your example workspace afterward.
|
Comment out the se.example.user.core
namespace declaration in the user
component:
;(ns se.example.user.core) ;; (1)
(defn hello [name]
(str "Hello " name "!!"))
-
Comment this line out
Run:
poly check
You should see this error:
Have a look at the namespace with the ws command:
poly ws get:components:user:namespaces:src:core
Notice that poly
has marked it as invalid:
{:file-path "components/user/src/se/example/user/core.clj",
:imports [],
:is-invalid true, ;; (1)
:name "core",
:namespace ""}
-
Marked as invalid