Skip to content

Commit 2374343

Browse files
vemvbbatsov
authored andcommitted
Add :safe declarations
Context: #495 (comment)
1 parent 526d78e commit 2374343

File tree

1 file changed

+58
-28
lines changed

1 file changed

+58
-28
lines changed

clj-refactor.el

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@
5555
(defcustom cljr-add-ns-to-blank-clj-files t
5656
"If t, automatically add a ns form to new .clj files."
5757
:group 'cljr
58-
:type 'boolean)
58+
:type 'boolean
59+
:safe #'booleanp)
5960

6061
(defcustom cljr-auto-sort-ns t
6162
"If t, sort ns form after any command that changes it."
6263
:group 'cljr
63-
:type 'boolean)
64+
:type 'boolean
65+
:safe #'booleanp)
6466

6567
(defcustom cljr-magic-requires t
6668
"Whether to automatically require common namespaces when they are used.
@@ -85,64 +87,75 @@ Any other non-nil value means to add the form without asking."
8587
"Alist of aliases and namespaces used by `cljr-slash'."
8688
:type '(repeat (cons (string :tag "Short alias")
8789
(string :tag "Full namespace")))
90+
:safe #'listp
8891
:group 'cljr)
8992

9093
(defcustom cljr-project-clean-prompt t
9194
"If t, `cljr-project-clean' asks before doing anything.
9295
If nil, the project clean functions are run without warning."
9396
:group 'cljr
94-
:type 'boolean)
97+
:type 'boolean
98+
:safe #'booleanp)
9599

96100
(defcustom cljr-project-clean-functions
97101
(list #'cljr-clean-ns)
98102
"List of functions called by `cljr-project-clean'.
99103
These are called on all .clj files in the project."
100104
:group 'cljr
101-
:type '(repeat function))
105+
:type '(repeat function)
106+
:safe #'listp)
102107

103108
(defcustom cljr-project-clean-exceptions '("dev/user.clj" "project.clj" "boot.clj")
104109
"A list of files that `cljr-project-clean' should avoid."
105110
:group 'cljr
106-
:type '(repeat string))
111+
:type '(repeat string)
112+
:safe #'listp)
107113

108114
(defcustom cljr-hotload-dependencies nil
109115
"If t, newly added dependencies are also hotloaded into the repl.
110116
This only applies to dependencies added by `cljr-add-project-dependency'."
111117
:group 'cljr
112-
:type 'boolean)
118+
:type 'boolean
119+
:safe #'booleanp)
113120

114121
(defcustom cljr-favor-private-functions t
115122
"If t, refactorings insert private function declarations."
116123
:group 'cljr
117-
:type 'boolean)
124+
:type 'boolean
125+
:safe #'booleanp)
118126

119127
(defcustom cljr-favor-prefix-notation nil
120128
"If t, `cljr-clean-ns' favors prefix notation in the ns form."
121129
:group 'cljr
122-
:type 'boolean)
130+
:type 'boolean
131+
:safe #'booleanp)
123132

124133
(defcustom cljr-insert-newline-after-require t
125134
"If t, `cljr-clean-ns' will place a newline after the `:require` and `:import` tokens."
126135
:group 'cljr
127-
:type 'boolean)
136+
:type 'boolean
137+
:safe #'booleanp)
128138

129139
(defcustom cljr-use-multiple-cursors t
130140
"If t, some refactorings use the `multiple-cursors' package.
131141
This improves interactivity of the commands. If nil, those
132142
refactorings will use regular prompts instead."
133143
:group 'cljr
134-
:type 'boolean)
144+
:type 'boolean
145+
:safe #'booleanp)
135146

136147
(defcustom cljr-auto-clean-ns t
137148
"If t, call `cljr-clean-ns' after commands that change the ns."
138149
:group 'cljr
139-
:type 'boolean)
150+
:type 'boolean
151+
:safe #'booleanp)
140152

141153
(defcustom cljr-populate-artifact-cache-on-startup t
142154
"If t, the middleware will eagerly populate the artifact cache.
143155
This makes `cljr-add-project-dependency' as snappy as can be."
144156
:group 'cljr
145-
:type 'boolean)
157+
:type 'boolean
158+
:safe #'booleanp)
146159

147160
(defcustom cljr-warn-on-eval t
148161
"If t, warn the user before running any op that requires ASTs to be built
@@ -151,26 +164,30 @@ This makes `cljr-add-project-dependency' as snappy as can be."
151164
so if this is on the AST cache is not warmed at startup or after certain
152165
operations."
153166
:group 'cljr
154-
:type 'boolean)
167+
:type 'boolean
168+
:safe #'booleanp)
155169

156170
(defcustom cljr-eagerly-build-asts-on-startup t
157171
"If t, the middleware will eagerly populate the ast cache.
158172
This makes `cljr-find-usages' and `cljr-rename-symbol' as snappy
159173
as can be."
160174
:group 'cljr
161-
:type 'boolean)
175+
:type 'boolean
176+
:safe #'booleanp)
162177

163178
(defcustom cljr-suppress-middleware-warnings nil
164179
"If t, no middleware warnings are printed to the repl."
165180
:group 'cljr
166-
:type 'boolean)
181+
:type 'boolean
182+
:safe #'booleanp)
167183

168184
(defcustom cljr-suppress-no-project-warning nil
169185
"If t, no warning is printed when starting a REPL outside a project.
170186
By default, a warning is printed in this case since clj-refactor
171187
will not work as expected in such REPLs."
172188
:group 'cljr
173-
:type 'boolean)
189+
:type 'boolean
190+
:safe #'booleanp)
174191

175192
(defcustom cljr-ignore-analyzer-errors nil
176193
"If t, `cljr-find-usages' `cljr-inline-symbol' `cljr-rename-symbol'
@@ -182,58 +199,68 @@ namespaces which can be analyzed.
182199
If nil, `cljr-find-usages' `cljr-inline-symbol' `cljr-rename-symbol'
183200
won't run if there is a broken namespace in the project."
184201
:group 'cljr
185-
:type 'boolean)
202+
:type 'boolean
203+
:safe #'booleanp)
186204

187205
(define-obsolete-variable-alias 'cljr-find-usages-ignore-analyzer-errors 'cljr-ignore-analyzer-errors "2.3.0")
188206

189207
(defcustom cljr-auto-eval-ns-form t
190208
"When true refactorings which change the ns form also trigger
191209
its re-evaluation."
192210
:group 'cljr
193-
:type 'boolean)
211+
:type 'boolean
212+
:safe #'booleanp)
194213

195214
(defcustom cljr-midje-test-declaration "[midje.sweet :as midje]"
196215
"The require form to use when midje is in use."
197216
:group 'cljr
198-
:type 'string)
217+
:type 'string
218+
:safe #'stringp)
199219

200220
(defcustom cljr-expectations-test-declaration "[expectations :as e]"
201221
"The require form to use when expectations is in use."
202222
:group 'cljr
203-
:type 'string)
223+
:type 'string
224+
:safe #'stringp)
204225

205226
(defcustom cljr-cljc-clojure-test-declaration "#?(:clj [clojure.test :as t]
206227
:cljs [cljs.test :as t :include-macros true])"
207228
"The require form to use when clojure.test and cljs.test is in use in a cljc file."
208229
:group 'cljr
209-
:type 'string)
230+
:type 'string
231+
:safe #'stringp)
210232

211233
(defcustom cljr-cljs-clojure-test-declaration "[cljs.test :as t :include-macros true]"
212234
"The require form to use when cljs.test is in use in a cljs file."
213235
:group 'cljr
214-
:type 'string)
236+
:type 'string
237+
:safe #'stringp)
215238

216239
(defcustom cljr-clojure-test-declaration "[clojure.test :as t]"
217240
"The require form to use when clojure.test is in use in a clj file."
218241
:group 'cljr
219-
:type 'string)
242+
:type 'string
243+
:safe #'stringp)
220244

221245
(defcustom cljr-clojure-test-namespace-under-test-alias "sut"
222246
"The package alias to use for the namespace under test."
223247
:group 'cljr
224-
:type 'string)
248+
:type 'string
249+
:safe #'stringp)
225250

226251
(defcustom cljr-inject-dependencies-at-jack-in t
227252
"When nil, do not inject repl dependencies (most likely nREPL middlewares) at `cider-jack-in' time."
228253
:group 'cljr
229-
:type 'boolean)
254+
:type 'boolean
255+
:safe #'booleanp)
230256

231257
(defcustom cljr-assume-language-context nil
232258
"If set to 'clj' or 'cljs', clj-refactor will use that value in situations
233259
where the language context is ambiguous. If set to nil, a popup will be
234260
created in each ambiguous case asking user to choose language context."
235261
:group 'cljr
236-
:type 'string)
262+
:type 'string
263+
:safe #'stringp)
237264

238265
(defcustom cljr-libspec-whitelist
239266
'("^cljsns" "^slingshot.test" "^monger.joda-time" "^monger.json")
@@ -242,7 +269,8 @@ won't run if there is a broken namespace in the project."
242269
This is useful when `clean-ns' should leave a libspec alone even
243270
if it appears to be unused."
244271
:group 'cljr
245-
:type '(repeat string))
272+
:type '(repeat string)
273+
:safe #'listp)
246274

247275
(defvar cljr-minimum-clojure-version "1.8.0"
248276
"The oldest Clojure version supported by our middleware.")
@@ -290,7 +318,8 @@ if it appears to be unused."
290318
"List of (Java style) regexes to paths that should be ignored
291319
by the middleware."
292320
:group 'cljr
293-
:type '(repeat string))
321+
:type '(repeat string)
322+
:safe #'listp)
294323

295324
;;; Buffer Local Declarations
296325

@@ -3258,6 +3287,7 @@ If customizing it, you most likely should `(setq cljr-suppress-middleware-warnin
32583287
for avoiding a warning that would be irrelevant for this case."
32593288
:group 'cljr
32603289
:type 'string
3290+
:safe #'stringp
32613291
:package-version "3.0.0")
32623292

32633293
(defun cljr--middleware-version ()

0 commit comments

Comments
 (0)