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

False positive "unresolved namespace" warning in data_readers.clj #892

Closed
rap1ds opened this issue May 15, 2020 · 4 comments
Closed

False positive "unresolved namespace" warning in data_readers.clj #892

rap1ds opened this issue May 15, 2020 · 4 comments
Labels
clj-together enhancement New feature or request

Comments

@rap1ds
Copy link
Contributor

rap1ds commented May 15, 2020

version

clj-kondo v2020.05.09

platform

Native, docker and JVM

problem

From https://clojure.org/reference/reader#tagged_literals

When Clojure starts, it searches for files named data_readers.clj at the root of the classpath. Each such file must contain a Clojure map of symbols, like this:

{foo/bar my.project.foo/bar
 foo/baz my.project/baz}

clj-kondo warns for unresolved namespaces and suggest adding a require.

repro

echo '{foo/bar my.project.foo/bar
 foo/baz my.project/baz}' > data_readers.clj
clj-kondo --lint data_readers.clj
data_readers.clj:1:2: warning: Unresolved namespace foo. Are you missing a require?
data_readers.clj:1:10: warning: Unresolved namespace my.project.foo. Are you missing a require?
data_readers.clj:2:10: warning: Unresolved namespace my.project. Are you missing a require?
linting took 8ms, errors: 0, warnings: 3

expected behavior

No errors/warnings about the foo namespace.

I'm not sure what's the expected behaviour for my.project.foo and my.project warnings. Either a) don't report them or b) check if those vars exist in the project and warn if they don't.

Or maybe just simply disable unresolved namespace linter if the file name is data_readers.clj?

@borkdude
Copy link
Member

@rap1ds

Or maybe just simply disable unresolved namespace linter if the file name is data_readers.clj?

Yes. We do exactly this for project.clj too.

@borkdude borkdude added the enhancement New feature or request label May 15, 2020
@jdormit
Copy link

jdormit commented Mar 20, 2021

Is there a workaround for this in the meantime, something I could put in my .clj-kondo/config.edn?

@jdormit
Copy link

jdormit commented Mar 20, 2021

Ah, I figured it out. Posting here for anyone else who gets stuck on this:

{:output {:exclude-files ["src/data_readers.clj"]}}

@stale
Copy link

stale bot commented Dec 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the expired expired - might be closed due to too little activity label Dec 3, 2021
@borkdude borkdude removed the expired expired - might be closed due to too little activity label Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clj-together enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants