Skip to content

Cleanup suppressed overlength line for action.support package#34889

Merged
not-napoleon merged 5 commits intoelastic:masterfrom
not-napoleon:fix/line-length-cleanup-action-support
Oct 29, 2018
Merged

Cleanup suppressed overlength line for action.support package#34889
not-napoleon merged 5 commits intoelastic:masterfrom
not-napoleon:fix/line-length-cleanup-action-support

Conversation

@not-napoleon
Copy link
Copy Markdown
Member

Clean up lines over 140 characters in the org.elasticsearch.action.support.* packages (master branch version)

Relates to #34884

Copy link
Copy Markdown
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM assuming CI is happy :)

Copy link
Copy Markdown
Contributor

@AthenaEryma AthenaEryma left a comment

Choose a reason for hiding this comment

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

Left a few nits that you can either take or not as you like, overall LGTM.

if (indexMetaData != null) {
for (IntObjectCursor<IndexShardRoutingTable> shardRouting : clusterState.getRoutingTable().indicesRouting().get(index).getShards()) {
for (IntObjectCursor<IndexShardRoutingTable> shardRouting :
clusterState.getRoutingTable().indicesRouting().get(index).getShards()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I did this kind of thing as

for (IntObjectCursor<IndexShardRoutingTable> shardRouting
     : clusterState.getRoutingTable().indicesRouting().get(index).getShards()) {

Since I thought it made it more visually obvious that the second line was part of the for and not the code block below, but I could see either way.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1. I really like indenting an extra level for things like this so the for loop's "for" parts don't line up with the block's body.

public abstract class TransportInstanceSingleOperationAction<Request extends InstanceShardOperationRequest<Request>, Response extends ActionResponse>
extends HandledTransportAction<Request, Response> {
public abstract class TransportInstanceSingleOperationAction<Request extends InstanceShardOperationRequest<Request>,
Response extends ActionResponse> extends HandledTransportAction<Request, Response> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd prefer:

Suggested change
Response extends ActionResponse> extends HandledTransportAction<Request, Response> {
Response extends ActionResponse>
extends HandledTransportAction<Request, Response> {

But again, either way really.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

public abstract class TransportInstanceSingleOperationAction<
            Request extends InstanceShardOperationRequest<Request>,
            Response extends ActionResponse
        > extends HandledTransportAction<Request, Response> {

Is my preference. Stately.

}
transportService.sendRequest(node, transportShardAction, internalRequest.request(), new TransportResponseHandler<Response>() {
transportService.sendRequest(node, transportShardAction, internalRequest.request(), new TransportResponseHandler<Response>()
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think moving the whole new new TransportResponseHandler<Response>() { onto the next line is a little clearer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

Copy link
Copy Markdown
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

I've left a few minor things but also LGTM.


public abstract class DelegatingActionListener<Instigator extends ActionResponse, Delegated extends ActionResponse> implements ActionListener<Instigator> {
public abstract class DelegatingActionListener<Instigator extends ActionResponse, Delegated extends ActionResponse>
implements ActionListener<Instigator> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

import org.elasticsearch.client.ElasticsearchClient;

public abstract class BroadcastOperationRequestBuilder<Request extends BroadcastRequest<Request>, Response extends BroadcastResponse, RequestBuilder extends BroadcastOperationRequestBuilder<Request, Response, RequestBuilder>>
public abstract class BroadcastOperationRequestBuilder<Request extends BroadcastRequest<Request>, Response extends BroadcastResponse,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd probably do these one-per-line at this point.


public abstract class TransportBroadcastAction<Request extends BroadcastRequest<Request>, Response extends BroadcastResponse, ShardRequest extends BroadcastShardRequest, ShardResponse extends BroadcastShardResponse>
public abstract class TransportBroadcastAction<Request extends BroadcastRequest<Request>, Response extends BroadcastResponse,
ShardRequest extends BroadcastShardRequest, ShardResponse extends BroadcastShardResponse>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here.

onOperation(shard, shardIt, shardIndex, new NoShardAvailableActionException(shardIt.shardId()));
} else {
transportService.sendRequest(node, transportShardAction, shardRequest, new TransportResponseHandler<ShardResponse>() {
transportService.sendRequest(node, transportShardAction, shardRequest, new TransportResponseHandler<ShardResponse>()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe put the class on a new line rather than move the body opening like this.

public abstract class TransportInstanceSingleOperationAction<Request extends InstanceShardOperationRequest<Request>, Response extends ActionResponse>
extends HandledTransportAction<Request, Response> {
public abstract class TransportInstanceSingleOperationAction<Request extends InstanceShardOperationRequest<Request>,
Response extends ActionResponse> extends HandledTransportAction<Request, Response> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

public abstract class TransportInstanceSingleOperationAction<
            Request extends InstanceShardOperationRequest<Request>,
            Response extends ActionResponse
        > extends HandledTransportAction<Request, Response> {

Is my preference. Stately.

}
transportService.sendRequest(node, transportShardAction, internalRequest.request(), new TransportResponseHandler<Response>() {
transportService.sendRequest(node, transportShardAction, internalRequest.request(), new TransportResponseHandler<Response>()
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

TestBroadcastReplicationAction(Settings settings, ClusterService clusterService, TransportService transportService,
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
TransportReplicationAction<BasicReplicationRequest, BasicReplicationRequest, ReplicationResponse> replicatedBroadcastShardAction) {
TransportReplicationAction<BasicReplicationRequest, BasicReplicationRequest, ReplicationResponse>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wow! I've never thought of breaking the type from the name before but it looks like we kind of have to to fit it in.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah, I'm really not happy with doing it this way, but the only alternative I saw was to split the type parameters out to separate lines, which looked worse to me. I'm open to suggestions.

@colings86
Copy link
Copy Markdown
Contributor

Please remember to add all relevant labels (area label, version label(s) and change type label) on all PRs and please look for this as part of reviews. The release note generation process is made much harder when PRs are not labelled correctly.

@colings86 colings86 added the :Core/Infra/Core Core issues without another label label Oct 26, 2018
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-infra

 Conflicts:
	server/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastAction.java
	server/src/main/java/org/elasticsearch/action/support/single/shard/TransportSingleShardAction.java
@not-napoleon not-napoleon merged commit 329a94b into elastic:master Oct 29, 2018
@not-napoleon not-napoleon deleted the fix/line-length-cleanup-action-support branch October 29, 2018 13:22
kcm pushed a commit that referenced this pull request Oct 30, 2018
Clean up lines over 140 characters in the `org.elasticsearch.action.support.*` packages

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants