Skip to content

Conversation

@koppor
Copy link
Member

@koppor koppor commented Aug 19, 2025

Follow-up to #672

I think spring-javaformat is our last chance if we don't want to configure our own rules. The plugin is automatically activated in IntelliJ. For the code style, see https://github.com/spring-projects/spring-framework/wiki/Code-Style

spaces instead of tabs are activated.

We still need

  • Variable naming conventions
  • Custom intellij rules for import statements

The source formatter does not fundamentally change your code. For example, it will not change the order of import statements. It is effectively limited to adding or removing whitespace and line feed

We need to accept that else starts on the "first" column. ("Kernighan and Ritchie style") -> https://github.com/spring-projects/spring-framework/wiki/Code-Style#block-like-constructs-kr-style

This is OK for me.

If this new coe style is OK, setup .git blame ignore - as outlined at JabRef#10646 (comment). Do a merge commit, not a squash-merge.

Steps to test

Open the code in IntelliJ

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [.] Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • [.] Tests created for changes (if applicable)
  • [.] Manually tested changed features in running JabRef (always required)
  • [.] Screenshots added in PR description (if change is visible to the user)
  • [.] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • [.] Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@calixtus
Copy link
Member

calixtus commented Aug 19, 2025

This is not working for me.

takes wastes too much space:
grafik

worsens overview:
grafik

not working correctly with flow-style:
grafik

Is there another codestyle available in the spring utility?

@koppor koppor closed this Aug 19, 2025
@koppor koppor deleted the apply-spring-java-format branch August 19, 2025 14:01
@koppor
Copy link
Member Author

koppor commented Aug 19, 2025

The bad formatting was already posted 2023 at #663 (comment) - but I totally forgot about it.

@koppor
Copy link
Member Author

koppor commented Aug 19, 2025

note that google java format also cannot be used, because it does not support Markdown comments: google/google-java-format#1193

@koppor
Copy link
Member Author

koppor commented Aug 19, 2025

spotless is still no option: diffplug/spotless#2599

@koppor
Copy link
Member Author

koppor commented Aug 19, 2025

IntelliJ can use Eclipse formatter: https://github.com/krasa/EclipseCodeFormatter

@koppor koppor mentioned this pull request Aug 19, 2025
3 tasks
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 19, 2025
JabRef/jabref-koppor#716
jabgui/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java
jabgui/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 19, 2025
JabRef/jabref-koppor#716
jabgui/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java
within method addSelectedEntries()
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 20, 2025
JabRef/jabref-koppor#716
jabgui/src/main/java/org/jabref/gui/importer/NewEntryAction.java
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 20, 2025
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 20, 2025
JabRef/jabref-koppor#716
jablib/src/main/java/org/jabref/logic/crawler/StudyRepository.java
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 21, 2025
JabRef/jabref-koppor#716
jabgui/src/main/java/org/jabref/gui/maintable/ColumnPreferences.java
jabgui/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java
jabgui/src/main/java/org/jabref/gui/preferences/network/NetworkTab.java
jabgui/src/main/java/org/jabref/gui/preferences/websearch/WebSearchTab.java
jabgui/src/main/java/org/jabref/gui/groups/GroupTreeView.java
jabgui/src/main/java/org/jabref/gui/preferences/ai/AiTabViewModel.java
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 21, 2025
JabRef/jabref-koppor#716
jabgui/src/main/java/org/jabref/gui/desktop/os/NativeDesktop.java
jablib/src/main/java/org/jabref/logic/importer/SearchBasedParserFetcher.java
jablib/src/main/java/org/jabref/logic/importer/Importer.java
jablib/src/main/java/org/jabref/model/database/BibDatabaseContext.java
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 21, 2025
JabRef/jabref-koppor#716
jabgui/src/main/java/org/jabref/gui/openoffice/Bootstrap.java
(#976)
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 21, 2025
tsantalis added a commit to tsantalis/RefactoringMiner that referenced this pull request Aug 21, 2025
JabRef/jabref-koppor#716
jablib/src/test/java/org/jabref/logic/git/GitSyncServiceTest.java
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