Bogdanp / racket-review

A linter for Racket.
BSD 3-Clause "New" or "Revised" License
41 stars 4 forks source link

How can I tell the linter to ignore a certain line or a certain warning? #14

Closed akocur closed 8 months ago

akocur commented 8 months ago

For example,

#lang sicp

(#%require rackunit)

(define (cons x y) (lambda (f) (f x y)))
(define (car z) (z (lambda (p q) p)))
(define (cdr z) (z (lambda (p q) q)))

(check-equal? (car (cons 2 3)) 2)
(check-equal? (cdr (cons 2 3)) 3)

linter tells me:

example.rkt:6:31:warning:identifier 'q' is never used example.rkt:7:29:warning:identifier 'p' is never used

However, q and p are needed when calling cons

Bogdanp commented 8 months ago

There’s currently no way to disable warnings per line, but you can avoid unused variable warnings by naming unused variables _ or by prefixing them with _.