Skip to content

Lint the code with clj-kondo#74

Open
eploko wants to merge 19 commits intolvh:masterfrom
eploko:clj-kondo
Open

Lint the code with clj-kondo#74
eploko wants to merge 19 commits intolvh:masterfrom
eploko:clj-kondo

Conversation

@eploko
Copy link
Contributor

@eploko eploko commented Sep 30, 2020

Where it all started

FWIW, I would completely understand if you want to fix Eastwood first, but I've had mostly a good time with clj-kondo. https://github.com/latacora/wernicke has example workflows (in GitHub Actions, though: not Travis). I'm fine with Eastwood too! But mostly don't feel like you have to get Eastwood working because that's what was there :)

The preference isn't a strong ground to change the tool, albeit I tend to use clj-kondo in my other projects as well. :) The warnings were quite easy to fix, so just sticking with it is fine I guess for now. I doubt clj-kondo will be any different in terms of integrating in GH Actions later. Please tell me if you'd like eastwood replaced and we can look into it at a later stage.

Originally posted by @eploko in #69 (comment)

What this PR brings

This adds clj-kondo as a dependency for the test profile. It also adds a step to the build workflow to lint the code with clj-kondo. The step is postfixed with || true a là the eastwood step so it doesn't fail the build.

Things to do before merging this in

  • Fix all of the issues reported by clj-kondo.
  • Decide whether we remove eastwood after integrating clj-kondo.

@eploko eploko marked this pull request as draft September 30, 2020 23:59
@eploko
Copy link
Contributor Author

eploko commented Oct 1, 2020

Running clj-kondo on the current master produces the following set of issues:

