Skip to content

Conversation

@xerial
Copy link
Owner

@xerial xerial commented Jul 19, 2025

Summary

  • Update scalafmt configuration to properly support Scala 3
  • Change runner dialect from scala213source3 to scala3
  • Add StandardConvention project layout for better organization
  • Reduce maxColumn from 180 to 100 for improved code readability
  • Add Scala 3 specific rewrite rules for modern syntax conversion
  • Configure newlines and docstring formatting for consistent style

Changes

  • Dialect: Updated from scala213source3 to scala3 to properly support Scala 3.7.1
  • Layout: Added StandardConvention project layout
  • Line length: Reduced from 180 to 100 characters for better readability
  • Scala 3 features: Added rewrite rules for new syntax, optional braces removal, and end markers
  • Formatting: Enhanced newlines and docstring configuration

Test plan

  • Update .scalafmt.conf with new configuration
  • Verify scalafmt check passes with new configuration
  • Ensure all tests continue to pass
  • Confirm build completes successfully

🤖 Generated with Claude Code

- Change dialect from scala213source3 to scala3
- Add StandardConvention project layout
- Reduce maxColumn from 180 to 100 for better readability
- Add Scala 3 specific rewrite rules for modern syntax
- Configure newlines and docstring formatting

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @xerial, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on modernizing the code formatting rules for Scala 3 projects by updating the .scalafmt.conf file. The changes aim to enhance code readability, enforce consistent styling, and leverage new Scala 3 syntax features through automated rewrites, aligning the project's formatting with current Scala 3 best practices.

Highlights

  • Scala 3 Compatibility: Updated the scalafmt dialect from scala213source3 to scala3 to ensure proper formatting and support for Scala 3.7.1 features.
  • Code Readability & Style: Reduced the maximum column width from 180 to 100 characters and introduced the StandardConvention project layout for improved code readability and organization.
  • Modern Scala 3 Syntax Rewrites: Enabled Scala 3 specific rewrite rules to automatically convert code to new syntax, remove optional braces, and insert end markers for larger code blocks (over 30 lines).
  • Formatting Consistency: Configured docstring formatting to include a blank first line and refined newline rules for top-level statements and source files to ensure consistent code style throughout the project.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the scalafmt configuration to align with Scala 3 best practices, improving code readability and consistency. The changes include updating the dialect, reducing the line length, and adding modern rewrite rules. My review identified a critical issue with an invalid scalafmt version that will break the build, and a medium-severity issue where a formatting rule doesn't match its descriptive comment. Addressing these points will ensure the new configuration is both functional and clear.

@@ -1,5 +1,16 @@
version = 3.9.4
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The specified scalafmt version 3.9.4 does not appear to be a valid published version. The latest stable version of scalafmt is 3.8.1. Using a non-existent version will cause the build to fail when sbt-scalafmt attempts to download the runner. Please update this to a valid, published version.

version = 3.8.1

Comment on lines +11 to +15
newlines.topLevelStatementBlankLines = [
{
blanks { after = 1 }
}
]
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The comment on line 10, # Add a new line before case class, is inconsistent with the configuration below it. The current rule will add a blank line after every top-level statement, not just before case class definitions. This is because the regexes property is not specified and defaults to [".*"], which matches all top-level statements.

This broad rule could lead to undesirable formatting, such as extra newlines after the last import statement or at the end of a file.

To align the rule with the comment's intent, it should be made more specific to target only case class definitions.

newlines.topLevelStatementBlankLines = [
  {
    regexes = ["^case class"]
    blanks.before = 1
  }
]

@xerial xerial merged commit a317643 into master Jul 19, 2025
9 checks passed
@xerial xerial deleted the update-scalafmt-config branch July 19, 2025 18:47
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