-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automated Resyntax fixes #688
Conversation
This is an automated change generated by Resyntax. #### Pass 1 Applied 17 fixes to [`drracket-tool-text-lib/drracket/private/syncheck/traversals.rkt`](../blob/HEAD/drracket-tool-text-lib/drracket/private/syncheck/traversals.rkt) * Line 3, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. * Line 51, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. * Line 684, `hash-set!-ref-to-hash-update!`: This expression can be replaced with a simpler, equivalent `hash-update!` expression. * Line 713, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. * Line 728, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. * Line 771, `nested-for-to-for*`: These nested `for` loops can be replaced by a single `for*` loop. * Line 785, `nested-for-to-for*`: These nested `for` loops can be replaced by a single `for*` loop. * Line 835, `nested-for-to-for*`: These nested `for` loops can be replaced by a single `for*` loop. * Line 906, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. * Line 972, `if-else-false-to-and`: This `if` expression can be refactored to an equivalent expression using `and`. * Line 1074, `if-else-false-to-and`: This `if` expression can be refactored to an equivalent expression using `and`. * Line 1098, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. * Line 1129, `when-expression-in-for-loop-to-when-keyword`: Use the `#:when` keyword instead of `when` to reduce loop body indentation. * Line 1275, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. * Line 1366, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. * Line 1424, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. * Line 1451, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. Applied 2 fixes to [`drracket/setup/plt-installer-unit.rkt`](../blob/HEAD/drracket/setup/plt-installer-unit.rkt) * Line 2, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. * Line 44, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. Applied 1 fix to [`drracket/repo-time-stamp/time-stamp.rkt`](../blob/HEAD/drracket/repo-time-stamp/time-stamp.rkt) * Line 2, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. ## Summary Fixed 20 issues in 3 files. * Fixed 10 occurrences of `let-to-define` * Fixed 3 occurrences of `tidy-require` * Fixed 3 occurrences of `nested-for-to-for*` * Fixed 2 occurrences of `if-else-false-to-and` * Fixed 1 occurrence of `hash-set!-ref-to-hash-update!` * Fixed 1 occurrence of `when-expression-in-for-loop-to-when-keyword`
(define is-module? | ||
(syntax-case sexp (module) | ||
[(module . rest | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking a close paren on its own line isn't intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely not intentional. Looks like a fmt
bug, cc @sorawee.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so the issue is that fmt
thinks that this is a normal module
formatting, so .
is the module name and rest
is the module path. The body is missing, so it places the close paren there.
This issue would affect virtually all forms as well. It's not specific to module
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a heuristic that could work well, without requiring formatting rule writers to add more formatting handlers, is to see if a special form has .
or not. If there is one, then just treat the form as a function application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened sorawee/fmt#82 to track this problem.
[_ #f])) | ||
(cond | ||
[is-module? | ||
(let ([phase-to-binders (make-hash)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this let didn't go away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resyntax hit the 20 fix limit for the pull request and decided not to do any more work, I believe.
(define defs-text (current-annotations)) | ||
(when (and source defs-text (syntax-position stx) (syntax-span stx)) | ||
(let* ([pos-left (- (syntax-position stx) 1)] | ||
[pos-right (+ pos-left (syntax-span stx))]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could have been defines, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I think it's just the fix limit that prevented them from being refactored in this PR.
Closing this one because of sorawee/fmt#82. We'll get these files next time chief. |
This is an automated change generated by Resyntax.
Pass 1
Applied 17 fixes to
drracket-tool-text-lib/drracket/private/syncheck/traversals.rkt
tidy-require
: Keep imports inrequire
sorted and grouped by phase, with collections before files.let-to-define
: Internal definitions are recommended instead oflet
expressions, to reduce nesting.hash-set!-ref-to-hash-update!
: This expression can be replaced with a simpler, equivalenthash-update!
expression.let-to-define
: Internal definitions are recommended instead oflet
expressions, to reduce nesting.let-to-define
: Internal definitions are recommended instead oflet
expressions, to reduce nesting.nested-for-to-for*
: These nestedfor
loops can be replaced by a singlefor*
loop.nested-for-to-for*
: These nestedfor
loops can be replaced by a singlefor*
loop.nested-for-to-for*
: These nestedfor
loops can be replaced by a singlefor*
loop.let-to-define
: Internal definitions are recommended instead oflet
expressions, to reduce nesting.if-else-false-to-and
: Thisif
expression can be refactored to an equivalent expression usingand
.if-else-false-to-and
: Thisif
expression can be refactored to an equivalent expression usingand
.let-to-define
: Internal definitions are recommended instead oflet
expressions, to reduce nesting.when-expression-in-for-loop-to-when-keyword
: Use the#:when
keyword instead ofwhen
to reduce loop body indentation.let-to-define
: Internal definitions are recommended instead oflet
expressions, to reduce nesting.let-to-define
: Internal definitions are recommended instead oflet
expressions, to reduce nesting.let-to-define
: Internal definitions are recommended instead oflet
expressions, to reduce nesting.let-to-define
: Internal definitions are recommended instead oflet
expressions, to reduce nesting.Applied 2 fixes to
drracket/setup/plt-installer-unit.rkt
tidy-require
: Keep imports inrequire
sorted and grouped by phase, with collections before files.let-to-define
: Internal definitions are recommended instead oflet
expressions, to reduce nesting.Applied 1 fix to
drracket/repo-time-stamp/time-stamp.rkt
tidy-require
: Keep imports inrequire
sorted and grouped by phase, with collections before files.Summary
Fixed 20 issues in 3 files.
let-to-define
tidy-require
nested-for-to-for*
if-else-false-to-and
hash-set!-ref-to-hash-update!
when-expression-in-for-loop-to-when-keyword