From 1e5e64a2dde5899bdcc1127a16bb0c1c0ee315c7 Mon Sep 17 00:00:00 2001 From: Tom Kidd Date: Sat, 14 Sep 2019 21:37:02 -0500 Subject: [PATCH 1/2] Add failing reader tests that use docstring and attr-map in ns forms Was made aware of this type of failure via https://github.com/jonase/kibit/issues/231. --- kibit/test/kibit/test/check_reader.clj | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kibit/test/kibit/test/check_reader.clj b/kibit/test/kibit/test/check_reader.clj index ae564c4..2c37da9 100644 --- a/kibit/test/kibit/test/check_reader.clj +++ b/kibit/test/kibit/test/check_reader.clj @@ -5,6 +5,17 @@ (deftest derive-aliases-test (are [expected-alias-map ns-form] (= expected-alias-map (reader/derive-aliases ns-form)) + '{foo foo.bar.baz} '(ns derive.test.one + "This is a namespace string, which should not cause problems" + {:author "Alice" + :purpose "Make sure that attr-map also doesn't cause problems"} + (:require [foo.bar.baz :as foo])) + '{foo foo.bar.baz} '(ns ^{:doc "Docstring as metadata"} + derive.test.one + (:require [foo.bar.baz :as foo])) + '{foo foo.bar.baz} '(ns ^:metadata-x derive.test.one + (:require [foo.bar.baz :as foo])) + '{foo foo.bar.baz} '(ns derive.test.one (:require [foo.bar.baz :as foo])) '{foo foo.bar.baz From 2c7b4a239c4e47c31f2c19f2a2c230a8bc54fc44 Mon Sep 17 00:00:00 2001 From: Tom Kidd Date: Sat, 14 Sep 2019 21:41:44 -0500 Subject: [PATCH 2/2] Update ns version of derive-aliases to remove docstring and attr-map --- kibit/src/kibit/check/reader.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/kibit/src/kibit/check/reader.clj b/kibit/src/kibit/check/reader.clj index 5932e9b..91a8b41 100644 --- a/kibit/src/kibit/check/reader.clj +++ b/kibit/src/kibit/check/reader.clj @@ -90,6 +90,7 @@ (defmethod derive-aliases 'ns [[_ _ns & ns-asserts]] (->> ns-asserts + (remove #(or (string? %) (map? %))) (group-by (comp keyword name first)) ((juxt :require :require-macros)) (apply concat)