Skip to content

Conversation

@jackfirth
Copy link
Contributor

This is just to test the Resyntax integration.

@jackfirth jackfirth closed this Sep 3, 2022
@jackfirth jackfirth reopened this Sep 3, 2022
This is just to test the Resyntax integration.
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 1 file in this pull request and has added suggestions.

Comment on lines +4 to +7
(define (distance x1 y1 x2 y2)
(let ([dx (- x1 x2)]
[dy (- y1 y2)])
(sqrt (+ (* dx dx) (* dy dy)))))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let-to-define: Internal definitions are recommended instead of let expressions, to reduce nesting.

Suggested change
(define (distance x1 y1 x2 y2)
(let ([dx (- x1 x2)]
[dy (- y1 y2)])
(sqrt (+ (* dx dx) (* dy dy)))))
(define (distance x1 y1 x2 y2)
(define dx (- x1 x2))
(define dy (- y1 y2))
(sqrt (+ (* dx dx) (* dy dy))))
Debugging details
Textual replacement
(line-replacement
  #:new-lines
    '#("(define (distance x1 y1 x2 y2)"
       "  (define dx (- x1 x2))"
       "  (define dy (- y1 y2))"
       "  (sqrt (+ (* dx dx) (* dy dy))))")
  #:original-lines
    '#("(define (distance x1 y1 x2 y2)"
       "  (let ([dx (- x1 x2)]"
       "        [dy (- y1 y2)])"
       "    (sqrt (+ (* dx dx) (* dy dy)))))")
  #:start-line 4)
Syntactic replacement
(syntax-replacement
  #:new-syntax
    #<syntax:/home/runner/.local/share/racket/snapshot/pkgs/resyntax/default-recommendations/let-binding-suggestions.rkt:44:3 (define (distance x1 y1 x2 y2) NEWLINE (define dx (- x1 x2)) NEWLINE (define dy (- y1 y2)) NEWLINE (sqrt (+ (* dx dx) (* dy dy))))>
  #:original-syntax
    #<syntax:typed-racket-lib/typed-racket/private/refactorable-code-example.rkt:4:0 (define (distance x1 y1 x2 y2) (let ((dx (- x1 x2)) (dy (- y1 y2))) (sqrt (+ (* dx dx) (* dy dy)))))>)

@jackfirth
Copy link
Contributor Author

It finally worked! Closing this now.

@jackfirth jackfirth closed this Sep 4, 2022
jackfirth added a commit to jackfirth/scribble that referenced this pull request Sep 8, 2022
This sets up Resyntax analysis on pull requests to this repo. Resyntax will analyze changed files and submit a review of the pull request containing its suggested changes. See [here](racket/typed-racket#1277) for an example.

The workflows are a copy of the workflows I made for Typed Racket. In the future we can make these workflows reusable so they don't have to be copied into every repository, but one step at a time.
jackfirth added a commit to jackfirth/scribble that referenced this pull request Sep 8, 2022
This sets up Resyntax analysis on pull requests to this repo. Resyntax will analyze changed files and submit a review of the pull request containing its suggested changes. See [here](racket/typed-racket#1277) for an example.

The workflows are a copy of the workflows I made for Typed Racket. In the future we can make these workflows reusable so they don't have to be copied into every repository, but one step at a time.
samth pushed a commit to racket/scribble that referenced this pull request Sep 10, 2022
This sets up Resyntax analysis on pull requests to this repo. Resyntax will analyze changed files and submit a review of the pull request containing its suggested changes. See [here](racket/typed-racket#1277) for an example.

The workflows are a copy of the workflows I made for Typed Racket. In the future we can make these workflows reusable so they don't have to be copied into every repository, but one step at a time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant