Liking cljdoc? Tell your friends :D

Validations

Each time you execute the check, info, or test command, your workspace is validated.

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 test command fails fast on any check errors. Warnings do not affect test outcome.

The info command shows errors and warnings, but they do not affect its exit code.

By default, check only runs against projects under the projects directory. Specify the :dev argument, and poly will also check your development project.

Viewing All Errors and Warnings

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:

messages example

If your workspace doesn’t have any active warnings or errors, you will see an empty result:

[]

Suppress warnings

If you know what you’re doing, you can suppress warnings via the :disable key under :validations in workspace.edn:

{...
 :validations {:disable [{:warning 205, :bricks ["database" "invoice"]}
                         {:warning 202, :projects ["myproject"]}]}
...}

Each entry in the :disable vector selects one warning via its :warning number (the 2xx codes). You can optionally limit the suppression to certain bricks via :bricks (matching component and base names) or to certain projects via :projects (matching project names). If you leave both :bricks and :projects out, the warning is suppressed everywhere.

Errors can’t be suppressed, and message 301 has its own configuration via :inconsistent-lib-versions instead.

The :disable entries are not validated, so a misspelled key or an unsupported warning number is silently ignored (the warning keeps running).

Warning 205

While migrating a codebase to a Polylith workspace, you may want to temporarily ignore warning 205, which indicates that a non-top namespace has been found in the workspace.

If you want to turn off the warning for all bricks, update workspace.edn as follows:

{...
 :validations {:disable [{:warning 205}]}
...}

The most common is probably that you want to suppress the warning for a limited number of bricks:

{...
 :validations {:disable [{:warning 205, :bricks ["database" "invoice"]}]}
...}

Suppress a warning for a single project

{...
 :validations {:disable [{:warning 202, :projects ["myproject"]}]}
...}

Suppress more than one warning

{...
 :validations {:disable [{:warning 205, :bricks ["database" "invoice"]}
                         {:warning 202, :projects ["myproject"]}
                         {:warning 207, :projects ["myproject"]}]}
...}

Marking a Brick as Necessary to Suppress Warning 207

The check command generates a Warning 207 - Unnecessary components were found in project when it finds components unused by any bricks in a project.

Besides the general suppress mechanism, warning 207 can also be suppressed by marking individual components as :necessary in the project configuration.

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"}}
...}
1Example usages from the poly tool itself

Workspace Structure Reflects Error 111

If poly finds that a .clj, .cljc, or .cljs source file is unreadable, 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.

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:

./components/user/src/se/example/user/core.clj
;(ns se.example.user.core) (1)

(defn hello [name]
  (str "Hello " name "!!"))
1Comment this line out

Run:

poly check

You should see this error:

missing or unreadable namespace

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 ""}
1Marked as invalid

Can you improve this documentation? These fine people already did:
Joakim Tengstrand & Furkan Bayraktar
Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close