$ lein with-profile +test clj-kondo --lint src:test || true
Reflection warning, /tmp/form-init3084112385049032488.clj:1:924 - call to static method invokeStaticMethod on clojure.lang.Reflector can't be resolved (argument types: unknown, java.lang.String, unknown).
Reflection warning, sci/impl/multimethods.cljc:12:6 - call to java.lang.IllegalArgumentException ctor can't be resolved.
src/caesium/binding.clj:10:14: warning: duplicate require of clojure.string
src/caesium/binding.clj:12:33: warning: Unused import In
src/caesium/binding.clj:12:36: warning: Unused import Out
src/caesium/binding.clj:12:40: warning: Unused import Pinned
src/caesium/binding.clj:12:47: warning: Unused import LongLong
src/caesium/binding.clj:13:27: warning: Unused import size_t
src/caesium/binding.clj:714:29: error: unresolved symbol Sodium
src/caesium/binding.clj:717:23: warning: unused binding e
src/caesium/crypto/aead.clj:6:15: error: unresolved symbol chacha20poly1305-ietf-keybytes
src/caesium/crypto/aead.clj:7:15: error: unresolved symbol chacha20poly1305-ietf-nsecbytes
src/caesium/crypto/aead.clj:8:15: error: unresolved symbol chacha20poly1305-ietf-npubbytes
src/caesium/crypto/aead.clj:9:15: error: unresolved symbol chacha20poly1305-ietf-abytes
src/caesium/crypto/aead.clj:10:15: error: unresolved symbol chacha20poly1305-keybytes
src/caesium/crypto/aead.clj:11:15: error: unresolved symbol chacha20poly1305-nsecbytes
src/caesium/crypto/aead.clj:12:15: error: unresolved symbol chacha20poly1305-npubbytes
src/caesium/crypto/aead.clj:13:15: error: unresolved symbol chacha20poly1305-abytes
src/caesium/crypto/aead.clj:14:15: error: unresolved symbol xchacha20poly1305-ietf-keybytes
src/caesium/crypto/aead.clj:15:15: error: unresolved symbol xchacha20poly1305-ietf-nsecbytes
src/caesium/crypto/aead.clj:16:15: error: unresolved symbol xchacha20poly1305-ietf-npubbytes
src/caesium/crypto/aead.clj:17:15: error: unresolved symbol xchacha20poly1305-ietf-abytes
src/caesium/crypto/aead.clj:20:12: error: unresolved symbol chacha20poly1305-ietf-keygen
src/caesium/crypto/aead.clj:36:12: error: unresolved symbol chacha20poly1305-ietf-encrypt
src/caesium/crypto/aead.clj:54:22: error: unresolved symbol chacha20poly1305-ietf-decrypt
src/caesium/crypto/aead.clj:73:12: error: unresolved symbol chacha20poly1305-ietf-encrypt-detached
src/caesium/crypto/aead.clj:93:22: error: unresolved symbol chacha20poly1305-ietf-decrypt-detached
src/caesium/crypto/aead.clj:112:12: error: unresolved symbol chacha20poly1305-keygen
src/caesium/crypto/aead.clj:128:12: error: unresolved symbol chacha20poly1305-encrypt
src/caesium/crypto/aead.clj:146:22: error: unresolved symbol chacha20poly1305-decrypt
src/caesium/crypto/aead.clj:165:12: error: unresolved symbol chacha20poly1305-encrypt-detached
src/caesium/crypto/aead.clj:185:22: error: unresolved symbol chacha20poly1305-decrypt-detached
src/caesium/crypto/aead.clj:204:12: error: unresolved symbol xchacha20poly1305-ietf-keygen
src/caesium/crypto/aead.clj:220:12: error: unresolved symbol xchacha20poly1305-ietf-encrypt
src/caesium/crypto/aead.clj:238:22: error: unresolved symbol xchacha20poly1305-ietf-decrypt
src/caesium/crypto/aead.clj:257:12: error: unresolved symbol xchacha20poly1305-ietf-encrypt-detached
src/caesium/crypto/aead.clj:277:22: error: unresolved symbol xchacha20poly1305-ietf-decrypt-detached
src/caesium/crypto/auth.clj:5:15: error: unresolved symbol hmacsha256-bytes
src/caesium/crypto/auth.clj:5:32: error: unresolved symbol hmacsha256-keybytes
src/caesium/crypto/auth.clj:6:15: error: unresolved symbol hmacsha512-bytes
src/caesium/crypto/auth.clj:6:32: error: unresolved symbol hmacsha512-keybytes
src/caesium/crypto/auth.clj:7:15: error: unresolved symbol hmacsha512256-bytes
src/caesium/crypto/auth.clj:7:35: error: unresolved symbol hmacsha512256-keybytes
src/caesium/crypto/auth.clj:16:12: error: unresolved symbol hmacsha256
src/caesium/crypto/auth.clj:35:12: error: unresolved symbol hmacsha512
src/caesium/crypto/auth.clj:54:12: error: unresolved symbol hmacsha512256
src/caesium/crypto/box.clj:6:22: warning: Unused import ByteBuffer
src/caesium/crypto/box.clj:8:15: error: unresolved symbol seedbytes
src/caesium/crypto/box.clj:9:15: error: unresolved symbol publickeybytes
src/caesium/crypto/box.clj:10:15: error: unresolved symbol secretkeybytes
src/caesium/crypto/box.clj:11:15: error: unresolved symbol noncebytes
src/caesium/crypto/box.clj:12:15: error: unresolved symbol macbytes
src/caesium/crypto/box.clj:13:15: error: unresolved symbol sealbytes
src/caesium/crypto/box.clj:14:15: error: unresolved symbol primitive
src/caesium/crypto/box.clj:23:13: error: unresolved symbol keypair
src/caesium/crypto/box.clj:25:13: error: unresolved symbol seed-keypair
src/caesium/crypto/box.clj:85:12: error: unresolved symbol easy
src/caesium/crypto/box.clj:85:21: error: unresolved symbol plen
src/caesium/crypto/box.clj:98:22: error: unresolved symbol open-easy
src/caesium/crypto/box.clj:112:12: error: unresolved symbol box-seal
src/caesium/crypto/box.clj:125:22: error: unresolved symbol seal-open
src/caesium/crypto/box.clj:258:12: error: unresolved symbol detached
src/caesium/crypto/box.clj:275:22: error: unresolved symbol open_detached
src/caesium/crypto/core/ristretto255.clj:11:15: error: unresolved symbol bytes
src/caesium/crypto/core/ristretto255.clj:11:21: error: unresolved symbol hashbytes
src/caesium/crypto/core/ristretto255.clj:11:31: error: unresolved symbol scalarbytes
src/caesium/crypto/core/ristretto255.clj:11:43: error: unresolved symbol nonreducedscalarbytes
src/caesium/crypto/core/ristretto255.clj:15:22: error: unresolved symbol is_valid_point
src/caesium/crypto/core/ristretto255.clj:31:22: error: unresolved symbol add
src/caesium/crypto/core/ristretto255.clj:47:22: error: unresolved symbol sub
src/caesium/crypto/core/ristretto255.clj:63:12: error: unresolved symbol from-hash
src/caesium/crypto/core/ristretto255.clj:75:12: error: unresolved symbol random
src/caesium/crypto/core/ristretto255/scalar.clj:14:12: error: unresolved symbol random
src/caesium/crypto/core/ristretto255/scalar.clj:29:22: error: unresolved symbol invert
src/caesium/crypto/core/ristretto255/scalar.clj:46:12: error: unresolved symbol negate
src/caesium/crypto/core/ristretto255/scalar.clj:58:12: error: unresolved symbol complement
src/caesium/crypto/core/ristretto255/scalar.clj:70:12: error: unresolved symbol add
src/caesium/crypto/core/ristretto255/scalar.clj:82:12: error: unresolved symbol sub
src/caesium/crypto/core/ristretto255/scalar.clj:94:12: error: unresolved symbol mul
src/caesium/crypto/core/ristretto255/scalar.clj:106:12: error: unresolved symbol reduce
src/caesium/crypto/core/ristretto255/scalar.clj:122:16: error: unresolved symbol is_canonical
src/caesium/crypto/generichash.clj:7:15: error: unresolved symbol bytes
src/caesium/crypto/generichash.clj:8:15: error: unresolved symbol bytes-min
src/caesium/crypto/generichash.clj:9:15: error: unresolved symbol bytes-max
src/caesium/crypto/generichash.clj:10:15: error: unresolved symbol keybytes
src/caesium/crypto/generichash.clj:11:15: error: unresolved symbol keybytes-min
src/caesium/crypto/generichash.clj:12:15: error: unresolved symbol keybytes-max
src/caesium/crypto/generichash.clj:13:15: error: unresolved symbol blake2b-bytes
src/caesium/crypto/generichash.clj:14:15: error: unresolved symbol blake2b-bytes-min
src/caesium/crypto/generichash.clj:15:15: error: unresolved symbol blake2b-bytes-max
src/caesium/crypto/generichash.clj:16:15: error: unresolved symbol blake2b-keybytes
src/caesium/crypto/generichash.clj:17:15: error: unresolved symbol blake2b-keybytes-min
src/caesium/crypto/generichash.clj:18:15: error: unresolved symbol blake2b-keybytes-max
src/caesium/crypto/generichash.clj:19:15: error: unresolved symbol blake2b-saltbytes
src/caesium/crypto/generichash.clj:20:15: error: unresolved symbol blake2b-personalbytes
src/caesium/crypto/generichash.clj:33:13: error: unresolved symbol generichash
src/caesium/crypto/generichash.clj:69:38: error: unresolved symbol blake2b-salt-personal
src/caesium/crypto/generichash.clj:70:36: error: unresolved symbol blake2b
src/caesium/crypto/hash.clj:5:15: error: unresolved symbol sha256-bytes
src/caesium/crypto/hash.clj:5:28: error: unresolved symbol sha512-bytes
src/caesium/crypto/hash.clj:14:12: error: unresolved symbol sha256
src/caesium/crypto/hash.clj:33:12: error: unresolved symbol sha512
src/caesium/crypto/kdf.clj:16:15: error: unresolved symbol bytes-min
src/caesium/crypto/kdf.clj:16:25: error: unresolved symbol bytes-max
src/caesium/crypto/kdf.clj:16:35: error: unresolved symbol contextbytes
src/caesium/crypto/kdf.clj:16:48: error: unresolved symbol keybytes
src/caesium/crypto/kdf.clj:16:57: error: unresolved symbol primitive
src/caesium/crypto/kdf.clj:20:12: error: unresolved symbol keygen
src/caesium/crypto/kdf.clj:31:22: error: unresolved symbol derive-from-key
src/caesium/crypto/kx.clj:5:22: warning: Unused import ByteBuffer
src/caesium/crypto/kx.clj:7:15: error: unresolved symbol seedbytes
src/caesium/crypto/kx.clj:7:25: error: unresolved symbol publickeybytes
src/caesium/crypto/kx.clj:7:40: error: unresolved symbol secretkeybytes
src/caesium/crypto/kx.clj:7:55: error: unresolved symbol sessionkeybytes
src/caesium/crypto/kx.clj:7:71: error: unresolved symbol primitive
src/caesium/crypto/kx.clj:16:13: error: unresolved symbol keypair
src/caesium/crypto/kx.clj:18:13: error: unresolved symbol seed-keypair
src/caesium/crypto/pwhash.clj:5:14: warning: namespace caesium.util is required but never used
src/caesium/crypto/pwhash.clj:6:14: warning: namespace medley.core is required but never used
src/caesium/crypto/pwhash.clj:8:15: error: unresolved symbol alg-argon2i13
src/caesium/crypto/pwhash.clj:9:15: error: unresolved symbol alg-argon2id13
src/caesium/crypto/pwhash.clj:10:15: error: unresolved symbol alg-default
src/caesium/crypto/pwhash.clj:11:15: error: unresolved symbol bytes-min
src/caesium/crypto/pwhash.clj:12:15: error: unresolved symbol bytes-max
src/caesium/crypto/pwhash.clj:13:15: error: unresolved symbol passwd-min
src/caesium/crypto/pwhash.clj:14:15: error: unresolved symbol passwd-max
src/caesium/crypto/pwhash.clj:15:15: error: unresolved symbol saltbytes
src/caesium/crypto/pwhash.clj:16:15: error: unresolved symbol strbytes
src/caesium/crypto/pwhash.clj:17:15: error: unresolved symbol strprefix
src/caesium/crypto/pwhash.clj:18:15: error: unresolved symbol opslimit-min
src/caesium/crypto/pwhash.clj:19:15: error: unresolved symbol opslimit-max
src/caesium/crypto/pwhash.clj:20:15: error: unresolved symbol memlimit-min
src/caesium/crypto/pwhash.clj:21:15: error: unresolved symbol memlimit-max
src/caesium/crypto/pwhash.clj:22:15: error: unresolved symbol opslimit-interactive
src/caesium/crypto/pwhash.clj:23:15: error: unresolved symbol memlimit-interactive
src/caesium/crypto/pwhash.clj:24:15: error: unresolved symbol opslimit-moderate
src/caesium/crypto/pwhash.clj:25:15: error: unresolved symbol memlimit-moderate
src/caesium/crypto/pwhash.clj:26:15: error: unresolved symbol opslimit-sensitive
src/caesium/crypto/pwhash.clj:27:15: error: unresolved symbol memlimit-sensitive
src/caesium/crypto/pwhash.clj:28:15: error: unresolved symbol primitive
src/caesium/crypto/pwhash.clj:30:15: error: unresolved symbol argon2i-alg-argon2i13
src/caesium/crypto/pwhash.clj:31:15: error: unresolved symbol argon2i-bytes-min
src/caesium/crypto/pwhash.clj:32:15: error: unresolved symbol argon2i-bytes-max
src/caesium/crypto/pwhash.clj:33:15: error: unresolved symbol argon2i-passwd-min
src/caesium/crypto/pwhash.clj:34:15: error: unresolved symbol argon2i-passwd-max
src/caesium/crypto/pwhash.clj:35:15: error: unresolved symbol argon2i-saltbytes
src/caesium/crypto/pwhash.clj:36:15: error: unresolved symbol argon2i-strbytes
src/caesium/crypto/pwhash.clj:37:15: error: unresolved symbol argon2i-strprefix
src/caesium/crypto/pwhash.clj:38:15: error: unresolved symbol argon2i-opslimit-min
src/caesium/crypto/pwhash.clj:39:15: error: unresolved symbol argon2i-opslimit-max
src/caesium/crypto/pwhash.clj:40:15: error: unresolved symbol argon2i-memlimit-min
src/caesium/crypto/pwhash.clj:41:15: error: unresolved symbol argon2i-memlimit-max
src/caesium/crypto/pwhash.clj:42:15: error: unresolved symbol argon2i-opslimit-interactive
src/caesium/crypto/pwhash.clj:43:15: error: unresolved symbol argon2i-memlimit-interactive
src/caesium/crypto/pwhash.clj:44:15: error: unresolved symbol argon2i-opslimit-moderate
src/caesium/crypto/pwhash.clj:45:15: error: unresolved symbol argon2i-memlimit-moderate
src/caesium/crypto/pwhash.clj:46:15: error: unresolved symbol argon2i-opslimit-sensitive
src/caesium/crypto/pwhash.clj:47:15: error: unresolved symbol argon2i-memlimit-sensitive
src/caesium/crypto/pwhash.clj:49:15: error: unresolved symbol argon2id-alg-argon2id13
src/caesium/crypto/pwhash.clj:50:15: error: unresolved symbol argon2id-bytes-min
src/caesium/crypto/pwhash.clj:51:15: error: unresolved symbol argon2id-bytes-max
src/caesium/crypto/pwhash.clj:52:15: error: unresolved symbol argon2id-passwd-min
src/caesium/crypto/pwhash.clj:53:15: error: unresolved symbol argon2id-passwd-max
src/caesium/crypto/pwhash.clj:54:15: error: unresolved symbol argon2id-saltbytes
src/caesium/crypto/pwhash.clj:55:15: error: unresolved symbol argon2id-strbytes
src/caesium/crypto/pwhash.clj:56:15: error: unresolved symbol argon2id-strprefix
src/caesium/crypto/pwhash.clj:57:15: error: unresolved symbol argon2id-opslimit-min
src/caesium/crypto/pwhash.clj:58:15: error: unresolved symbol argon2id-opslimit-max
src/caesium/crypto/pwhash.clj:59:15: error: unresolved symbol argon2id-memlimit-min
src/caesium/crypto/pwhash.clj:60:15: error: unresolved symbol argon2id-memlimit-max
src/caesium/crypto/pwhash.clj:61:15: error: unresolved symbol argon2id-opslimit-interactive
src/caesium/crypto/pwhash.clj:62:15: error: unresolved symbol argon2id-memlimit-interactive
src/caesium/crypto/pwhash.clj:63:15: error: unresolved symbol argon2id-opslimit-moderate
src/caesium/crypto/pwhash.clj:64:15: error: unresolved symbol argon2id-memlimit-moderate
src/caesium/crypto/pwhash.clj:65:15: error: unresolved symbol argon2id-opslimit-sensitive
src/caesium/crypto/pwhash.clj:66:15: error: unresolved symbol argon2id-memlimit-sensitive
src/caesium/crypto/pwhash.clj:68:15: error: unresolved symbol scryptsalsa208sha256-bytes-min
src/caesium/crypto/pwhash.clj:69:15: error: unresolved symbol scryptsalsa208sha256-bytes-max
src/caesium/crypto/pwhash.clj:70:15: error: unresolved symbol scryptsalsa208sha256-passwd-min
src/caesium/crypto/pwhash.clj:71:15: error: unresolved symbol scryptsalsa208sha256-passwd-max
src/caesium/crypto/pwhash.clj:72:15: error: unresolved symbol scryptsalsa208sha256-saltbytes
src/caesium/crypto/pwhash.clj:73:15: error: unresolved symbol scryptsalsa208sha256-strbytes
src/caesium/crypto/pwhash.clj:74:15: error: unresolved symbol scryptsalsa208sha256-strprefix
src/caesium/crypto/pwhash.clj:75:15: error: unresolved symbol scryptsalsa208sha256-opslimit-min
src/caesium/crypto/pwhash.clj:76:15: error: unresolved symbol scryptsalsa208sha256-opslimit-max
src/caesium/crypto/pwhash.clj:77:15: error: unresolved symbol scryptsalsa208sha256-memlimit-min
src/caesium/crypto/pwhash.clj:78:15: error: unresolved symbol scryptsalsa208sha256-memlimit-max
src/caesium/crypto/pwhash.clj:79:15: error: unresolved symbol scryptsalsa208sha256-opslimit-interactive
src/caesium/crypto/pwhash.clj:80:15: error: unresolved symbol scryptsalsa208sha256-memlimit-interactive
src/caesium/crypto/pwhash.clj:81:15: error: unresolved symbol scryptsalsa208sha256-opslimit-sensitive
src/caesium/crypto/pwhash.clj:82:15: error: unresolved symbol scryptsalsa208sha256-memlimit-sensitive
src/caesium/crypto/pwhash.clj:86:12: error: unresolved symbol pwhash
src/caesium/crypto/pwhash.clj:102:12: error: unresolved symbol pwhash-str
src/caesium/crypto/pwhash.clj:117:12: error: unresolved symbol pwhash-str-alg
src/caesium/crypto/pwhash.clj:142:12: error: unresolved symbol pwhash-argon2i
src/caesium/crypto/pwhash.clj:147:12: error: unresolved symbol pwhash-argon2i-str
src/caesium/crypto/pwhash.clj:183:12: error: unresolved symbol pwhash-argon2id
src/caesium/crypto/pwhash.clj:199:12: error: unresolved symbol pwhash-argon2id-str
src/caesium/crypto/pwhash.clj:224:12: error: unresolved symbol pwhash-scryptsalsa208sha256
src/caesium/crypto/pwhash.clj:240:12: error: unresolved symbol pwhash-scryptsalsa208sha256-str
src/caesium/crypto/scalarmult.clj:11:15: error: unresolved symbol bytes
src/caesium/crypto/scalarmult.clj:11:21: error: unresolved symbol scalarbytes
src/caesium/crypto/scalarmult.clj:11:33: error: unresolved symbol primitive
src/caesium/crypto/scalarmult.clj:18:13: error: unresolved symbol scalarmult-base
src/caesium/crypto/scalarmult.clj:20:13: error: unresolved symbol scalarmult
src/caesium/crypto/scalarmult/ristretto255.clj:11:15: error: unresolved symbol bytes
src/caesium/crypto/scalarmult/ristretto255.clj:11:21: error: unresolved symbol scalarbytes
src/caesium/crypto/scalarmult/ristretto255.clj:18:23: error: unresolved symbol base
src/caesium/crypto/scalarmult/ristretto255.clj:22:23: error: unresolved symbol ristretto255
src/caesium/crypto/secretbox.clj:7:22: warning: Unused import ByteBuffer
src/caesium/crypto/secretbox.clj:9:15: error: unresolved symbol keybytes
src/caesium/crypto/secretbox.clj:9:24: error: unresolved symbol noncebytes
src/caesium/crypto/secretbox.clj:9:35: error: unresolved symbol macbytes
src/caesium/crypto/secretbox.clj:9:44: error: unresolved symbol primitive
src/caesium/crypto/secretbox.clj:19:12: error: unresolved symbol easy
src/caesium/crypto/secretbox.clj:49:22: error: unresolved symbol open-easy
src/caesium/crypto/secretbox.clj:105:12: error: unresolved symbol detached
src/caesium/crypto/secretbox.clj:120:22: error: unresolved symbol open-detached
src/caesium/crypto/shorthash.clj:6:15: error: unresolved symbol bytes
src/caesium/crypto/shorthash.clj:7:15: error: unresolved symbol keybytes
src/caesium/crypto/shorthash.clj:8:15: error: unresolved symbol primitive
src/caesium/crypto/shorthash.clj:11:12: error: unresolved symbol keygen
src/caesium/crypto/shorthash.clj:20:12: error: unresolved symbol shorthash
src/caesium/crypto/sign.clj:6:15: error: unresolved symbol bytes
src/caesium/crypto/sign.clj:6:21: error: unresolved symbol seedbytes
src/caesium/crypto/sign.clj:6:31: error: unresolved symbol publickeybytes
src/caesium/crypto/sign.clj:6:46: error: unresolved symbol secretkeybytes
src/caesium/crypto/sign.clj:6:61: error: unresolved symbol primitive
src/caesium/crypto/sign.clj:17:15: error: unresolved symbol sign-keypair
src/caesium/crypto/sign.clj:23:15: error: unresolved symbol sign-seed-keypair
src/caesium/crypto/sign.clj:34:12: error: unresolved symbol sign
src/caesium/crypto/sign.clj:51:12: error: unresolved symbol sign-detached
src/caesium/crypto/sign.clj:74:23: error: unresolved symbol sign-open
src/caesium/crypto/sign.clj:82:23: error: unresolved symbol sign-verify-detached
src/caesium/util.clj:6:23: warning: Unused import Arrays
test/caesium/binding_test.clj:7:38: warning: Unused import Type
test/caesium/binding_test.clj:7:43: warning: Unused import AnnotatedElement
test/caesium/binding_test.clj:8:33: warning: Unused import In
test/caesium/binding_test.clj:8:36: warning: Unused import Out
test/caesium/byte_bufs_test.clj:3:35: warning: #'clojure.test/deftest is referred but never used
test/caesium/byte_bufs_test.clj:17:10: error: unresolved symbol ->indirect-byte-buf-spec
test/caesium/byte_bufs_test.clj:20:5: error: unresolved symbol n
test/caesium/byte_bufs_test.clj:21:5: error: unresolved symbol g
test/caesium/byte_bufs_test.clj:24:24: error: unresolved symbol src
test/caesium/byte_bufs_test.clj:24:40: error: unresolved symbol buf
test/caesium/byte_bufs_test.clj:30:10: error: unresolved symbol ->direct-byte-buf-spec
test/caesium/byte_bufs_test.clj:43:10: error: unresolved symbol buflen-spec
test/caesium/byte_bufs_test.clj:50:10: error: unresolved symbol slice-buflen-spec
test/caesium/byte_bufs_test.clj:54:5: error: unresolved symbol start
test/caesium/byte_bufs_test.clj:55:5: error: unresolved symbol end
test/caesium/byte_bufs_test.clj:59:10: error: unresolved symbol wrapped-array-buflen-spec
test/caesium/byte_bufs_test.clj:65:7: error: unresolved symbol slicelen
test/caesium/byte_bufs_test.clj:70:10: error: unresolved symbol alloc-spec
test/caesium/crypto/aead_test.clj:118:34: warning: Unresolved namespace clojure.string. Are you missing a require?
test/caesium/crypto/box_test.clj:6:14: warning: namespace caesium.util is required but never used
test/caesium/crypto/pwhash_test.clj:3:14: warning: namespace caesium.byte-bufs is required but never used
test/caesium/crypto/pwhash_test.clj:5:14: warning: namespace caesium.vectors is required but never used
test/caesium/crypto/pwhash_test.clj:7:14: warning: namespace caesium.randombytes is required but never used
test/caesium/crypto/pwhash_test.clj:8:35: warning: #'clojure.test/are is referred but never used
test/caesium/crypto/scalarmult/ristretto255_test.clj:9:35: warning: #'clojure.test/are is referred but never used
test/caesium/crypto/secretbox_test.clj:4:14: warning: namespace caesium.util is required but never used
test/caesium/crypto/shorthash_test.clj:3:38: warning: #'clojure.test/testing is referred but never used
test/caesium/crypto/sign_test.clj:5:46: warning: #'clojure.test/testing is referred but never used
test/caesium/crypto/sign_test.clj:16:10: warning: #'caesium.crypto.sign/generate-signing-keys is deprecated
test/caesium/crypto/sign_test.clj:46:15: warning: unused binding pk
test/caesium/crypto/sign_test.clj:57:15: warning: unused binding pk
test/caesium/magicnonce/secretbox_test.clj:7:14: warning: namespace caesium.util is required but never used
test/caesium/randombytes_test.clj:5:22: warning: Unused import ByteBuffer
linting took 990ms, errors: 233, warnings: 33
Error encountered performing task 'clj-kondo' with profile(s): 'base,system,user,provided,dev,test'
Suppressed exit

