Skip to content

Commit cb0685f

Browse files
committed
STY: move RET505 and RET506 to permanently ignored rules
1 parent 5d1b667 commit cb0685f

2 files changed

Lines changed: 6 additions & 32 deletions

File tree

‎.ruff.toml‎

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,13 @@ lint.unfixable = [
228228
"astropy/config/*" = [
229229
"PTH114", # os-path-islink
230230
"PTH206", # Replace `.split(os.sep)` with `Path.parts`
231-
"RET505", # superfluous-else-return
232-
"RET506", # superfluous-else-raise
233231
]
234232
"astropy/constants/*" = [
235233
"N817", # camelcase-imported-as-acronym
236234
"RET505", # superfluous-else-return
237235
]
238236
"astropy/convolution/*" = [
239237
"PLR0911", # too-many-return-statements
240-
"RET505", # superfluous-else-return
241-
"RET506", # superfluous-else-raise
242238
]
243239
"astropy/coordinates/*" = [
244240
"DTZ007", # call-datetime-strptime-without-zone
@@ -247,17 +243,13 @@ lint.unfixable = [
247243
"astropy/cosmology/*" = [
248244
"C408", # unnecessary-collection-call
249245
"PT019", # pytest-fixture-param-without-value
250-
"RET505", # superfluous-else-return
251-
"RET506", # superfluous-else-raise
252246
]
253247
"astropy/io/*" = [
254248
"G001", # logging-string-format
255249
"G004", # logging-f-string
256250
"PLR0911", # too-many-return-statements
257251
"PTH116", # os-stat
258252
"PTH117", # os-path-isabs
259-
"RET505", # superfluous-else-return
260-
"RET506", # superfluous-else-raise
261253
"SLOT000", # Subclasses of `str` should define `__slots__`
262254
"TD005", # Missing issue description after `TODO`
263255
"TRY400", # error-instead-of-exception
@@ -266,76 +258,52 @@ lint.unfixable = [
266258
"astropy/logger.py" = ["C408", "RET505"]
267259
"astropy/modeling/*" = [
268260
"PLR0911", # too-many-return-statements
269-
"RET505", # superfluous-else-return
270-
"RET506", # superfluous-else-raise
271261
"SLOT001", # Subclasses of `tuple` should define `__slots__`
272262
"TRY300", # Consider `else` block
273263
]
274264
"astropy/nddata/*" = [
275265
"C408",
276-
"RET505", # superfluous-else-return
277-
"RET506", # superfluous-else-raise
278266
]
279267
"astropy/samp/*" = [
280-
"RET505", # superfluous-else-return
281-
"RET506", # superfluous-else-raise
282268
]
283269
"astropy/stats/*" = [
284270
"PLR0911", # too-many-return-statements
285-
"RET505", # superfluous-else-return
286-
"RET506", # superfluous-else-raise
287271
]
288272
"astropy/table/*" = [
289-
"RET505", # superfluous-else-return
290-
"RET506", # superfluous-else-raise
291273
"S605", # Starting a process with a shell, possible injection detected
292274
"TRY300", # Consider `else` block
293275
]
294276
"astropy/tests/*" = ["C408", "RET505"]
295277
"astropy/time/*" = [
296278
"FIX003", # Line contains XXX. replace XXX with TODO
297279
"PIE794", # duplicate-class-field-definition
298-
"RET505", # superfluous-else-return
299-
"RET506", # superfluous-else-raise
300280
]
301281
"astropy/timeseries/*" = [
302282
"PLR0911", # too-many-return-statements
303-
"RET505", # superfluous-else-return
304-
"RET506", # superfluous-else-raise
305283
]
306284
"astropy/units/*" = [
307285
"F821", # undefined-name
308286
"N812", # lowercase-imported-as-non-lowercase
309287
"PLR0911", # too-many-return-statements
310-
"RET505", # superfluous-else-return
311-
"RET506", # superfluous-else-raise
312288
"TRY300", # Consider `else` block
313289
]
314290
"astropy/uncertainty/*" = [
315291
"C408",
316-
"RET505", # superfluous-else-return
317-
"RET506", # superfluous-else-raise
318292
]
319293
"astropy/utils/*" = [
320294
"N811", # constant-imported-as-non-constant
321295
"PLR0911", # too-many-return-statements
322-
"RET505", # superfluous-else-return
323-
"RET506", # superfluous-else-raise
324296
"S321", # Suspicious-ftp-lib-usage
325297
"TRY300", # Consider `else` block
326298
]
327299
"astropy/visualization/*" = [
328300
"B015",
329301
"PLR0911", # too-many-return-statements
330-
"RET505", # superfluous-else-return
331-
"RET506", # superfluous-else-raise
332302
]
333303
"astropy/wcs/*" = [
334304
"C408", # unnecessary-collection-call
335305
"F821", # undefined-name
336306
"S608", # Posslibe SQL injection
337-
"RET505", # superfluous-else-return
338-
"RET506", # superfluous-else-raise
339307
"SIM202", # NegateNotEqualOp
340308
"TRY300", # Consider `else` block
341309
]

‎pyproject.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,12 @@ lint.ignore = [ # NOTE: non-permanent exclusions should be added to `.ruff.toml
375375
# flake8-todos (TD)
376376
"TD002", # Missing author in TODO
377377

378+
# flake8-return (RET)
379+
# RET can sometimes help find places where refactoring is very helpful,
380+
# but enforcing it everywhere might create undesirable churn
381+
"RET505", # superfluous-else-return
382+
"RET506", # superfluous-else-raise
383+
378384
# Ruff-specific rules (RUF)
379385
"RUF005", # unpack-instead-of-concatenating-to-collection-literal -- it's not clearly faster.
380386
]

0 commit comments

Comments
 (0)