Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve scijava coding style#8

Draft
maarzt wants to merge 1 commit intomaster from
improve-scijava-coding-style
Draft

Improve scijava coding style #8
maarzt wants to merge 1 commit intomaster from
improve-scijava-coding-style

Conversation

@maarzt
Copy link
Collaborator

@maarzt maarzt commented Feb 10, 2023
edited
Loading

I would like to improve the scijava coding style in a similar manner as done with the imglib2 coding style.
The main change is that the code formatter now is less likely to remove manually placed new line characters.
This combined with a longer line length gives us programmers more freedom when using the coding style.

This demo PR shows the impact of the changes on the scijava-common repository.

Changes:

  • Increase line length.
  • Allow more freedom to manually break lines.
  • Don't inline if statements
  • Use only one tab for indentation in enum classes. (fix)

imagejan reacted with heart emoji
* Increase line length.
* Allow more freedom to manually break lines.
* Don't inline if statements
* Use only one tab for indentation in enum classes. (fix)
Copy link
Member

ctrueden commented Feb 15, 2023
edited
Loading

@maarzt Thanks for working on this. I like these changes for the most part.

I'm sad to see the 80 limit go because the only true terminal size is 80x25 forever, but at the same time it's a huge pain in practice and having it longer is really better. So I accept it.

I do not like the change to inlining of if statements. I know I am in a small minority here, but I love reading code like:

String lang = ss.getLanguageByName(arg);
if (lang == null) lang = ss.getLanguageByExtension(arg);
if (lang == null) lang = doSomeOtherFallback(arg);

When the consequents are not inlined anymore, it becomes:

String lang = ss.getLanguageByName(arg);
if (lang == null)
 lang = ss.getLanguageByExtension(arg);
if (lang == null)
 lang = doSomeOtherFallback(arg);

Which I find to be ugly and a waste of space. It's even worse IMHO with the if / else if / else if / else pattern. I really just want each case on its own line, no extra newlines, no curly braces.

I'm probably willing to cave on this, since probably everyone else disagrees with me, but just wanted to throw in why the style was like this up till now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ctrueden ctrueden Awaiting requested review from ctrueden

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /