Skip to content

New rule: error-to-raise-arguments-error #604

@jackfirth

Description

@jackfirth

Rule summary

The error function is easy to use in ways that violate Racket's error messages conventions. Most uses of it would be better off using raise-arguments-error. Resyntax should detect uses of error that are easy to migrate to raise-arguments-error.

Test case

#lang resyntax/test

test: "original code should be refactorable to new code"
--------------------
#lang racket
(define (foo low high)
  (unless (<= low high)
    (error 'foo "low should be less than high, ~a ~a" low high))
  (void))
====================
#lang racket
(define (foo low high)
  (unless (<= low high)
    (raise-arguments-error 'foo "low should be less than high" "low" low "high" high))
  (void))
--------------------

Metadata

Metadata

Assignees

Labels

autopilot-candidateThe Copilot Agent should attempt this during a scheduled Autopilot runnew lintIssues suggesting new lints or pull requests implementing new lints

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions