Skip to content

Move IntelliJ code style & copyright configuration to project-level settings #2652

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

Merged
merged 3 commits into from
Aug 10, 2021

Conversation

Bennett-Lynch
Copy link
Contributor

@Bennett-Lynch Bennett-Lynch commented Aug 10, 2021

Motivation

We currently expose IntelliJ code style & copyright configuration as
standalone config files that users must manually import into their IDE.
The import process is not too tedious, since the files are stored in
Git (and thus readily available at the project level), but it requires
users to know to find and import these files, and it's an unnecessary
manual step for new users to be able to contribute.

IntelliJ makes it easy to share configuration at the project-level. With
its .idea directory structure, we can manually choose which files to
share in Git. Then any user cloning the project will automatically use
our recommended settings.

Another benefit of this approach is that any changes to the existing
code style will be automatically shared and synced with users when
they pull the latest version.

Modifications

  • Copy intellij-codestyle.xml to project-level settings (and remove the
    old file)
  • Copy intellij-copyright-profile.xml to project-level settings (and
    remove the old file)
  • Update gitignore to not ignore the directories for these specific
    project-level settings
  • Update the GettingStarted guide accordingly

Notes

To generate the project-level code style, I used the existing
intellij-codestyle.xml and performed the IntelliJ "copy to project"
action. This resulted in some slight differences, like reordering of
elements and elements like "GENERATE_FINAL_LOCALS" no longer being
present, but from what I can tell this is due to them specifying the
same as the default behavior.

Resources

https://stackoverflow.com/questions/9087439/how-to-share-code-style-settings-between-developers-in-intellij

https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

https://stackoverflow.com/questions/5533050/gitignore-exclude-folder-but-include-specific-subfolder

License

  • I confirm that this pull request can be released under the Apache 2 license

Bennett Lynch added 2 commits August 10, 2021 13:24
## Motivation

We currently expose IntelliJ code style & copyright configuration as
standalone config files that users must manually import into their IDE.
The import process is not too tedious, since the files are stored in
Git (and thus readily available at the project level), but it requires
users to know to find and import these files, and it's an unnecessary
manual step for new users to be able to contribute.

IntelliJ makes it easy to share configuration at the project-level. With
its .idea directory structure, we can manually choose which files to
share in Git. Then any user cloning the project will automatically use
our recommended settings.

## Modifications

* Copy intellij-codestyle.xml to project-level settings (and remove the
old file)
* Copy intellij-copyright-profile.xml to project-level settings (and
remove the old file)
* Update gitignore to not ignore the directories for these specific
project-level settings
* Update the GettingStarted guide accordingly

## Notes

To generate the project-level code style, I used the existing
intellij-codestyle.xml and performed the IntelliJ "copy to project"
action. This resulted in some slight differences, like reordering of
elements and elements like "GENERATE_FINAL_LOCALS" no longer being
present, but from what I can tell this is due to them specifying the
same as the default behavior.

## Resources

https://stackoverflow.com/questions/9087439/how-to-share-code-style-settings-between-developers-in-intellij

https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

https://stackoverflow.com/questions/5533050/gitignore-exclude-folder-but-include-specific-subfolder
## Motivation

We currently expose IntelliJ code style & copyright configuration as
standalone config files that users must manually import into their IDE.
The import process is not too tedious, since the files are stored in
Git (and thus readily available at the project level), but it requires
users to know to find and import these files, and it's an unnecessary
manual step for new users to be able to contribute.

IntelliJ makes it easy to share configuration at the project-level. With
its .idea directory structure, we can manually choose which files to
share in Git. Then any user cloning the project will automatically use
our recommended settings.

## Modifications

* Copy intellij-codestyle.xml to project-level settings (and remove the
old file)
* Copy intellij-copyright-profile.xml to project-level settings (and
remove the old file)
* Update gitignore to not ignore the directories for these specific
project-level settings
* Update the GettingStarted guide accordingly

## Notes

To generate the project-level code style, I used the existing
intellij-codestyle.xml and performed the IntelliJ "copy to project"
action. This resulted in some slight differences, like reordering of
elements and elements like "GENERATE_FINAL_LOCALS" no longer being
present, but from what I can tell this is due to them specifying the
same as the default behavior.

## Resources

https://stackoverflow.com/questions/9087439/how-to-share-code-style-settings-between-developers-in-intellij

