Skip to content

Improve scijava coding style (DEMO)#1

Draft
maarzt wants to merge 10 commits intomasterfrom
improve-scijava-coding-style
Draft

Improve scijava coding style (DEMO)#1
maarzt wants to merge 10 commits intomasterfrom
improve-scijava-coding-style

Conversation

@maarzt
Copy link
Owner

@maarzt maarzt commented Feb 10, 2023

This draft PR is only here to demonstrate the suggested changes to the scijava-codings-style.

The individual commits show the impact of each individual change.

maarzt added 10 commits February 9, 2023 14:01
The code formatter accepts manual placed line breaks in function calls.
It will for example no longer remove a new line character after the
opening parenthesis of a function call.

A code formatting like this is now possible:

my_object.setMessage(
    "Some text that describes the value x=" + x);
and lambda expressions.

Allows to programmer to more freely place line breaks in method
declarations. Now this is possible:

private PluginInfo<SciJavaPlugin> createInfo(
    final IndexItem<Plugin> item, final ClassLoader classLoader)
{
    ...
}
It's now possible to have a new line directly after the opening
parenthesis in a try-with-resource statement. Like here:

try (
	final DataHandle<Location> sourceHandle = dataHandleService.create(source);
 	final DataHandle<Location> cachedHandle = dataHandleService.create(cached);
 	final DataHandle<Location> destHandle = dataHandleService.create(destination)
)
{
	...
}
Allows to have longer uninterrupted lines of code.
But also allows to manually place line breaks to better organize your
code into shorter lines.
The code formatting inside javadoc unfortunately destroys the javadoc.
It destroys tags like {@code } and introduces line breaks that change
the layout of your javadoc.

Therefore the code formatting in javadoc is disabled.
A long expressions that occupies multiple lines of code often
benefits from manually placed line breaks. This allows to organize the
equation in a logical manner. The code formatter no longer removes
those manual line breaks.
An if statement is now formatted like this:

if (list.isEmpty())
    return null;
The code formatter now indents enum classe like normal
classes with one tab character.
@maarzt maarzt changed the title Improve scijava coding style Improve scijava coding style (DEMO) Feb 10, 2023
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