Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch code style to Google's Java Code Style #661

Closed
wants to merge 1 commit into from
Closed

Conversation

koppor
Copy link
Owner

@koppor koppor commented Oct 26, 2023

I am so fed up that

Thus, I am looking for good autoformatting tools. The most prominent tool with style guide is Google's:

This PR adds it.

Let's hope for the best that the reformatting action a) really adds a new commit and b) the contributors will be able to pull these changes 馃槄馃檲

I am aware, that there is no maintained gradle plugin.

I am also aware, that Eclipse AOSP since 5 years (google/google-java-format#251), but maybe, this will be resolved.


Blockers

Mandatory checks

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • 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.

@github-actions
Copy link

Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. The tool reviewdog already placed comments on GitHub to indicate the places. See the tab "Files" in you PR. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues.

More information on code quality in JabRef is available at https://devdocs.jabref.org/getting-into-the-code/development-strategy.html.

@koppor koppor force-pushed the main branch 2 times, most recently from 9799dc4 to d6a0e59 Compare October 27, 2023 01:32
@Siedlerchr
Copy link
Collaborator

Mabye spotless ? https://github.com/diffplug/spotless

@koppor
Copy link
Owner Author

koppor commented Oct 28, 2023

Wait for another PR - I have success with palantir-java-format.

That is a) more maintained and b) seems to work well and c) has better formatting than GJF:

(1) google-java-format output:

private static void configureResolvedVersionsWithVersionMapping(Project project) {
    project.getPluginManager()
            .withPlugin(
                    "maven-publish",
                    plugin -> {
                        project.getExtensions()
                                .getByType(PublishingExtension.class)
                                .getPublications()
                                .withType(MavenPublication.class)
                                .configureEach(
                                        publication ->
                                                publication.versionMapping(
                                                        mapping -> {
                                                            mapping.allVariants(
                                                                    VariantVersionMappingStrategy
                                                                            ::fromResolutionResult);
                                                        }));
                    });
}

(1) palantir-java-format output:

private static void configureResolvedVersionsWithVersionMapping(Project project) {
    project.getPluginManager().withPlugin("maven-publish", plugin -> {
        project.getExtensions()
                .getByType(PublishingExtension.class)
                .getPublications()
                .withType(MavenPublication.class)
                .configureEach(publication -> publication.versionMapping(mapping -> {
                    mapping.allVariants(VariantVersionMappingStrategy::fromResolutionResult);
                }));
    });
}

@koppor koppor closed this Oct 28, 2023
@koppor koppor deleted the add-gjf branch October 28, 2023 20:20
@koppor koppor mentioned this pull request Oct 28, 2023
9 tasks
@koppor
Copy link
Owner Author

koppor commented Oct 28, 2023

New try at #663

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.

None yet

2 participants