Skip to content

Conversation

resyntax-ci[bot]
Copy link
Contributor

@resyntax-ci resyntax-ci bot commented Oct 27, 2024

This is an automated change generated by Resyntax.

Pass 1

Applied 4 fixes to drracket/help/bug-report.rkt

  • Line 2, tidy-require: Keep imports in require sorted and grouped by phase, with collections before files.
  • Line 52, cond-let-to-cond-define: Internal definitions are recommended instead of let expressions, to reduce nesting.
  • Line 262, if-begin-to-cond: Using cond instead of if here makes begin unnecessary
  • Line 278, cond-let-to-cond-define: Internal definitions are recommended instead of let expressions, to reduce nesting.

Applied 9 fixes to drracket/help/private/bug-report-controls.rkt

  • Line 2, tidy-require: Keep imports in require sorted and grouped by phase, with collections before files.
  • Line 16, provide/contract-to-contract-out: The provide/contract form is a legacy form made obsolete by contract-out.
  • Line 64, let-to-define: Internal definitions are recommended instead of let expressions, to reduce nesting.
  • Line 154, let-to-define: Internal definitions are recommended instead of let expressions, to reduce nesting.
  • Line 256, map-to-for: This map operation can be replaced with a for/list loop.
  • Line 311, map-to-for: This map operation can be replaced with a for/list loop.
  • Line 327, map-to-for: This map operation can be replaced with a for/list loop.
  • Line 337, unused-definition: This definition is not used.
  • Line 371, let-to-define: Internal definitions are recommended instead of let expressions, to reduce nesting.

Applied 2 fixes to drracket/help/private/save-bug-report.rkt

  • Line 3, tidy-require: Keep imports in require sorted and grouped by phase, with collections before files.
  • Line 185, provide/contract-to-contract-out: The provide/contract form is a legacy form made obsolete by contract-out.

Summary

Fixed 15 issues in 3 files.

  • Fixed 3 occurrences of tidy-require
  • Fixed 3 occurrences of let-to-define
  • Fixed 3 occurrences of map-to-for
  • Fixed 2 occurrences of provide/contract-to-contract-out
  • Fixed 2 occurrences of cond-let-to-cond-define
  • Fixed 1 occurrence of unused-definition
  • Fixed 1 occurrence of if-begin-to-cond

This is an automated change generated by Resyntax.

#### Pass 1

Applied 4 fixes to [`drracket/help/bug-report.rkt`](../blob/HEAD/drracket/help/bug-report.rkt)

  * Line 2, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.
  * Line 52, `cond-let-to-cond-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting.
  * Line 262, `if-begin-to-cond`: Using `cond` instead of `if` here makes `begin` unnecessary
  * Line 278, `cond-let-to-cond-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting.

Applied 9 fixes to [`drracket/help/private/bug-report-controls.rkt`](../blob/HEAD/drracket/help/private/bug-report-controls.rkt)

  * Line 2, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.
  * Line 16, `provide/contract-to-contract-out`: The `provide/contract` form is a legacy form made obsolete by `contract-out`.
  * Line 64, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting.
  * Line 154, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting.
  * Line 256, `map-to-for`: This `map` operation can be replaced with a `for/list` loop.
  * Line 311, `map-to-for`: This `map` operation can be replaced with a `for/list` loop.
  * Line 327, `map-to-for`: This `map` operation can be replaced with a `for/list` loop.
  * Line 337, `unused-definition`: This definition is not used.
  * Line 371, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting.

Applied 2 fixes to [`drracket/help/private/save-bug-report.rkt`](../blob/HEAD/drracket/help/private/save-bug-report.rkt)

  * Line 3, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.
  * Line 185, `provide/contract-to-contract-out`: The `provide/contract` form is a legacy form made obsolete by `contract-out`.

## Summary

