From f894a1a9120a77954d8b9235198d183982fbc8cd Mon Sep 17 00:00:00 2001 From: Erdos Balint Date: Mon, 20 Nov 2023 15:26:24 +0900 Subject: [PATCH 1/6] Check for reflection, boxed math --- .github/workflows/reflection.yaml | 18 ++++++++++++++++++ src/sleepy/dog.clj | 8 ++++++++ 2 files changed, 26 insertions(+) create mode 100644 .github/workflows/reflection.yaml diff --git a/.github/workflows/reflection.yaml b/.github/workflows/reflection.yaml new file mode 100644 index 0000000..4664e2b --- /dev/null +++ b/.github/workflows/reflection.yaml @@ -0,0 +1,18 @@ +name: lint + +on: push + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: delaguardo/setup-clojure@12.1 + with: + lein: 2.10.0 + + - name: Run check + run: lein check \ No newline at end of file diff --git a/src/sleepy/dog.clj b/src/sleepy/dog.clj index 26f07ec..0f35950 100644 --- a/src/sleepy/dog.clj +++ b/src/sleepy/dog.clj @@ -8,6 +8,14 @@ (set! *warn-on-reflection* true) (set! *unchecked-math* :warn-on-boxed) +(defn box + [x] + (+ 1 x)) + +(defn reflect + [x] + (.activeSpan x)) + (defn set-resource! [^String reg-name] (let [tracer (GlobalTracer/get) From 44467d3dbeb50eebfc55c156589d3a4d406f45d2 Mon Sep 17 00:00:00 2001 From: Erdos Balint Date: Mon, 20 Nov 2023 15:28:54 +0900 Subject: [PATCH 2/6] lein check exits 0 even if there are problems --- .github/workflows/reflection.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/reflection.yaml b/.github/workflows/reflection.yaml index 4664e2b..ad6e51f 100644 --- a/.github/workflows/reflection.yaml +++ b/.github/workflows/reflection.yaml @@ -15,4 +15,9 @@ jobs: lein: 2.10.0 - name: Run check - run: lein check \ No newline at end of file + run: | + result=$(lein check 2> >(grep --line-buffered -P 'Reflection warning, sleepy')) + if [[ $result ]]; then + echo "$result" + exit 1 + fi \ No newline at end of file From b2442302efd3f37ec25c14a9d341ae46e7bc6def Mon Sep 17 00:00:00 2001 From: Erdos Balint Date: Mon, 20 Nov 2023 15:29:30 +0900 Subject: [PATCH 3/6] Rename --- .github/workflows/reflection.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reflection.yaml b/.github/workflows/reflection.yaml index ad6e51f..afbf298 100644 --- a/.github/workflows/reflection.yaml +++ b/.github/workflows/reflection.yaml @@ -1,9 +1,9 @@ -name: lint +name: reflection on: push jobs: - lint: + reflection: runs-on: ubuntu-latest steps: From 29ade22aee4d5b8e006ff7999158e86e857ec5b8 Mon Sep 17 00:00:00 2001 From: Erdos Balint Date: Mon, 20 Nov 2023 15:31:08 +0900 Subject: [PATCH 4/6] Resolve debug reflection --- src/sleepy/dog.clj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/sleepy/dog.clj b/src/sleepy/dog.clj index 0f35950..8b5a201 100644 --- a/src/sleepy/dog.clj +++ b/src/sleepy/dog.clj @@ -12,10 +12,6 @@ [x] (+ 1 x)) -(defn reflect - [x] - (.activeSpan x)) - (defn set-resource! [^String reg-name] (let [tracer (GlobalTracer/get) From 845182b230a48d0cc54906d365912a6f0651babf Mon Sep 17 00:00:00 2001 From: Erdos Balint Date: Mon, 20 Nov 2023 15:31:15 +0900 Subject: [PATCH 5/6] Check for boxed math too --- .github/workflows/reflection.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reflection.yaml b/.github/workflows/reflection.yaml index afbf298..6f5d7e2 100644 --- a/.github/workflows/reflection.yaml +++ b/.github/workflows/reflection.yaml @@ -16,7 +16,7 @@ jobs: - name: Run check run: | - result=$(lein check 2> >(grep --line-buffered -P 'Reflection warning, sleepy')) + result=$(lein check 2> >(grep --line-buffered -P 'warning, sleepy')) if [[ $result ]]; then echo "$result" exit 1 From f834caa951d9bb9a9757ea0aaf3d5275230336ca Mon Sep 17 00:00:00 2001 From: Erdos Balint Date: Mon, 20 Nov 2023 15:32:17 +0900 Subject: [PATCH 6/6] Resolve debug boxed math --- src/sleepy/dog.clj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/sleepy/dog.clj b/src/sleepy/dog.clj index 8b5a201..26f07ec 100644 --- a/src/sleepy/dog.clj +++ b/src/sleepy/dog.clj @@ -8,10 +8,6 @@ (set! *warn-on-reflection* true) (set! *unchecked-math* :warn-on-boxed) -(defn box - [x] - (+ 1 x)) - (defn set-resource! [^String reg-name] (let [tracer (GlobalTracer/get)