-
Notifications
You must be signed in to change notification settings - Fork 330
Introduce a code formatting script, as well as inspections from IntelliJ. #8712
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
base: main
Are you sure you want to change the base?
Conversation
| IDEA_FORMAT_SCRIPT="" | ||
|
|
||
| if [ -n "$IDEA_HOME" ]; then | ||
| IDEA_FORMAT_SCRIPT="$IDEA_HOME/bin/format.sh" |
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.
Is this IDEA format.sh shared for all of us? Or is it a local file that we can modify? I'm wondering if we could have a situation where we each have separate settings and end up with conflicting corrections.
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.
It is where the IntelliJ is launched from, yes. Versioning is a question for this, as well as which dart SDK we would use.
I suspect a on the latest stable platform version would be more than sufficient, formatting and verifications also don't change that much from one version to the next.
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.
It is where the IntelliJ is launched from, yes. Versioning is a question for this, as well as which dart SDK we would use.
I suspect a on the latest stable platform version would be more than sufficient, formatting and verifications also don't change that much from one version to the next.
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.
Ohh I think I understand more after I read this:
The format.sh script is an executable located in the bin directory of your IntelliJ IDEA installation, used for applying the IDE's configured code style formatting to specified files or directories from the command line.
So this doesn't contain the information of what code styles we want for java, it just uses the code styles we set. But where are those from? I guess my question still remains of whether we have a spot where we set the code styles for our project, rather than potentially each of us having different settings depending on our individual configuration of IntelliJ options.
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.
That's a valid concern, but I don't think it will be an issue as long as we're all on the latest stable version of the platform (currently 2025.3). The Java formatter doesn't tend to change dramatically from quarter to quarter.
If we do run into inconsistencies, we could change the script to download a specific version of IntelliJ locally—outside of the repo—and hardcode our scripts to use that one, ensuring we're all aligned.
helin24
left a comment
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.
Other than the question around Java code settings, I think this seems great to have.
…rom IntelliJ. Including Dart / Java / Kotlin / XML / Form / Properties / JSON. If we agree on having the repo formatted / inspected, a follow up here would be documenation of this tool and the addition of it to the presubmit to prevent regressions.
|
@pq & @helin24 I went through and added documentation, and stricter assertions in the |
fe4a2a6 to
1238f2c
Compare
…cluding documentation and script support. Follow up on flutter#8712 See flutter#8098
Formatting includes Dart / Java / Kotlin / XML / Form / Properties / JSON.
The inspections are currently the default settings from IntelliJ, but this could be iterated on if we want the repo to have the inspections enforced.
If we agree on having the repo formatted / inspected, a follow up here would be documentation of this tool and the addition of it to the presubmit to prevent regressions.
With the follow-through of formatting, and adding this to the bots, this will resolve #8098
Formatting output visible in this PR: #8715