@codecov-commenter
Copy link

Codecov Report

Merging #74 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #74   +/-   ##
=======================================
  Coverage   98.44%   98.44%           
=======================================
  Files          21       21           
  Lines         967      967           
  Branches        4        4           
=======================================
  Hits          952      952           
  Misses         11       11           
  Partials        4        4           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9943006...8a8f9ad. Read the comment docs.

@eploko
Copy link
Contributor Author

eploko commented Oct 1, 2020

@lvh, what are your thoughts on whether we should remove eastwood or leave it intact in parallel to clj-kondo? My only concern is they may potentially be issuing conflicting set of linting warnings for some of the arguable cases like formatting.

@eploko
Copy link
Contributor Author

eploko commented Oct 1, 2020

I'll have a go at the issues reported by clj-kondo in a couple of days.

@lvh
Copy link
Owner

lvh commented Oct 1, 2020

I have no particular preference: I have never used them together, but I also have had good success with clj-kondo overall (though in this case the custom macro stuff we do does make it quite upset). Basically if someone will get the linter green I'm happy to take clj-kondo in and I'm willing to be swayed either way if eastwood should go (maybe it should).

@codecov-io
Copy link

codecov-io commented Oct 13, 2020

Codecov Report

Merging #74 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #74      +/-   ##
==========================================
+ Coverage   98.44%   98.47%   +0.02%     
==========================================
  Files          21       21              
  Lines         967      982      +15     
  Branches        4        4              
==========================================
+ Hits          952      967      +15     
  Misses         11       11              
  Partials        4        4              
Impacted Files Coverage Δ
src/caesium/util.clj 100.00% <ø> (ø)
src/caesium/binding.clj 96.49% <100.00%> (+0.06%) ⬆️
src/caesium/crypto/aead.clj 100.00% <100.00%> (ø)
src/caesium/crypto/auth.clj 100.00% <100.00%> (ø)
src/caesium/crypto/box.clj 100.00% <100.00%> (ø)
src/caesium/crypto/core/ristretto255.clj 100.00% <100.00%> (ø)
src/caesium/crypto/generichash.clj 97.14% <100.00%> (+0.08%) ⬆️
src/caesium/crypto/hash.clj 100.00% <100.00%> (ø)
src/caesium/crypto/kdf.clj 80.00% <100.00%> (+1.05%) ⬆️
src/caesium/crypto/kx.clj 100.00% <100.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9943006...b1d4a05. Read the comment docs.

@eploko
Copy link
Contributor Author

eploko commented Oct 13, 2020

Alright, the linters are now happily green. I guess there's no harm in having both eastwood and clj-kondo for linting. Anyway, any of them can easily be removed later if one becomes a pain to support.

On another note, I'd think about removing the || true postfix on the linter calls so a linting issue does fail the build.

