-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show warning 206, if a namespace can't be parsed #258
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
81a916e
Add error message if namespace can't be read.
tengstrand f9fe61c
Set the key :invalid in a namespace if the namespace couldn't be read.
tengstrand d9e9f21
Upgraded libraries to the latest stable version.
tengstrand c8c2f8c
Activate warning 206.
tengstrand 205d339
Update ws version.
tengstrand 01426b0
Fix version namespace.
tengstrand 03bfb43
Make sure we can read commented out namespaces. Add test.
tengstrand bad34f9
Fixed comment.
tengstrand 3f7267f
Merged from master.
tengstrand d20a24d
Added coloring to the "Error 109" explanation in the 'help check' out…
tengstrand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version is 2022-11-05 in version component. It's better if they are the same.