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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SAT NoEmptyLineSeparatorCheck findings #7296

Merged

Conversation

wborn
Copy link
Member

@wborn wborn commented Apr 4, 2020

Removes unnecessary empty lines and two unnecessary default constructors.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Signed-off-by: Wouter Born <github@maindrain.net>
Comment on lines 551 to 572
allChannels
.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_ALBUM),
new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_ALBUM)).build());
allChannels
.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_ARTWORK),
new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_ARTWORK)).build());
allChannels
.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_ARTIST),
new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_ARTIST)).build());
allChannels.add(
getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_DESCRIPTION),
new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_DESCRIPTION)).build());
allChannels
.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_GENRE),
new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_GENRE)).build());
allChannels.add(
getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_ITEMNAME),
new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_ITEMNAME)).build());
allChannels.add(getCallback()
.createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_STATIONLOCATION),
new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_STATIONLOCATION))
.build());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any formatting setting that would make this look better?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed the part where it's sloppy code with a lot of unnecessary duplication causing all sorts of issues.

Math.min(Math.max(0, ((DecimalType) command).intValue()*10), 999999999)), this);
Math.min(Math.max(0, ((DecimalType) command).intValue() * 10), 999999999)),
this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's with this new indentation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Eclipse auto save formatting placed it on a new line. Does it also happen for you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind that it placed it on a new line, I just disagree on the indentation of that new line, it should be at least as indented as the previous one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stopped fighting auto formatters a long time ago. 😉

According to my settings the limit is set to 120:

settings

It's a limit for a reason, sometimes it will result in less optimal formatting like in this case. It's expected to happen a lot more when all code is reformatted using spotless.

Copy link
Member Author

@wborn wborn Apr 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auto formatter indents it like this because it is the second parameter of transceiver.send. I think it does make all this excessively indented code more readable:

indentation

@@ -28,7 +28,7 @@
import org.eclipse.smarthome.core.thing.binding.BaseBridgeHandler;
import org.eclipse.smarthome.core.thing.binding.ThingHandler;
import org.eclipse.smarthome.core.types.Command;

import org.openhab.binding.neohub.internal.NeoHubBindingConstants.NeoHubReturnResult;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this imported?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's added by the auto save actions because it's used by fromNeoHubFetchPollingResponse on L181.

@@ -76,7 +76,8 @@ public XMLConnection(String host) {
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Length", Integer.toString(message.length()));

connection.setConnectTimeout(CONNECTION_TIMEOUT_MS); // set a timeout in case the device is not reachable (went offline)
connection.setConnectTimeout(CONNECTION_TIMEOUT_MS); // set a timeout in case the device is not reachable
// (went offline)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this comment indentation fragile?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be less fragile now. 🎈

Signed-off-by: Wouter Born <github@maindrain.net>
Copy link
Contributor

@clinique clinique left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@druciak druciak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving Satel changes.

@cpmeister cpmeister merged commit a985e07 into openhab:2.5.x Apr 5, 2020
@cpmeister cpmeister added this to the 2.5.4 milestone Apr 5, 2020
@wborn wborn deleted the fix-NoEmptyLineSeparatorCheck-findings branch April 5, 2020 13:38
Hans-Reiner pushed a commit to Hans-Reiner/openhab2-addons that referenced this pull request Apr 11, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
Signed-off-by: Hans-Reiner Hoffmann <hans-reiner.hoffmann@gmx.de>
yfre pushed a commit to yfre/openhab-addons that referenced this pull request Apr 27, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
Signed-off-by: Eugen Freiter <freiter@gmx.de>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request May 29, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
LoungeFlyZ pushed a commit to LoungeFlyZ/openhab2-addons that referenced this pull request Jun 8, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
J-N-K pushed a commit to J-N-K/openhab-addons that referenced this pull request Jul 14, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
CSchlipp pushed a commit to CSchlipp/openhab-addons that referenced this pull request Jul 26, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
Signed-off-by: CSchlipp <christian@schlipp.de>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
DaanMeijer pushed a commit to DaanMeijer/openhab-addons that referenced this pull request Sep 1, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
Signed-off-by: Daan Meijer <daan@studioseptember.nl>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Sep 19, 2020
* Fix SAT NoEmptyLineSeparatorCheck findings
* Fix sloppy coding and fragile comment

Signed-off-by: Wouter Born <github@maindrain.net>
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

4 participants