fulcrologic / guardrails

Efficient, hassle-free function call validation with a concise inline syntax for clojure.spec and Malli
Eclipse Public License 2.0
237 stars 25 forks source link

Fix clj-kondo hooks, include them in jar #30

Closed imrekoszo closed 2 years ago

imrekoszo commented 2 years ago

Fixes #29 Also fixes the hooks themselves added in #28 so they also work for the multiple arity case and handle gspec symbols.

I haven't been able to properly verify the cljs build however so I'd appreciate someone double-checking that.

~Edit: it appears clojure -M:test:clj-tests fails at the moment with the new test, looking into it.~ Edit: fixed before merge

imrekoszo commented 2 years ago

jar contents:

#$ ~/opensource/guardrails ‹develop›
; glol -n 4
* 952fff1 - (HEAD -> develop, origin/develop) Fix clj-kondo hook for multiple arities (30 minutes ago) <Imre Kószó>
* bb95e5f - Include clj-kondo hooks in jar (35 minutes ago) <Imre Kószó>
* c0843b3 - (upstream/develop, upstream/HEAD) [maven-release-plugin] prepare for next development iteration (9 weeks ago) <Tony Kay>
* 29583a9 - (tag: guardrails-1.1.10) [maven-release-plugin] prepare release guardrails-1.1.10 (9 weeks ago) <Tony Kay>
#$ ~/opensource/guardrails ‹develop›
; jar tf target/guardrails-1.1.11-SNAPSHOT.jar
META-INF/
META-INF/MANIFEST.MF
clj-kondo.exports/
clj-kondo.exports/com.fulcrologic/
clj-kondo.exports/com.fulcrologic/guardrails/
clj-kondo.exports/com.fulcrologic/guardrails/com/
clj-kondo.exports/com.fulcrologic/guardrails/com/fulcrologic/
clj-kondo.exports/com.fulcrologic/guardrails/com/fulcrologic/guardrails/
com/
com/fulcrologic/
com/fulcrologic/guardrails/
com/fulcrologic/guardrails/impl/
com/fulcrologic/guardrails/stubs/
clj-kondo.exports/com.fulcrologic/guardrails/config.edn
clj-kondo.exports/com.fulcrologic/guardrails/com/fulcrologic/guardrails/clj_kondo_hooks.clj
com/fulcrologic/guardrails/impl/pro.cljc
com/fulcrologic/guardrails/impl/externs.cljc
com/fulcrologic/guardrails/impl/parser.clj
com/fulcrologic/guardrails/stubs/cljs_env.clj
com/fulcrologic/guardrails/stubs/ana_api.clj
com/fulcrologic/guardrails/core.cljc
com/fulcrologic/guardrails/utils.cljc
com/fulcrologic/guardrails/config.cljc
com/fulcrologic/guardrails/noop.cljc
com/fulcrologic/guardrails/registry.cljc
META-INF/maven/
META-INF/maven/com.fulcrologic/
META-INF/maven/com.fulcrologic/guardrails/
META-INF/maven/com.fulcrologic/guardrails/pom.xml
META-INF/maven/com.fulcrologic/guardrails/pom.properties
awkay commented 2 years ago

marked as draft...were you done?

imrekoszo commented 2 years ago

marked as draft...were you done?

Not yet, will mark it as ready when it's done.

imrekoszo commented 2 years ago

Stabilized tests, they now run through the kaocha cli:

#$ ~/opensource/guardrails ‹develop›
; clojure -Srepro -M:test:clj-tests
GUARDRAILS IS ENABLED. RUNTIME PERFORMANCE WILL BE AFFECTED.
Mode: :runtime  Async? false  Throw? true
Guardrails was enabled because the guardrails.enabled property is set to a (any) value.
Running tests for: (com.fulcrologic.guardrails.impl.externs-spec com.fulcrologic.guardrails.impl.parser-spec com.fulcrologic.guardrails.core-spec com.fulcrologic.guardrails.clj-kondo-hooks-test)

Testing com.fulcrologic.guardrails.clj-kondo-hooks-test

Testing com.fulcrologic.guardrails.core-spec
   loading config
     loads the config from the disk file
   Normal mode >defn macro
     PROVIDED: There is no config
       Emits a normal function
     PROVIDED: There is a free config
       Emits the free version
   General transformed functions
     fixed arity, recursive
     fixed arity, tail recusive
     vararg with no extra args
     vararg with extra args
     kwargs
     seq destructuring on vararg
     vararg of sequences

Testing com.fulcrologic.guardrails.impl.externs-spec
   extern-symbols

Testing com.fulcrologic.guardrails.impl.parser-spec
   parse-defn
   resolve-spec

Ran 8 tests containing 40 assertions.
0 failures, 0 errors.
imrekoszo commented 2 years ago

@awkay this should be ready to pull as far as I can tell, but please let me know if there's anything else you'd like me to check/change

imrekoszo commented 2 years ago

Tagging @MrEbbinghaus given this PR changes some hooks he added

MrEbbinghaus commented 2 years ago

Hey @imrekoszo,

Thank you for your work. I noticed that multi-arity >defn problem some weeks ago, but I hadn't the time to work on this.

Your changes look good to me.

awkay commented 2 years ago

Great, thanks