Skip to content

Commit

Permalink
Don't validate data_readers.clj files (#382)
Browse files Browse the repository at this point in the history
Always consider data_readers.clj files as valid.
  • Loading branch information
tengstrand authored Nov 7, 2023
1 parent 7c56cf7 commit f85a99a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@
:imports []}
(let [imports (imports content suffixed-top-ns interface-ns)
ignore? (ignore-file? file-path files-to-ignore)
invalid? (and (not ignore?)
(-> content ns-with-name? not))]
invalid? (not (or ignore?
(str/ends-with? relative-path "/data_readers.clj")
(-> content ns-with-name?)))]
(cond-> {:name ns-name
:namespace (if (ns-with-name? content)
(-> content second str)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,20 @@
(with-redefs [file/read-file (fn [_] ['--])
from-disk/namespace-name (fn [_ _] "")]
(is (= (from-disk/->namespace "." "" "" "" [] "path")
{:name "", :namespace "", :file-path "path", :imports [], :is-invalid true}))))
{:name ""
:namespace ""
:file-path "path"
:imports []
:is-invalid true}))))

(deftest ->namespace--ignore-data-readers
(with-redefs [file/read-file (fn [_] ['--])
from-disk/namespace-name (fn [_ _] "")]
(is (= (from-disk/->namespace "." "" "" "" [] "path/data_readers.clj")
{:file-path "path/data_readers.clj"
:imports []
:name ""
:namespace ""}))))

(deftest ->namespace--read-namespace
(with-redefs [file/read-file (fn [_] file-content)
Expand Down
1 change: 1 addition & 0 deletions next-release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Included in 0.2.18-SNAPSHOT #11:
309 Improve the performance of the poly commands by optimising the dependency calculations.
312 Build docs/example code should not use build-clj.
313 NPE when importing Java sub namespace.
316 Don't validate data_readers.clj files.
318 Use cljdoc for the poly tool documentation. Moved back all the poly tool documentation to the GitHib repository
together with the source code + updated the documentation + added new pages:
Artifacts, Doc, Poly as a library, Tap, Test Runners, Validations, Source code, Polyx, and Maintenance.
Expand Down

0 comments on commit f85a99a

Please sign in to comment.