From aa2345d35cc026c2693f3bd46710e0f0c78a12eb Mon Sep 17 00:00:00 2001 From: Icaro Motta Date: Wed, 4 Oct 2023 19:06:54 +0000 Subject: [PATCH] Reduce Clojure linter warning noise (#17491) Change the make "lint" target default behavior to NOT show clj-kondo warnings. In the CI, I kept the same behavior, i.e. show all warnings and errors simultaneously. Motivation: When devs run make lint, most of the time, they don't want to see a long list of warnings. Their focus is on the errors. Additionally, the majority of devs in the mobile team see clj-kondo warnings in their editors of choice already. We (some of us) believe the editor feedback/warnings are sufficiently noisy. Add the following somewhere in your config files if you want to see warnings. export CLJ_LINTER_PRINT_WARNINGS=true --- Makefile | 5 +++-- ci/Jenkinsfile.tests | 2 +- shadow-cljs.edn | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1076c5debf..d3abd7bc16 100644 --- a/Makefile +++ b/Makefile @@ -309,10 +309,11 @@ $$(comm -23 <(sort <(git ls-files --cached --others --exclude-standard)) <(sort endef lint: export TARGET := clojure +lint: export CLJ_LINTER_PRINT_WARNINGS ?= false lint: ##@test Run code style checks @sh scripts/lint-re-frame-in-quo-components.sh && \ - sh scripts/lint-old-quo-usage.sh \ - clj-kondo --config .clj-kondo/config.edn --cache false --fail-level error --lint src && \ + sh scripts/lint-old-quo-usage.sh && \ + clj-kondo --config .clj-kondo/config.edn --cache false --fail-level error --lint src $(if $(filter $(CLJ_LINTER_PRINT_WARNINGS),true),,| grep -v ': warning: ') && \ ALL_CLOJURE_FILES=$(call find_all_clojure_files) && \ zprint '{:search-config? true}' -sfc $$ALL_CLOJURE_FILES && \ sh scripts/lint-trailing-newline.sh && \ diff --git a/ci/Jenkinsfile.tests b/ci/Jenkinsfile.tests index 7fe70c0d94..0c4eb0679f 100644 --- a/ci/Jenkinsfile.tests +++ b/ci/Jenkinsfile.tests @@ -48,7 +48,7 @@ pipeline { steps { sh """#!/bin/bash set -eo pipefail - make lint 2>&1 | tee ${LOG_FILE} + make lint CLJ_LINTER_PRINT_WARNINGS=true 2>&1 | tee ${LOG_FILE} """ } } diff --git a/shadow-cljs.edn b/shadow-cljs.edn index acc1096ec3..14876d4d7b 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -129,6 +129,7 @@ ;; needed because we use deref in tests :static-fns false :optimizations :simple + :warnings {:fn-deprecated false} :infer-externs true}} ;; mock.js-dependencies is mocking the react-native libraries