Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Allow rules to warn without fixing

Aperta
#601 0 commenti 1 reazione 1 assegnatario Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

autopilot-candidate

Currently, Resyntax will only comment on issues where it can produce a single unambiguous fix that resolves that issue. But some issues, such as the one mentioned in #483, are easy to detect but have no obvious fix. Resyntax should support writing such rules and including their warnings in resyntax analyze.

Several changes need to be made to support this. First, define-refactoring-rule should be extended with an option for declaring rules without fixes. Here's one possible syntax:

(define-refactoring-rule dont-do-that
  #:description "Don't do that"
  #:suggested-fixes none
  (bad-thing))

That is, there would be a #:suggested-fixes option which can take on the values none or one, and which defaults to one. Making the value a symbol (matched by datum) instead of a boolean makes it easy to extend this in the future to rules which offer a choice among multiple possible fixes.

The representation of refactoring rules and warnings would need to be updated to accommodate warnings that do not include suggested fixes. This would probably amount to resyntax analyze adjusting how it displays results to allow for results without fixes, and resyntax fix filtering out results to only those which have a suggested fix.

The resyntax/test language would need to be updated too. Currently it has no mechanism to test that a refactoring rule produces a result without checking that the result actually changes the input code. One possible approach could be to add a comment-only-test statement which uses options to assert that Resyntax comments on the code without changing it. Here's a possible syntax:

comment-only-test: "duplicate equality comparison"
---
(define a 5)
(equal? a a)
---
@inspect - (equal? a a)
@assertMatch equality-check-against-self

This would work similarly to the analysis-test statement, in that it would use @inspect (and optionally @within) to specify a subexpression to make assertions on. The assertion checks that a rule with a specific name warns about that subexpression without suggesting any fixes to it.

Lingua principale
Racket
Stelle
70
Fork
11
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di jackfirth/resyntax

Tutte le issue di jackfirth/resyntax

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.