@eploko
Copy link
Contributor Author

eploko commented Oct 13, 2020

I guess this is now ready for the review :)

@eploko eploko marked this pull request as ready for review October 13, 2020 03:29
#_{:clj-kondo/ignore [:unused-import]} In
#_{:clj-kondo/ignore [:unused-import]} Out
#_{:clj-kondo/ignore [:unused-import]} Pinned
#_{:clj-kondo/ignore [:unused-import]} LongLong]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a clj-kondo bug: these are used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, they are. I added the directives to make clj-kondo happy. I should probably revert that—that's a weird fix, you're right.

Skimming through the clj-kondo issues revealed clj-kondo/clj-kondo#911, which closely resembles the issue we have here. But the latest clj-kondo still gives the same unused import warnings.

I'll file an issue for our case in clj-kondo. Please stay tuned :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I just gave it a second thought trying to come up with an example illustrating the issue to submit to clj-kondo, and I reckon the errors reported are actually fine, given the way things are implemented in caesium and the way clj-kondo handles macro expansions.

First of all, clj-kondo only expands a small set of macros as outlined here: https://cljdoc.org/d/clj-kondo/clj-kondo/2020.09.09/doc/configuration#unrecognized-macros

And then, all of the In, Out, Pinned, and LongLong usages happen to be in a quoted list in caesium. In such form they are not bound to the imported symbols until they are later expanded in the defsodium macro.

