Skip to content

Commit

Permalink
IGNITE-16900 Checkstyle LeftCurly rule added (apache#9999)
Browse files Browse the repository at this point in the history
  • Loading branch information
nizhikov authored May 5, 2022
1 parent 7357847 commit de436d6
Show file tree
Hide file tree
Showing 197 changed files with 767 additions and 644 deletions.
2 changes: 1 addition & 1 deletion checkstyle/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress checks="EmptyLineSeparator|MethodParamPad|SingleSpaceSeparator"
<suppress checks="LeftCurly|EmptyLineSeparator|MethodParamPad|SingleSpaceSeparator"
files="BCrypt\.java|ConcurrentLinkedDeque8\.java"/>
<suppress checks="NoWhitespaceBefore" files="ConcurrentLinkedHashMap\.java"/>
<suppress checks="LineLength"
Expand Down
2 changes: 2 additions & 0 deletions checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@
</module>

<module name="Indentation" />

<module name="LeftCurly"/>
</module>

<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ public enum MLSandboxDatasets {
}

/** */
public String getFileName() { return filename; }
public String getFileName() {
return filename;
}

/** */
public boolean hasHeader() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,9 @@ private static final class TestEventListener implements IgnitePredicate<Event> {
/**
* @param cnt Deploy counter.
*/
private TestEventListener(AtomicInteger cnt) { this.cnt = cnt; }
private TestEventListener(AtomicInteger cnt) {
this.cnt = cnt;
}

/** {@inheritDoc} */
@Override public boolean apply(Event evt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ public final class BaseQueryContext extends AbstractQueryContext {
new RelMetadataProvider() {
@Override public <M extends Metadata> UnboundMetadata<M> apply(
Class<? extends RelNode> relCls,
Class<? extends M> metadataCls)
{
Class<? extends M> metadataCls) {
throw new AssertionError(cantBeUsedMsg);
}

Expand All @@ -131,7 +130,9 @@ public final class BaseQueryContext extends AbstractQueryContext {
}
);

CLUSTER.setMetadataQuerySupplier(() -> { throw new AssertionError(cantBeUsedMsg); });
CLUSTER.setMetadataQuerySupplier(() -> {
throw new AssertionError(cantBeUsedMsg);
});
}

/** */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public IgniteTypeCoercion(RelDataTypeFactory typeFactory, SqlValidator validator
SqlValidatorScope scope,
SqlCall call,
int idx,
RelDataType targetType)
{
RelDataType targetType
) {
if (targetType instanceof IgniteCustomType) {
SqlNode operand = call.getOperandList().get(idx);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,7 @@ private static boolean fillRecursive(
Set<Pair<RelTraitSet, List<RelTraitSet>>> result,
RelTraitSet[] combination,
int idx
) throws ControlFlowException
{
) throws ControlFlowException {
boolean processed = false, last = idx == inTraits.size() - 1;
for (RelTraitSet t : inTraits.get(idx)) {
assert t.getConvention() == IgniteConvention.INSTANCE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ public ScanAwareTable(RelDataType rowType) {
ColocationGroup grp,
Predicate<Row> filter,
Function<Row, Row> transformer,
ImmutableBitSet bitSet)
{
ImmutableBitSet bitSet
) {
lastScanHasFilter = filter != null;
lastScanHasProject = transformer != null;
return Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,16 @@ public void testTreeSetRestrictions() throws Exception {

try {
// Add several objects with the same hash without neither natural ordering nor comparator.
hash.addNode(new Object() { @Override public int hashCode() { return 0; } }, 1);
hash.addNode(new Object() { @Override public int hashCode() { return 0; } }, 1);
hash.addNode(new Object() {
@Override public int hashCode() {
return 0;
}
}, 1);
hash.addNode(new Object() {
@Override public int hashCode() {
return 0;
}
}, 1);

fail("Expects failed due to internal TreeSet requires comparator or natural ordering.");
}
Expand All @@ -122,8 +130,16 @@ public void testTreeSetRestrictions() throws Exception {
}, null);

// Add several objects with the same hash into consistent hash with explicit comparator.
hash.addNode(new Object() { @Override public int hashCode() { return 0; } }, 1);
hash.addNode(new Object() { @Override public int hashCode() { return 0; } }, 1);
hash.addNode(new Object() {
@Override public int hashCode() {
return 0;
}
}, 1);
hash.addNode(new Object() {
@Override public int hashCode() {
return 0;
}
}, 1);

info("Expected pass due to internal TreeSet has explicit comparator.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ private void countAndPrintSummary(Collection<TestThread> workers, long startTime

int thCnt = workers.size();

for (TestThread t : workers) { total += t.iters; }
for (TestThread t : workers) {
total += t.iters;
}

double timeSpent = ((double)(System.currentTimeMillis() - startTime)) / 1000;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,7 @@ private void initComputeService() {
finally {
initLatch.countDown();
}
else
{
else {
try {
U.await(initLatch);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ public UUID nodeId() {
/**
* @return Output format.
*/
public OutputFormat outputFormat() { return outputFormat; }
public OutputFormat outputFormat() {
return outputFormat;
}

/**
* @return Cache view command.
Expand All @@ -145,7 +147,9 @@ public VisorViewCacheCmd cacheCommand() {
/**
* @return Full config flag.
*/
public boolean fullConfig() { return fullConfig; }
public boolean fullConfig() {
return fullConfig;
}
}

/** Command parsed arguments */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@

/** */
public class MetadataDetailsCommand
extends MetadataAbstractSubCommand<MetadataTypeArgs, MetadataListResult>
{
extends MetadataAbstractSubCommand<MetadataTypeArgs, MetadataListResult> {
/** {@inheritDoc} */
@Override protected String taskName() {
return MetadataInfoTask.class.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@

/** */
public class MetadataListCommand
extends MetadataAbstractSubCommand<VoidDto, MetadataListResult>
{
extends MetadataAbstractSubCommand<VoidDto, MetadataListResult> {
/** {@inheritDoc} */
@Override protected String taskName() {
return MetadataInfoTask.class.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@

/** */
public class MetadataUpdateCommand
extends MetadataAbstractSubCommand<MetadataMarshalled, MetadataMarshalled>
{
extends MetadataAbstractSubCommand<MetadataMarshalled, MetadataMarshalled> {
/** Output file name. */
public static final String IN_FILE_NAME = "--in";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
import org.apache.ignite.internal.commandline.property.tasks.PropertyTask;

/** */
public class PropertyGetCommand extends PropertyAbstractSubCommand<PropertyArgs, PropertyOperationResult>
{
public class PropertyGetCommand extends PropertyAbstractSubCommand<PropertyArgs, PropertyOperationResult> {
/** {@inheritDoc} */
@Override protected String taskName() {
return PropertyTask.class.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
import org.apache.ignite.internal.commandline.property.tasks.PropertiesListTask;

/** */
public class PropertyListCommand extends PropertyAbstractSubCommand<VoidDto, PropertiesListResult>
{
public class PropertyListCommand extends PropertyAbstractSubCommand<VoidDto, PropertiesListResult> {
/** {@inheritDoc} */
@Override protected String taskName() {
return PropertiesListTask.class.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
import org.apache.ignite.internal.commandline.property.tasks.PropertyTask;

/** */
public class PropertySetCommand extends PropertyAbstractSubCommand<PropertyArgs, PropertyOperationResult>
{
public class PropertySetCommand extends PropertyAbstractSubCommand<PropertyArgs, PropertyOperationResult> {
/** {@inheritDoc} */
@Override protected String taskName() {
return PropertyTask.class.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,7 @@ private boolean waitForIndexesRebuild(IgniteEx ignite) throws IgniteInterruptedC
* @throws IgniteInterruptedCheckedException if failed.
*/
private boolean waitForIndexesRebuild(IgniteEx ignite, long timeout, Collection<String> excludedCacheNames)
throws IgniteInterruptedCheckedException
{
throws IgniteInterruptedCheckedException {
return GridTestUtils.waitForCondition(
() -> ignite.context().cache().publicCaches()
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ static void createAndFillThreeFieldsEntryCache(
final Ignite ignite,
final String cacheName,
final String grpName,
final Collection<QueryEntity> entities)
{
final Collection<QueryEntity> entities
) {
assert nonNull(ignite);
assert nonNull(cacheName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ public static <R> ComputeTaskInternalFuture<R> finishedFuture(final GridKernalCo
@Override public void saveCheckpoint(String key,
Object state,
ComputeTaskSessionScope scope,
long timeout)
{
long timeout
) {
throw new IgniteException("Session was closed.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public GridJobExecuteResponse(UUID nodeId,
byte[] jobAttrsBytes,
Map<Object, Object> jobAttrs,
boolean isCancelled,
AffinityTopologyVersion retry)
{
AffinityTopologyVersion retry
) {
assert nodeId != null;
assert sesId != null;
assert jobId != null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ public IgniteDiagnosticMessage() {
*/
public static IgniteDiagnosticMessage createRequest(Marshaller marsh,
IgniteClosure<GridKernalContext, IgniteDiagnosticInfo> c,
long futId)
throws IgniteCheckedException
{
long futId
) throws IgniteCheckedException {
byte[] cBytes = U.marshal(marsh, c);

IgniteDiagnosticMessage msg = new IgniteDiagnosticMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,11 @@ public void checkHasClassName(String clsName, ClassLoader ldr, String fileName)
}

/** {@inheritDoc} */
@Override public boolean registerClassNameLocally(byte platformId, int typeId, String clsName)
throws IgniteCheckedException
{
@Override public boolean registerClassNameLocally(
byte platformId,
int typeId,
String clsName
) throws IgniteCheckedException {
ConcurrentMap<Integer, MappedName> cache = getCacheFor(platformId);

fileStore.mergeAndWriteMapping(platformId, typeId, clsName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public IndexKeyTypeSettings stringOptimizedCompare(boolean strOptimizedCompare)
}

/** */
public boolean binaryUnsigned() { return binaryUnsigned; }
public boolean binaryUnsigned() {
return binaryUnsigned;
}

/** */
public IndexKeyTypeSettings binaryUnsigned(boolean binaryUnsigned) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public IgniteClusterAsyncImpl(IgniteClusterImpl cluster) {
@Override public Collection<ClusterStartNodeResult> startNodes(File file,
boolean restart,
int timeout,
int maxConn)
{
int maxConn
) {
try {
return saveOrGet(cluster.startNodesAsync0(file, restart, timeout, maxConn));
}
Expand All @@ -127,8 +127,8 @@ public IgniteClusterAsyncImpl(IgniteClusterImpl cluster) {
@Nullable Map<String, Object> dflts,
boolean restart,
int timeout,
int maxConn)
{
int maxConn
) {
try {
return saveOrGet(cluster.startNodesAsync0(hosts, dflts, restart, timeout, maxConn));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ public MaintenanceProcessor(GridKernalContext ctx) {
/** {@inheritDoc} */
@Override public void prepareAndExecuteMaintenance() {
if (isMaintenanceMode()) {
workflowCallbacks.entrySet().removeIf(cbE ->
{
workflowCallbacks.entrySet().removeIf(cbE -> {
if (!cbE.getValue().shouldProceedWithMaintenance()) {
unregisterMaintenanceTask(cbE.getKey());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ public boolean storeCheckpoint(GridTaskSessionInternal ses,
Object state,
ComputeTaskSessionScope scope,
long timeout,
boolean override)
throws IgniteCheckedException
{
boolean override
) throws IgniteCheckedException {
if (!enabled())
return false;

Expand Down
Loading

0 comments on commit de436d6

Please sign in to comment.