https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

https://stackoverflow.com/questions/5533050/gitignore-exclude-folder-but-include-specific-subfolder
## Motivation

We currently expose IntelliJ code style & copyright configuration as
standalone config files that users must manually import into their IDE.
The import process is not too tedious, since the files are stored in
Git (and thus readily available at the project level), but it requires
users to know to find and import these files, and it's an unnecessary
manual step for new users to be able to contribute.

IntelliJ makes it easy to share configuration at the project-level. With
its .idea directory structure, we can manually choose which files to
share in Git. Then any user cloning the project will automatically use
our recommended settings.

## Modifications

* Copy intellij-codestyle.xml to project-level settings (and remove the
old file)
* Copy intellij-copyright-profile.xml to project-level settings (and
remove the old file)
* Update gitignore to not ignore the directories for these specific
project-level settings
* Update the GettingStarted guide accordingly

## Notes

To generate the project-level code style, I used the existing
intellij-codestyle.xml and performed the IntelliJ "copy to project"
action. This resulted in some slight differences, like reordering of
elements and elements like "GENERATE_FINAL_LOCALS" no longer being
present, but from what I can tell this is due to them specifying the
same as the default behavior.

## Resources

https://stackoverflow.com/questions/9087439/how-to-share-code-style-settings-between-developers-in-intellij

https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

https://stackoverflow.com/questions/5533050/gitignore-exclude-folder-but-include-specific-subfolder
@Bennett-Lynch
Copy link
Contributor Author

Removed copyright header from the config files themselves since it will be clobbered/overwritten whenever we change a setting preference, creating unnecessary churn (either in the diff or in having to manually preserve it).

@Bennett-Lynch Bennett-Lynch merged commit c059320 into aws:master Aug 10, 2021
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

81.6% 81.6% Coverage
0.0% 0.0% Duplication

Bennett-Lynch pushed a commit to Bennett-Lynch/aws-sdk-java-v2 that referenced this pull request Aug 10, 2021
## Motivation

Similar to how aws#2652 recently
moved our code style & copyright configuration files to the
project-level, we can also do the same for IntelliJ inspections. This
has the benefit of keeping inspections in sync for all users, as well as
automatically informing new users of our expected coding best practices.

We do not currently have an existing inspection profile, so we will take
this opportunity to start with a new, blank inspection profile. Users
may then propose customizing the inspections via PRs, subject to the
normal review process. Over time we will gravitate towards a shared
inspection profile that we can all agree on.

## Modifications

* Create a new, blank "AWS Java SDK 2.0" inspection profile
* Update profiles_settings.xml to make users use this profile
* Add corresponding gitignore update
* Add corresponding GettingStarted update
Bennett-Lynch pushed a commit to Bennett-Lynch/aws-sdk-java-v2 that referenced this pull request Aug 10, 2021
## Motivation

Similar to how aws#2652 recently
moved our code style & copyright configuration files to the
project-level, we can also do the same for IntelliJ inspections. This
has the benefit of keeping inspections in sync for all users, as well as
automatically informing new users of our expected coding best practices.

We do not currently have an existing inspection profile, so we will take
this opportunity to start with a new, blank inspection profile. Users
may then propose customizing the inspections via PRs, subject to the
normal review process. Over time we will gravitate towards a shared
inspection profile that we can all agree on.

## Modifications

* Create a new, blank "AWS Java SDK 2.0" inspection profile
* Update profiles_settings.xml to make users use this profile
* Add corresponding gitignore update
* Add corresponding GettingStarted update
Bennett-Lynch added a commit that referenced this pull request Aug 10, 2021
* Create a shared, project-level IntelliJ inspection profile

## Motivation

Similar to how #2652 recently
moved our code style & copyright configuration files to the
project-level, we can also do the same for IntelliJ inspections. This
has the benefit of keeping inspections in sync for all users, as well as
automatically informing new users of our expected coding best practices.

We do not currently have an existing inspection profile, so we will take
this opportunity to start with a new, blank inspection profile. Users
may then propose customizing the inspections via PRs, subject to the
normal review process. Over time we will gravitate towards a shared
inspection profile that we can all agree on.

## Modifications

* Create a new, blank "AWS Java SDK 2.0" inspection profile
* Update profiles_settings.xml to make users use this profile
* Add corresponding gitignore update
* Add corresponding GettingStarted update
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