So, clj-kondo, albeit being pretty naïve here, correctly complains the imports are not used.

I'm not sure what to do with this. Any ideas?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, OK, I think it's still a bug but I see your point that it's unreasonable to expect clj-kondo to fix this especially on short timeframes. I think this is good to go as is then?

@lvh
Copy link
Owner

lvh commented Nov 14, 2020

From borkdude in the slack:

borkdude  3:12 PM
@lvh if the macro is syntactically similar to a core one, then you can :lint-as but for this macro that doesn't apply. E.g. if defconsts was varargs like declare then :lint-as with clojure.core/declare would work.
The other way is to write a hook to rewrite your function call to multiple top-level defs or just declare .
3:13
The hook code for this macro would be pretty straightforward.
borkdude  3:20 PM
@lvh This works:

borkdude@MBP2019 /tmp $ cat foo.clj
(require '[foo.bar :as b])(b/defconst [a b c])a
b
cborkdude@MBP2019 /tmp $ cat .clj-kondo/config.edn
{:hooks {:analyze-call {foo.bar/defconst hooks.defconst/defconst}} }
borkdude@MBP2019 /tmp $ cat .clj-kondo/hooks/defconst.clj
(ns hooks.defconst
  (:require [clj-kondo.hooks-api :as api]))(defn defconst [{:keys [:node]}]
  (let [[_ vector-node] (:children node)
        const-nodes (:children vector-node)
        new-node (api/list-node (list* (api/token-node 'declare)
                                       const-nodes))]
    {:node (with-meta new-node
             (meta node))}))

(edited)

I think the cleanest way is to make defconsts take varargs and tell clj-kondo to lint it as declare, but this solution also works.

@eploko
Copy link
Contributor Author

eploko commented Nov 19, 2020

I’ll have a closer look at this in the coming days.

@eploko
Copy link
Contributor Author

eploko commented Jan 1, 2026

Whoa, time flies. It's been five years since I've dropped the ball on this one. I'm a bit occupied with other things nowadays and seemingly won't come back to this PR any time soon. :-(

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

Successfully merging this pull request may close these issues.

4 participants