|
12 | 12 | - [lint/dot-obj-method](#lintdot-obj-method) |
13 | 13 | - [lint/duplicate-case-test](#lintduplicate-case-test) |
14 | 14 | - [lint/duplicate-field-name](#lintduplicate-field-name) |
| 15 | +- [lint/existing-constant](#lintexisting-constant) |
15 | 16 | - [lint/fn-wrapper](#lintfn-wrapper) |
16 | 17 | - [lint/identical-branches](#lintidentical-branches) |
17 | 18 | - [lint/if-else-nil](#lintif-else-nil) |
|
30 | 31 | - [lint/misplaced-type-hint](#lintmisplaced-type-hint) |
31 | 32 | - [lint/missing-body-in-when](#lintmissing-body-in-when) |
32 | 33 | - [lint/no-catch](#lintno-catch) |
| 34 | +- [lint/no-op-assignment](#lintno-op-assignment) |
33 | 35 | - [lint/not-empty?](#lintnot-empty) |
34 | 36 | - [lint/prefer-method-values](#lintprefer-method-values) |
35 | 37 | - [lint/prefer-require-over-use](#lintprefer-require-over-use) |
@@ -288,6 +290,30 @@ with the same name, but it's good to catch these things early too. |
288 | 290 |
|
289 | 291 | --- |
290 | 292 |
|
| 293 | +## lint/existing-constant |
| 294 | + |
| 295 | +| Enabled by default | Safe | Autocorrect | Version Added | Version Updated | |
| 296 | +| ------------------ | ---- | ----------- | ------------- | --------------- | |
| 297 | +| true | true | false | <<next>> | <<next>> | |
| 298 | + |
| 299 | +**NOTE:** Requires Clojure version 1.11.0. |
| 300 | + |
| 301 | +Java has `PI` and `E` constants built-in, and `clojure.math` exposes them directly. Better to use them instead of poorly approximating them with vars. |
| 302 | + |
| 303 | +### Examples |
| 304 | + |
| 305 | +```clojure |
| 306 | +; avoid |
| 307 | +(def pi 3.14) |
| 308 | +(def e 2.718) |
| 309 | + |
| 310 | +; prefer |
| 311 | +clojure.math/PI |
| 312 | +clojure.math/E |
| 313 | +``` |
| 314 | + |
| 315 | +--- |
| 316 | + |
291 | 317 | ## lint/fn-wrapper |
292 | 318 |
|
293 | 319 | | Enabled by default | Safe | Autocorrect | Version Added | Version Updated | |
@@ -757,6 +783,24 @@ With the default style `:accept-finally`, both `catch` and `finally` clauses are |
757 | 783 |
|
758 | 784 | --- |
759 | 785 |
|
| 786 | +## lint/no-op-assignment |
| 787 | + |
| 788 | +| Enabled by default | Safe | Autocorrect | Version Added | Version Updated | |
| 789 | +| ------------------ | ---- | ----------- | ------------- | --------------- | |
| 790 | +| true | true | false | <<next>> | <<next>> | |
| 791 | + |
| 792 | +If the bind is a symbol and the expr is the same symbol, just use the expr directly. (Otherwise, indicates a potential bug.) |
| 793 | + |
| 794 | +### Examples |
| 795 | + |
| 796 | +```clojure |
| 797 | +; avoid |
| 798 | +(let [foo foo] |
| 799 | + ...) |
| 800 | +``` |
| 801 | + |
| 802 | +--- |
| 803 | + |
760 | 804 | ## lint/not-empty? |
761 | 805 |
|
762 | 806 | | Enabled by default | Safe | Autocorrect | Version Added | Version Updated | |
|
0 commit comments