Skip to content

Commit

Permalink
Reduce Clojure linter warning noise (#17491)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ilmotta authored Oct 4, 2023
1 parent b534b33 commit aa2345d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion ci/Jenkinsfile.tests
Original file line number Diff line number Diff line change
Expand Up @@ -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}
"""
}
}
Expand Down
1 change: 1 addition & 0 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aa2345d

Please sign in to comment.