forked from jonase/eastwood
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linters.unused
: account for imported classes
Fixes jonase#210
- Loading branch information
Showing
8 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(ns testcases.unusednsimport.consumer1 | ||
;; This require is needed to properly import the record below | ||
(:require [testcases.unusednsimport.defrecord]) | ||
(:import (testcases.unusednsimport.defrecord A))) | ||
|
||
;; Exercises top-level forms: | ||
(A. 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(ns testcases.unusednsimport.consumer2 | ||
;; This require is needed to properly import the record below | ||
(:require [testcases.unusednsimport.defrecord]) | ||
(:import (testcases.unusednsimport.defrecord A))) | ||
|
||
;; Should be deemed unused: | ||
(comment | ||
(A. 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns testcases.unusednsimport.consumer3 | ||
;; This require is needed to properly import the record below | ||
(:require [testcases.unusednsimport.defrecord]) | ||
(:import (testcases.unusednsimport.defrecord A))) | ||
|
||
;; Exercises forms nested deep into arbitrary code: | ||
(defn sample [] | ||
(for [x [(A. 1)]] | ||
x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns testcases.unusednsimport.consumer4 | ||
;; This require is needed to properly import the record below | ||
(:require [testcases.unusednsimport.defrecord]) | ||
(:import (testcases.unusednsimport.defrecord A))) | ||
|
||
;; Exercises metadata: | ||
(defn ^A sample [] | ||
;; return nil (and not `(A.)` so that we are certain that only metadata is being exercised) | ||
nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(ns testcases.unusednsimport.consumer5 | ||
;; This require is needed to properly import the record below | ||
(:require [testcases.unusednsimport.defrecord]) | ||
(:import (testcases.unusednsimport.defrecord A))) | ||
|
||
;; Exercises simple defs: | ||
(def thing (A. 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(ns testcases.unusednsimport.defrecord) | ||
|
||
(defrecord A [a]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters