From 43db106c67ffad9234df890db5b60d341c9d4fa6 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 9 Feb 2025 01:30:08 +0000 Subject: [PATCH 1/5] Fix 5 occurrences of `zero-comparison-to-positive?` This expression is equivalent to calling the `positive?` predicate. --- infra/make-index.rkt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/infra/make-index.rkt b/infra/make-index.rkt index 861def83f..78f0f7d37 100644 --- a/infra/make-index.rkt +++ b/infra/make-index.rkt @@ -141,9 +141,9 @@ [else (~r x #:precision 2)])) (define (bad-result? info) - (or (> (dict-ref info 'tests-crashed 0) 0) - (> (dict-ref info 'tests-unimproved 0) 0) - (> (dict-ref info 'tests-timeout 0) 0))) + (or (positive? (dict-ref info 'tests-crashed 0)) + (positive? (dict-ref info 'tests-unimproved 0)) + (positive? (dict-ref info 'tests-timeout 0)))) (define (print-rows infos #:name name) `((thead ((id ,(format "reports-~a" name)) (data-branch ,name)) @@ -165,7 +165,7 @@ (time ([data-unix ,(~a (field 'date-unix))]) ,(field 'date-short))) (td (time ([data-ms ,(~a (field 'speed))]) ,(format-time (field 'speed)))) (td ([title ,(field 'commit)]) ,(field 'branch)) - (td ,(if (> (field 'tests-available) 0) + (td ,(if (positive? (field 'tests-available)) (format "~a/~a" (field 'tests-passed) (field 'tests-available)) "")) (td ,(if (field 'bits-improved) @@ -191,7 +191,7 @@ (partition (λ (x) (set-member? '("master" "develop" "main") (dict-ref (first x) 'branch))) branch-infos)) - (define crashes (filter (λ (x) (> (dict-ref x 'tests-crashed) 0)) (apply append mainline-infos))) + (define crashes (filter (λ (x) (positive? (dict-ref x 'tests-crashed))) (apply append mainline-infos))) (define last-crash (if (null? crashes) #f From 18e3f9a3eb8ddefd866d225b0d6caafd250977aa Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 9 Feb 2025 01:30:08 +0000 Subject: [PATCH 2/5] Fix 1 occurrence of `apply-append-for-loop-to-for-loop` Instead of using `(apply append ...)` to flatten a list of lists, consider using `for*/list` to flatten the list. --- infra/make-index.rkt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/infra/make-index.rkt b/infra/make-index.rkt index 78f0f7d37..d9d2b09c8 100644 --- a/infra/make-index.rkt +++ b/infra/make-index.rkt @@ -231,9 +231,9 @@ (script "window.addEventListener('load', function(){draw_results(d3.select('#accuracy-graph'), d3.select('#speed-graph'))})")) (table ((id "reports")) - ,@(apply append - (for/list ([rows (append mainline-infos other-infos)]) - (print-rows rows #:name (dict-ref (first rows) 'branch))))))) + ,@(for*/list ([rows (append mainline-infos other-infos)] + [v (in-list (print-rows rows #:name (dict-ref (first rows) 'branch)))]) + v)))) out)) (define (get-reports file base) From 22adb556227b430f6f87acb82866450bd30cf91d Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 9 Feb 2025 01:30:08 +0000 Subject: [PATCH 3/5] Fix 1 occurrence of `let-to-define` Internal definitions are recommended instead of `let` expressions, to reduce nesting. --- infra/merge.rkt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/infra/merge.rkt b/infra/merge.rkt index 9bb01544f..eb6a38944 100644 --- a/infra/merge.rkt +++ b/infra/merge.rkt @@ -42,11 +42,11 @@ (filter (conjoin (negate eof-object?) identity) (for/list ([dir (in-list dirs)]) (with-handlers ([exn? (const #f)]) - (let ([df (call-with-input-file (build-path outdir dir "results.json") - read-datafile)]) - (if (eof-object? df) - eof - (cons df dir))))))) + (define df + (call-with-input-file (build-path outdir dir "results.json") read-datafile)) + (if (eof-object? df) + eof + (cons df dir)))))) (define dfs (map car rss)) (define joint-rs (merge-datafiles dfs #:dirs dirs)) (write-datafile (build-path outdir "results.json") joint-rs) From e577052eed2c210dc9b9d0387808a7f20561a289 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 9 Feb 2025 01:30:08 +0000 Subject: [PATCH 4/5] Fix 1 occurrence of `if-else-false-to-and` This `if` expression can be refactored to an equivalent expression using `and`. --- infra/ci.rkt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/infra/ci.rkt b/infra/ci.rkt index fb0f75b50..c4aed40e5 100644 --- a/infra/ci.rkt +++ b/infra/ci.rkt @@ -67,9 +67,7 @@ (define success? (test-successful? test (errors-score start-error) - (if target-error - (errors-score target-error) - #f) + (and target-error (errors-score target-error)) (errors-score end-error))) (when (not success?) From 25c786e8114c5b6bbcbd34472d86df1838db1e6d Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 9 Feb 2025 01:30:08 +0000 Subject: [PATCH 5/5] Fix 1 occurrence of `inverted-when` This negated `when` expression can be replaced by an `unless` expression. --- infra/ci.rkt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infra/ci.rkt b/infra/ci.rkt index c4aed40e5..dc18f9176 100644 --- a/infra/ci.rkt +++ b/infra/ci.rkt @@ -70,12 +70,12 @@ (and target-error (errors-score target-error)) (errors-score end-error))) - (when (not success?) + (unless success? (printf "\nInput (~a bits):\n" (errors-score start-error)) (pretty-print (alt-expr start-alt) (current-output-port) 1) (printf "\nOutput (~a bits):\n" (errors-score end-error)) (pretty-print (alt-expr end-alt) (current-output-port) 1) - + (when target-error (printf "\nTarget (~a bits):\n" (errors-score target-error)) ;; internal tool so okay