-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show warning 206, if a namespace can't be parsed (#258)
Add error message if namespace can't be read.
- Loading branch information
1 parent
ca7c38e
commit 28d8848
Showing
22 changed files
with
163 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{:paths ["src"] | ||
:deps {org.clojure/tools.deps.alpha {:mvn/version "0.14.1205"}} | ||
:deps {org.clojure/tools.deps.alpha {:mvn/version "0.15.1244"}} | ||
:aliases {:test {:extra-paths ["test"] | ||
:extra-deps {}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{:paths ["src"] | ||
:deps {clj-commons/fs {:mvn/version "1.6.310"} | ||
org.clojure/tools.deps.alpha {:mvn/version "0.14.1205"}} | ||
org.clojure/tools.deps.alpha {:mvn/version "0.15.1244"}} | ||
:aliases {:test {:extra-paths ["test"] | ||
:extra-deps {}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{:paths ["src"] | ||
:deps {djblue/portal {:mvn/version "0.26.0"}} | ||
:deps {djblue/portal {:mvn/version "0.33.0"}} | ||
:aliases {:test {:extra-paths [] | ||
:extra-deps {}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{:paths ["src"] | ||
:deps {metosin/malli {:mvn/version "0.8.4"}} | ||
:deps {metosin/malli {:mvn/version "0.9.2"}} | ||
:aliases {:test {:extra-paths ["test"] | ||
:extra-deps {}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
components/validator/src/polylith/clj/core/validator/m206_unreadable_namespace.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
(ns polylith.clj.core.validator.m206-unreadable-namespace | ||
(:require [polylith.clj.core.util.interface :as util] | ||
[polylith.clj.core.util.interface.color :as color])) | ||
|
||
(defn unreadable-ns [{:keys [file-path invalid]} type name color-mode] | ||
(when invalid | ||
(let [message (str "Unreadable namespace in " (color/brick type name color-mode) ": " file-path)] | ||
[(util/ordered-map :type "warning" | ||
:code 206 | ||
:message (color/clean-colors message) | ||
:colorized-message message)]))) | ||
|
||
(defn unreadable-nss [{:keys [type name namespaces]} color-mode] | ||
(concat | ||
(mapcat #(unreadable-ns % type name color-mode) (:src namespaces)) | ||
(mapcat #(unreadable-ns % type name color-mode) (:test namespaces)))) | ||
|
||
(defn warnings [components bases projects color-mode] | ||
(mapcat #(unreadable-nss % color-mode) | ||
(concat components bases projects))) |
31 changes: 31 additions & 0 deletions
31
components/validator/test/polylith/clj/core/validator/m206_unreadable_namespace_test.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
(ns polylith.clj.core.validator.m206-unreadable-namespace-test | ||
(:require [clojure.test :refer :all] | ||
[polylith.clj.core.validator.m206-unreadable-namespace :as m206])) | ||
|
||
(def bricks [{:type "base" | ||
:name "poly-cli" | ||
:namespaces {:src [{:name "core" | ||
:namespace "" | ||
:invalid true | ||
:file-path "/Users/joakimtengstrand/source/polylith/bases/poly-cli/src/polylith/clj/core/poly_cli/core.clj" | ||
:imports ["polylith.clj.core.command.interface"]} | ||
{:name "api" | ||
:namespace "polylith.clj.core.poly-cli.api" | ||
:file-path "/Users/joakimtengstrand/source/polylith/bases/poly-cli/src/polylith/clj/core/poly_cli/api.clj" | ||
:imports ["clojure.string"]}] | ||
:test [{:name "api-argument-mapping-test" | ||
:namespace "" | ||
:invalid true | ||
:file-path "/Users/joakimtengstrand/source/polylith/bases/poly-cli/test/polylith/clj/core/poly_cli/api_argument_mapping_test.clj" | ||
:imports ["clojure.test" "polylith.clj.core.poly-cli.api"]}]}}]) | ||
|
||
(deftest warning--when-having-unreadable-namespaces--returns-warnings | ||
(is (= [{:type "warning", | ||
:code 206, | ||
:message "Unreadable namespace in poly-cli: /Users/joakimtengstrand/source/polylith/bases/poly-cli/src/polylith/clj/core/poly_cli/core.clj", | ||
:colorized-message "Unreadable namespace in poly-cli: /Users/joakimtengstrand/source/polylith/bases/poly-cli/src/polylith/clj/core/poly_cli/core.clj"} | ||
{:type "warning", | ||
:code 206, | ||
:message "Unreadable namespace in poly-cli: /Users/joakimtengstrand/source/polylith/bases/poly-cli/test/polylith/clj/core/poly_cli/api_argument_mapping_test.clj", | ||
:colorized-message "Unreadable namespace in poly-cli: /Users/joakimtengstrand/source/polylith/bases/poly-cli/test/polylith/clj/core/poly_cli/api_argument_mapping_test.clj"}] | ||
(m206/warnings bricks nil nil "none")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{:paths ["src"] | ||
:deps {org.clojure/tools.deps.alpha {:mvn/version "0.14.1205"}} | ||
:deps {org.clojure/tools.deps.alpha {:mvn/version "0.15.1244"}} | ||
:aliases {:test {:extra-paths ["test"] | ||
:extra-deps {}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters