Skip to content

Commit 0936703

Browse files
authored
all: fix lint
1 parent eb6c341 commit 0936703

23 files changed

+144
-151
lines changed

compiler/src/java_plugin/cpp/java_generator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ class LogHelper {
3838
}
3939
};
4040

41-
// Abort the program after logging the mesage if the given condition is not
41+
// Abort the program after logging the message if the given condition is not
4242
// true. Otherwise, do nothing.
4343
#define GRPC_CODEGEN_CHECK(x) !(x) && LogHelper(&std::cerr).get_os() \
4444
<< "CHECK FAILED: " << __FILE__ << ":" \
4545
<< __LINE__ << ": "
4646

47-
// Abort the program after logging the mesage.
47+
// Abort the program after logging the message.
4848
#define GRPC_CODEGEN_FAIL GRPC_CODEGEN_CHECK(false)
4949

5050
namespace java_grpc_generator {

core/src/test/java/io/grpc/internal/ServiceConfigErrorHandlingTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
import org.junit.Before;
6262
import org.junit.Rule;
6363
import org.junit.Test;
64-
import org.junit.rules.ExpectedException;
6564
import org.junit.runner.RunWith;
6665
import org.junit.runners.JUnit4;
6766
import org.mockito.ArgumentCaptor;
@@ -103,7 +102,6 @@ public boolean shouldAccept(Runnable command) {
103102

104103
private final InternalChannelz channelz = new InternalChannelz();
105104

106-
@Rule public final ExpectedException thrown = ExpectedException.none();
107105
@Rule public final MockitoRule mocks = MockitoJUnit.rule();
108106

109107
private ManagedChannelImpl channel;

examples/example-tls/src/main/java/io/grpc/examples/helloworldtls/HelloWorldServerTls.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import io.grpc.stub.StreamObserver;
2626
import io.netty.handler.ssl.ClientAuth;
2727
import io.netty.handler.ssl.SslContextBuilder;
28-
import io.netty.handler.ssl.SslProvider;
2928

3029
import java.io.File;
3130
import java.io.IOException;

netty/src/main/java/io/grpc/netty/InternalProtocolNegotiationEvent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
package io.grpc.netty;
1818

1919
import io.grpc.Attributes;
20+
import io.grpc.Internal;
2021
import io.grpc.InternalChannelz.Security;
2122
import javax.annotation.Nullable;
2223

2324
/**
2425
* Internal accessor for {@link ProtocolNegotiationEvent}.
2526
*/
27+
@Internal
2628
public final class InternalProtocolNegotiationEvent {
2729
private InternalProtocolNegotiationEvent() {}
2830

xds/src/main/java/io/grpc/xds/EnvoyProtoData.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,8 +1292,8 @@ long getLoadReportIntervalNanos() {
12921292

12931293
io.envoyproxy.envoy.config.endpoint.v3.ClusterStats toEnvoyProtoClusterStats() {
12941294
io.envoyproxy.envoy.config.endpoint.v3.ClusterStats.Builder builder =
1295-
io.envoyproxy.envoy.config.endpoint.v3.ClusterStats.newBuilder();
1296-
builder.setClusterName(clusterName);
1295+
io.envoyproxy.envoy.config.endpoint.v3.ClusterStats.newBuilder()
1296+
.setClusterName(clusterName);
12971297
if (clusterServiceName != null) {
12981298
builder.setClusterServiceName(clusterServiceName);
12991299
}
@@ -1303,25 +1303,27 @@ io.envoyproxy.envoy.config.endpoint.v3.ClusterStats toEnvoyProtoClusterStats() {
13031303
for (DroppedRequests droppedRequests : droppedRequestsList) {
13041304
builder.addDroppedRequests(droppedRequests.toEnvoyProtoDroppedRequests());
13051305
}
1306-
builder.setTotalDroppedRequests(totalDroppedRequests);
1307-
builder.setLoadReportInterval(Durations.fromNanos(loadReportIntervalNanos));
1308-
return builder.build();
1306+
return builder
1307+
.setTotalDroppedRequests(totalDroppedRequests)
1308+
.setLoadReportInterval(Durations.fromNanos(loadReportIntervalNanos))
1309+
.build();
13091310
}
13101311

13111312
io.envoyproxy.envoy.api.v2.endpoint.ClusterStats toEnvoyProtoClusterStatsV2() {
13121313
io.envoyproxy.envoy.api.v2.endpoint.ClusterStats.Builder builder =
1313-
io.envoyproxy.envoy.api.v2.endpoint.ClusterStats.newBuilder();
1314-
builder.setClusterName(clusterName);
1314+
io.envoyproxy.envoy.api.v2.endpoint.ClusterStats.newBuilder()
1315+
.setClusterName(clusterName);
13151316
for (UpstreamLocalityStats upstreamLocalityStats : upstreamLocalityStatsList) {
13161317
builder.addUpstreamLocalityStats(
13171318
upstreamLocalityStats.toEnvoyProtoUpstreamLocalityStatsV2());
13181319
}
13191320
for (DroppedRequests droppedRequests : droppedRequestsList) {
13201321
builder.addDroppedRequests(droppedRequests.toEnvoyProtoDroppedRequestsV2());
13211322
}
1322-
builder.setTotalDroppedRequests(totalDroppedRequests);
1323-
builder.setLoadReportInterval(Durations.fromNanos(loadReportIntervalNanos));
1324-
return builder.build();
1323+
return builder
1324+
.setTotalDroppedRequests(totalDroppedRequests)
1325+
.setLoadReportInterval(Durations.fromNanos(loadReportIntervalNanos))
1326+
.build();
13251327
}
13261328

13271329
@VisibleForTesting
@@ -1534,13 +1536,12 @@ List<EndpointLoadMetricStats> getLoadMetricStatsList() {
15341536
private io.envoyproxy.envoy.config.endpoint.v3.UpstreamLocalityStats
15351537
toEnvoyProtoUpstreamLocalityStats() {
15361538
io.envoyproxy.envoy.config.endpoint.v3.UpstreamLocalityStats.Builder builder
1537-
= io.envoyproxy.envoy.config.endpoint.v3.UpstreamLocalityStats.newBuilder();
1538-
builder
1539-
.setLocality(locality.toEnvoyProtoLocality())
1540-
.setTotalSuccessfulRequests(totalSuccessfulRequests)
1541-
.setTotalErrorRequests(totalErrorRequests)
1542-
.setTotalRequestsInProgress(totalRequestsInProgress)
1543-
.setTotalIssuedRequests(totalIssuedRequests);
1539+
= io.envoyproxy.envoy.config.endpoint.v3.UpstreamLocalityStats.newBuilder()
1540+
.setLocality(locality.toEnvoyProtoLocality())
1541+
.setTotalSuccessfulRequests(totalSuccessfulRequests)
1542+
.setTotalErrorRequests(totalErrorRequests)
1543+
.setTotalRequestsInProgress(totalRequestsInProgress)
1544+
.setTotalIssuedRequests(totalIssuedRequests);
15441545
for (EndpointLoadMetricStats endpointLoadMetricStats : loadMetricStatsList) {
15451546
builder.addLoadMetricStats(endpointLoadMetricStats.toEnvoyProtoEndpointLoadMetricStats());
15461547
}
@@ -1550,13 +1551,12 @@ List<EndpointLoadMetricStats> getLoadMetricStatsList() {
15501551
private io.envoyproxy.envoy.api.v2.endpoint.UpstreamLocalityStats
15511552
toEnvoyProtoUpstreamLocalityStatsV2() {
15521553
io.envoyproxy.envoy.api.v2.endpoint.UpstreamLocalityStats.Builder builder
1553-
= io.envoyproxy.envoy.api.v2.endpoint.UpstreamLocalityStats.newBuilder();
1554-
builder
1555-
.setLocality(locality.toEnvoyProtoLocalityV2())
1556-
.setTotalSuccessfulRequests(totalSuccessfulRequests)
1557-
.setTotalErrorRequests(totalErrorRequests)
1558-
.setTotalRequestsInProgress(totalRequestsInProgress)
1559-
.setTotalIssuedRequests(totalIssuedRequests);
1554+
= io.envoyproxy.envoy.api.v2.endpoint.UpstreamLocalityStats.newBuilder()
1555+
.setLocality(locality.toEnvoyProtoLocalityV2())
1556+
.setTotalSuccessfulRequests(totalSuccessfulRequests)
1557+
.setTotalErrorRequests(totalErrorRequests)
1558+
.setTotalRequestsInProgress(totalRequestsInProgress)
1559+
.setTotalIssuedRequests(totalIssuedRequests);
15601560
for (EndpointLoadMetricStats endpointLoadMetricStats : loadMetricStatsList) {
15611561
builder.addLoadMetricStats(endpointLoadMetricStats.toEnvoyProtoEndpointLoadMetricStatsV2());
15621562
}

xds/src/main/java/io/grpc/xds/LoadReportClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ private static final class LoadStatsRequestData {
416416

417417
io.envoyproxy.envoy.service.load_stats.v2.LoadStatsRequest toEnvoyProtoV2() {
418418
io.envoyproxy.envoy.service.load_stats.v2.LoadStatsRequest.Builder builder
419-
= io.envoyproxy.envoy.service.load_stats.v2.LoadStatsRequest.newBuilder();
420-
builder.setNode(node.toEnvoyProtoNodeV2());
419+
= io.envoyproxy.envoy.service.load_stats.v2.LoadStatsRequest.newBuilder()
420+
.setNode(node.toEnvoyProtoNodeV2());
421421
if (clusterStatsList != null) {
422422
for (ClusterStats stats : clusterStatsList) {
423423
builder.addClusterStats(stats.toEnvoyProtoClusterStatsV2());
@@ -427,8 +427,8 @@ io.envoyproxy.envoy.service.load_stats.v2.LoadStatsRequest toEnvoyProtoV2() {
427427
}
428428

429429
LoadStatsRequest toEnvoyProtoV3() {
430-
LoadStatsRequest.Builder builder = LoadStatsRequest.newBuilder();
431-
builder.setNode(node.toEnvoyProtoNode());
430+
LoadStatsRequest.Builder builder = LoadStatsRequest.newBuilder()
431+
.setNode(node.toEnvoyProtoNode());
432432
if (clusterStatsList != null) {
433433
for (ClusterStats stats : clusterStatsList) {
434434
builder.addClusterStats(stats.toEnvoyProtoClusterStats());

xds/src/main/java/io/grpc/xds/LoadStatsStoreImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package io.grpc.xds;
1818

1919
import static com.google.common.base.Preconditions.checkNotNull;
20+
import static java.util.concurrent.TimeUnit.NANOSECONDS;
2021

2122
import com.google.common.annotations.VisibleForTesting;
2223
import com.google.common.base.Stopwatch;
@@ -33,7 +34,6 @@
3334
import java.util.Map;
3435
import java.util.concurrent.ConcurrentHashMap;
3536
import java.util.concurrent.ConcurrentMap;
36-
import java.util.concurrent.TimeUnit;
3737
import java.util.concurrent.atomic.AtomicLong;
3838
import javax.annotation.Nullable;
3939
import javax.annotation.concurrent.NotThreadSafe;
@@ -113,7 +113,7 @@ public ClusterStats generateLoadReport() {
113113
statsBuilder.addDroppedRequests(new DroppedRequests(entry.getKey(),drops));
114114
}
115115
statsBuilder.setTotalDroppedRequests(totalDrops);
116-
statsBuilder.setLoadReportIntervalNanos(stopwatch.elapsed(TimeUnit.NANOSECONDS));
116+
statsBuilder.setLoadReportIntervalNanos(stopwatch.elapsed(NANOSECONDS));
117117
stopwatch.reset().start();
118118
return statsBuilder.build();
119119
}

xds/src/main/java/io/grpc/xds/PriorityLoadBalancer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ public void run() {
260260
policy = newPolicy;
261261
lb.switchTo(lbProvider);
262262
}
263-
// TODO(zdapeng): Implement address filtering.
264263
lb.handleResolvedAddresses(
265264
addresses
266265
.toBuilder()

xds/src/main/java/io/grpc/xds/internal/certprovider/CertProviderSslContextProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected CertProviderSslContextProvider(
8383
}
8484
}
8585

86-
private CertificateProviderInfo getCertProviderConfig(
86+
private static CertificateProviderInfo getCertProviderConfig(
8787
Map<String, CertificateProviderInfo> certProviders, String pluginInstanceName) {
8888
return certProviders.get(pluginInstanceName);
8989
}

xds/src/main/java/io/grpc/xds/internal/rbac/engine/AuthorizationDecision.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,20 @@ public ImmutableList<String> getPolicyNames() {
7171
public String toString() {
7272
StringBuilder authzStr = new StringBuilder();
7373
switch (this.decision) {
74-
case ALLOW:
74+
case ALLOW:
7575
authzStr.append("Authorization Decision: ALLOW. \n");
7676
break;
77-
case DENY:
77+
case DENY:
7878
authzStr.append("Authorization Decision: DENY. \n");
7979
break;
80-
case UNKNOWN:
80+
case UNKNOWN:
8181
authzStr.append("Authorization Decision: UNKNOWN. \n");
8282
break;
83-
default:
83+
default:
8484
break;
8585
}
8686
for (String policyName : this.policyNames) {
87-
authzStr.append(policyName + "; \n");
87+
authzStr.append(policyName).append("; \n");
8888
}
8989
return authzStr.toString();
9090
}

0 commit comments

Comments
 (0)