Fixed 15 issues in 3 files.

  * Fixed 3 occurrences of `tidy-require`
  * Fixed 3 occurrences of `let-to-define`
  * Fixed 3 occurrences of `map-to-for`
  * Fixed 2 occurrences of `provide/contract-to-contract-out`
  * Fixed 2 occurrences of `cond-let-to-cond-define`
  * Fixed 1 occurrence of `unused-definition`
  * Fixed 1 occurrence of `if-begin-to-cond`
(message-box (string-constant illegal-bug-report)
(format (string-constant pls-fill-in-field) field-name))
(done-checking #f)))
(list name summary)
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I would write it like this:

(define (<f> field field-name)
  ...)

(<f> name (string-constant bug-report-field-name))
(<f> summary (string-constant bug-report-field-summary))

It's going to be difficult to come up with the name <f> though...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed, but yeah there's no easy way to automatically pick a name for <f> here.

Unless... I suppose... one could use an LLM to do that...

No. I will not walk down that dark road.

Copy link
Member

Choose a reason for hiding this comment

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

a for loop still seems preferable to the for-each, tho?

@sorawee
Copy link
Contributor

sorawee commented Oct 27, 2024

Does DrRacket still even have the bug report functionality? If not, can they just be removed?

any)])
(provide (contract-out
[add-bug-report-controls
(-> (is-a?/c area-container<%>) saved-report? (-> any) (-> any) (-> any) any)]))
Copy link
Member

Choose a reason for hiding this comment

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

Can we ask that (provide (contract-out always be on two lines?

Copy link
Contributor

Choose a reason for hiding this comment

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

Which "two lines" are you talking about? Is it how in each clause, the identifier should be in one line, and the corresponding contract should be in another line? That can be adjusted by changing the formatter of contract-out. But wouldn't this look better?

(provide (contract-out
          [foo (-> number? number?)]
          [bar (-> number? number?)])))

Or are you talking about how you always want:

(provide 
 (contract-out 
  [foo ...]))

instead?

Copy link
Member

Choose a reason for hiding this comment

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

The latter. The provide and the contract-out on two separate lines.

It may be better to think of this as something that should happen because future lines'll have less leftward drift just in general, or may it is better to special case these two? Or maybe this is an unreasonable request? :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I also think it should always look like the latter.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or maybe this is an unreasonable request?

It's totally reasonable! I'm simply trying to pinpoint what exactly is the general change that you want. I understand how you want the above, specific program to be formatted. But what about the below program -- which one do you prefer?

(A)

(provide foo
         bar
         (contract-out 
          [baz ...]))

vs

(B)

(provide 
 foo
 bar
 (contract-out 
  [baz ...]))

I'm mentioning this because my understanding is that:

(provide foo
         bar
         baz)

is the usual format for provide. So (A) seems to be more consistent with the usual format? But if that is the case, then it feels weird to me that we want:

(provide foo
         bar
         (contract-out 
          [baz ...]))

but at the same time also don't want

(provide (contract-out 
          [baz ...]))

One possibility to satisfy all constraints might be to have a rule like "if contract-out is the only subform of provide, then provide and contract-out should be in different lines." That would work, but I'm not sure if that's what you had in mind.

Copy link
Collaborator

@jackfirth jackfirth Oct 30, 2024

Choose a reason for hiding this comment

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

I prefer B in the options you provided, though I'm not thrilled about it when it happens.

Copy link
Contributor

Choose a reason for hiding this comment

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

So @jackfirth's proposed rule is that if contract-out is one of subforms of provide, then always enter a newline after provide. That definitely could be done if we all agree with it.

Copy link
Member

Choose a reason for hiding this comment

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

I agree; option B is my preference too. Another option is to split the provide into two provides when there is a contract-out form. Maybe that's a bad idea, tho.

Copy link
Contributor

@sorawee sorawee Oct 31, 2024

@rfindler
Copy link
Member

LGTM

@jackfirth jackfirth merged commit 073a2f9 into master Oct 27, 2024
3 checks passed
sorawee added a commit to sorawee/fmt that referenced this pull request Oct 31, 2024
@shhyou shhyou deleted the autofix-64-1 branch January 12, 2025 23:13
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.

3 participants