Skip to content
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

namespace docstrings break kibit... #231

Closed
eigenhombre opened this issue Jul 22, 2019 · 8 comments
Closed

namespace docstrings break kibit... #231

eigenhombre opened this issue Jul 22, 2019 · 8 comments

Comments

@eigenhombre
Copy link

eigenhombre commented Jul 22, 2019

... and lein kibit fails to properly set the exit code:

~/dev/clojure $ lein new kbug
Generating a project called kbug based on the 'default' template.
The default template is intended for library projects, not applications.
To see other templates (app, plugin, etc), try `lein help new`.
~/dev/clojure $ cd kbug
~/dev/clojure/kbug $ # edit core.clj; add docstring to namespace:
~/dev/clojure/kbug $ cat src/kbug/core.clj
(ns kbug.core
  "docstring")

(defn foo
  "I don't do a whole lot."
  [x]
  (println x "Hello, World!"))
~/dev/clojure/kbug $ lein kibit && echo zero || echo nonzero
Check failed -- skipping rest of file (src/kbug/core.clj:null:null)
java.lang.Character cannot be cast to clojure.lang.Named
zero
~/dev/clojure/kbug $ 

If you leave off the docstring for the namespace, kibitruns fine.

@aviflax
Copy link

aviflax commented Jul 26, 2019

It looks like this might be a regression in 0.1.7?

I just tried upgrading my project to use 0.1.7 instead of 0.1.6, but I’m seeing a rash of very similar error messages:

When using 0.1.6
$ clojure -A:kibit
Check failed -- skipping rest of file
[line 83, col 0] Invalid keyword: ::st/tags.
Check failed -- skipping rest of file
[line 68, col 32] Invalid keyword: ::st/diagram.
Check failed -- skipping rest of file
[line 76, col 46] Invalid keyword: ::st/diagram-yaml-str.
Check failed -- skipping rest of file
[line 108, col 53] Invalid keyword: ::st/element-with-position.
Check failed -- skipping rest of file
[line 22, col 17] Invalid keyword: ::st/name.
Check failed -- skipping rest of file
[line 60, col 40] Invalid keyword: ::st/diagram-yaml-str.
At src/main/fc4/io/cli/main.clj:125:
Consider using:
  (spit file-path (assemble front))
instead of:
  (->> (assemble front) (spit file-path))
When using 0.1.7
$ clojure -A:kibit
Check failed -- skipping rest of file (src/main/fc4/files.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/main/fc4/integrations/structurizr/express/export.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/main/fc4/integrations/structurizr/express/format.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/main/fc4/integrations/structurizr/express/node_renderer.clj:76:null)
[line 76, col 46] Invalid keyword: ::st/diagram-yaml-str.
Check failed -- skipping rest of file (src/main/fc4/integrations/structurizr/express/snap.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/main/fc4/integrations/structurizr/express/spec.clj:22:null)
[line 22, col 17] Invalid keyword: ::st/name.
Check failed -- skipping rest of file (src/main/fc4/integrations/structurizr/express/yaml.clj:60:null)
[line 60, col 40] Invalid keyword: ::st/diagram-yaml-str.
Check failed -- skipping rest of file (src/main/fc4/io/cli/main.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/main/fc4/io/dsl.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/main/fc4/io/render.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/main/fc4/io/util.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/main/fc4/io/watch.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/main/fc4/spec.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/test_utils/fc4/test_runner/cloverage.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/test_utils/fc4/test_runner/runner.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')
Check failed -- skipping rest of file (src/test_utils/fc4/test_utils.clj:null:null)
class java.lang.Character cannot be cast to class clojure.lang.Named (java.lang.Character is in module java.base of loader 'bootstrap'; clojure.lang.Named is in unnamed module of loader 'app')

And it does look like all of the clj files mentioned in the error output do have docstrings in their opening ns form.

Output of java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.4+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.4+11, mixed mode)

@danielcompton
Copy link
Member

danielcompton commented Jul 28, 2019

Thanks @aviflax, can you confirm what happens if you temporarily remove the docstrings from those namespaces? Does kibit check the file?

@eigenhombre
Copy link
Author

eigenhombre commented Jul 28, 2019 via email

@aviflax
Copy link

aviflax commented Jul 30, 2019

Yes, confirmed.

@asilverman
Copy link

asilverman commented Jul 31, 2019

@eigenhombre - I am experiencing the same issue, I get a java.lang.Character cannot be cast to clojure.lang.Named exception on namespaces with docstrings

When using 0.1.6

``` -> lein kibit file.clj -> ```

When using 0.1.7 ``` -> lein kibit file.clj Check failed -- skipping rest of file (file.clj:null:null) java.lang.Character cannot be cast to clojure.lang.Named -> ```

@oubiwann
Copy link

I've added an 👀 emoji to the ticket description so folks don't have to "me too" their comments, if they don't want to ...

@tomjkidd tomjkidd mentioned this issue Sep 15, 2019
@caiorulli-quintoandar
Copy link

Hey! It would be nice to have a minor release with this fix :) We wanted to use kibit in a project here but we have a lot of namespace docstrings... Could you help out and make a release, please?

@danielcompton
Copy link
Member

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants