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
This commit is contained in:
Icaro Motta 2023-10-04 19:06:54 +00:00 committed by GitHub
parent b534b33a09
commit aa2345d35c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -309,10 +309,11 @@ $$(comm -23 <(sort <(git ls-files --cached --others --exclude-standard)) <(sort
endef endef
lint: export TARGET := clojure lint: export TARGET := clojure
lint: export CLJ_LINTER_PRINT_WARNINGS ?= false
lint: ##@test Run code style checks lint: ##@test Run code style checks
@sh scripts/lint-re-frame-in-quo-components.sh && \ @sh scripts/lint-re-frame-in-quo-components.sh && \
sh scripts/lint-old-quo-usage.sh \ sh scripts/lint-old-quo-usage.sh && \
clj-kondo --config .clj-kondo/config.edn --cache false --fail-level error --lint src && \ 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) && \ ALL_CLOJURE_FILES=$(call find_all_clojure_files) && \
zprint '{:search-config? true}' -sfc $$ALL_CLOJURE_FILES && \ zprint '{:search-config? true}' -sfc $$ALL_CLOJURE_FILES && \
sh scripts/lint-trailing-newline.sh && \ sh scripts/lint-trailing-newline.sh && \

View File

@ -48,7 +48,7 @@ pipeline {
steps { steps {
sh """#!/bin/bash sh """#!/bin/bash
set -eo pipefail set -eo pipefail
make lint 2>&1 | tee ${LOG_FILE} make lint CLJ_LINTER_PRINT_WARNINGS=true 2>&1 | tee ${LOG_FILE}
""" """
} }
} }

View File

@ -129,6 +129,7 @@
;; needed because we use deref in tests ;; needed because we use deref in tests
:static-fns false :static-fns false
:optimizations :simple :optimizations :simple
:warnings {:fn-deprecated false}
:infer-externs true}} :infer-externs true}}
;; mock.js-dependencies is mocking the react-native libraries ;; mock.js-dependencies is mocking the react-native libraries