Skip to content

Commit

Permalink
Add install and cljdoc recipes, touch up contributing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahTheDuke committed May 8, 2024
1 parent adc9eda commit 17c8b84
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .clj-kondo/http-kit/http-kit/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

{:hooks
{:analyze-call {org.httpkit.server/with-channel httpkit.with-channel/with-channel}}}
16 changes: 16 additions & 0 deletions .clj-kondo/http-kit/http-kit/httpkit/with_channel.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(ns httpkit.with-channel
(:require [clj-kondo.hooks-api :as api]))

(defn with-channel [{node :node}]
(let [[request channel & body] (rest (:children node))]
(when-not (and request channel) (throw (ex-info "No request or channel provided" {})))
(when-not (api/token-node? channel) (throw (ex-info "Missing channel argument" {})))
(let [new-node
(api/list-node
(list*
(api/token-node 'let)
(api/vector-node [channel (api/vector-node [])])
request
body))]

{:node new-node})))
6 changes: 6 additions & 0 deletions build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@
(dd/deploy {:installer :remote
:artifact (b/resolve-path (:jar-file opts))
:pom-file (b/pom-path opts)})))

(defn install
"Install built jar to local maven repo"
[opts]
(b/install (make-opts opts))
(println "Installed version" lib version))
8 changes: 4 additions & 4 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ I am not a good writer but I have done my best to be thorough and helpful in the

## Code

Bug fixes, especially those with existing issues, are free game. Comment that you're attemping the fix so no one doubles up on the effort, and then go off. PRs are welcome and I am generally a quick reviewer.
Bug fixes, especially those with existing issues, are free game. Comment that you're attemping the fix so no one doubles up on the effort, and then go off. Small PRs are great and I am generally a quick reviewer.

If you have an idea for a new rule, please start with an issue so we can discuss it before you put in the effort. That way we can hash out names and options, and gutcheck obvious edge cases before diving into the work. Additionally, linking to existing blog posts, Stack Overflow answers, Clojureverse posts, or other places where a given rule has been discussed in public will help guide us to finding a community-based solution.

Once we've decided it's worth persuing, you'll need to follow these steps:

1) Use `clojure -M:new-rule -n GENRE/RULE-NAME` to create a stub rule file and test file and insert stub into default config file.
2) Fill out both appropriately, including doc strings.
3) Add the rule's fully-qualified name to `src/noahtheduke/splint.clj` in the second `:require` block in the right place.
4) Open `resources/config/default.edn` and move the new rule config to the right location in the file. Add a short description of the rule to `:description` to help users when they auto-generate a `.splint.edn` file.
5) Run the full test suite with `clojure -M:dev:test:runner`, update the integration tests as necessary. Inspect their output if you wish to verify that the new rule works correctly.
3) Open `resources/config/default.edn` and move the new rule config to the right location in the file. Add a short description of the rule to `:description` to help users when they auto-generate a `.splint.edn` file.
4) Add the rule's fully-qualified name to `src/noahtheduke/splint.clj` in the second `:require` block in the right place.
5) Run the full test suite with `clojure -M:dev:test:runner`, updating the integration tests as necessary. Inspect their output if you wish to verify that the new rule works correctly.
16 changes: 16 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,19 @@ set-version version:
clojure -T:build uber
echo 'Deploying to clojars'
just clojars

install:
clojure -T:build jar
clojure -T:build install

cljdoc:
docker run --rm \
--volume $(pwd):{{invocation_directory_native()}} \
--volume "$HOME/.m2:/root/.m2" \
--volume /tmp/cljdoc:/app/data \
--entrypoint clojure \
cljdoc/cljdoc -Sforce -M:cli ingest \
--project io.github.noahtheduke/splint \
--version {{current_version}} \
--git {{invocation_directory_native()}} \
--rev $(git rev-parse HEAD)

0 comments on commit 17c8b84

Please sign in to comment.