Run IntelliJ inspections on Travis (#9179)

* Run IntelliJ inspections on Travis

Running IntelliJ inspections currently takes about 90 minutes, but they
can be run in about 30 minutes on Travis.

* Restore assert statements
This commit is contained in:
Chi Cao Minh 2020-02-19 00:34:19 -08:00 committed by GitHub
parent 73a0181e34
commit e7eb45e648
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 39 additions and 22 deletions

View File

@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="JavaInspectionsScope" pattern="file:*.java||file:pom.xml" />
</component>

View File

@ -120,6 +120,17 @@ jobs:
" && false; }
- name: "intellij inspections"
script: >
docker run --rm
-v $(pwd):/project
-v ~/.m2:/home/inspect/.m2
ccaominh/intellij-inspect:1.0.0
/project/pom.xml
/project/.idea/inspectionProfiles/Druid.xml
--levels ERROR
--scope JavaInspectionsScope
- &package
name: "(openjdk8) packaging check"
install: skip

View File

@ -33,7 +33,7 @@ public abstract class ThreadRenamingCallable<T> implements Callable<T>
}
@Override
public final T call() throws Exception
public final T call()
{
final Thread currThread = Thread.currentThread();
String currName = currThread.getName();

View File

@ -164,7 +164,7 @@ public abstract class IntermediateRowParsingReader<T> implements InputEntityRead
}
@Override
public void close() throws IOException
public void close()
{
// do nothing
}

View File

@ -185,7 +185,7 @@ public class InfluxdbEmitter implements Emitter
}
@Override
public void flush() throws IOException
public void flush()
{
if (started.get()) {
transformAndSendToInfluxdb(eventsQueue);
@ -193,7 +193,7 @@ public class InfluxdbEmitter implements Emitter
}
@Override
public void close() throws IOException
public void close()
{
flush();
log.info("Closing [%s]", this.getClass().getName());

View File

@ -27,7 +27,6 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.util.Arrays;
public class InfluxdbEmitterConfigTest
@ -57,7 +56,7 @@ public class InfluxdbEmitterConfigTest
}
@Test
public void testInfluxdbEmitterConfigObjectsAreDifferent() throws IOException
public void testInfluxdbEmitterConfigObjectsAreDifferent()
{
InfluxdbEmitterConfig influxdbEmitterConfigComparison = new InfluxdbEmitterConfig(
"localhost",
@ -74,7 +73,7 @@ public class InfluxdbEmitterConfigTest
}
@Test(expected = NullPointerException.class)
public void testConfigWithNullHostname() throws IOException
public void testConfigWithNullHostname()
{
InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new InfluxdbEmitterConfig(
null,
@ -90,7 +89,7 @@ public class InfluxdbEmitterConfigTest
}
@Test
public void testConfigWithNullPort() throws IOException
public void testConfigWithNullPort()
{
InfluxdbEmitterConfig influxdbEmitterConfigWithNullPort = new InfluxdbEmitterConfig(
"localhost",
@ -142,7 +141,7 @@ public class InfluxdbEmitterConfigTest
}
@Test(expected = NullPointerException.class)
public void testConfigWithNullInfluxdbUserName() throws IOException
public void testConfigWithNullInfluxdbUserName()
{
InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new InfluxdbEmitterConfig(
"localhost",
@ -158,7 +157,7 @@ public class InfluxdbEmitterConfigTest
}
@Test(expected = NullPointerException.class)
public void testConfigWithNullInfluxdbPassword() throws IOException
public void testConfigWithNullInfluxdbPassword()
{
InfluxdbEmitterConfig influxdbEmitterConfigWithNullHostname = new InfluxdbEmitterConfig(
"localhost",

View File

@ -29,7 +29,7 @@ public class DoubleSumAveragerTest
{
@Test
public void testComputeResult() throws Exception
public void testComputeResult()
{
BaseAverager<Number, Double> avg = new DoubleSumAverager(3, "test", "field", 1);

View File

@ -45,7 +45,7 @@ public class DecimalParquetInputTest extends BaseParquetInputTest
private final String parserType;
public DecimalParquetInputTest(String parserType) throws IOException
public DecimalParquetInputTest(String parserType)
{
this.parserType = parserType;
}

View File

@ -45,6 +45,8 @@ public interface GroupByVectorColumnSelector
* @param startRow starting row (inclusive) within the current vector
* @param endRow ending row (exclusive) within the current vector
*/
// False positive unused inspection warning for "keySize": https://youtrack.jetbrains.com/issue/IDEA-231034
@SuppressWarnings("unused")
void writeKeys(WritableMemory keySpace, int keySize, int keyOffset, int startRow, int endRow);
/**

View File

@ -99,7 +99,7 @@ public class ColumnSelectorBitmapIndexSelector implements BitmapIndexSelector
}
@Override
public void close() throws IOException
public void close()
{
}

View File

@ -121,6 +121,7 @@ public interface ColumnarDoubles extends Closeable
@Override
public double getDouble()
{
//noinspection AssertWithSideEffects (ignore null handling test initialization check side effect)
assert NullHandling.replaceWithDefault() || !isNull();
return ColumnarDoubles.this.get(offset.getOffset());
}

View File

@ -121,6 +121,7 @@ public interface ColumnarFloats extends Closeable
@Override
public float getFloat()
{
//noinspection AssertWithSideEffects (ignore null handling test initialization check side effect)
assert NullHandling.replaceWithDefault() || !isNull();
return ColumnarFloats.this.get(offset.getOffset());
}

View File

@ -121,6 +121,7 @@ public interface ColumnarLongs extends Closeable
@Override
public long getLong()
{
//noinspection AssertWithSideEffects (ignore null handling test initialization check side effect)
assert NullHandling.replaceWithDefault() || !isNull();
return ColumnarLongs.this.get(offset.getOffset());
}

View File

@ -129,7 +129,7 @@ public class StringColumnAggregationTest
}
@After
public void tearDown() throws Exception
public void tearDown()
{
if (segments != null) {
for (Segment seg : segments) {

View File

@ -56,7 +56,7 @@ public class DoubleMeanAggregationTest
private final List<Segment> segments;
public DoubleMeanAggregationTest() throws Exception
public DoubleMeanAggregationTest()
{
groupByQueryTestHelper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(

View File

@ -61,7 +61,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@ -101,7 +100,7 @@ public class ScanQueryRunnerTest extends InitializedNullHandlingTest
int count = 0;
@Override
public boolean processLine(String line) throws IOException
public boolean processLine(String line)
{
if (count >= startLineNum && count < endLineNum) {
lines.add(line);

View File

@ -173,7 +173,7 @@ public class CaffeineCacheTest
}
@Test
public void testSizeEviction() throws Exception
public void testSizeEviction()
{
final CaffeineCacheConfig config = new CaffeineCacheConfig()
{

View File

@ -48,7 +48,7 @@ public class SqlSegmentsMetadataManagerEmptyTest
private final ObjectMapper jsonMapper = TestHelper.makeJsonMapper();
@Before
public void setUp() throws Exception
public void setUp()
{
TestDerbyConnector connector = derbyConnectorRule.getConnector();
SegmentsMetadataManagerConfig config = new SegmentsMetadataManagerConfig();

View File

@ -35,7 +35,7 @@ public class RequestLogLineTest
private Query query;
@Before
public void setUp() throws Exception
public void setUp()
{
query = new TimeBoundaryQuery(
new TableDataSource("test"),
@ -47,7 +47,7 @@ public class RequestLogLineTest
}
@Test(expected = NullPointerException.class)
public void nullTimestamp() throws JsonProcessingException
public void nullTimestamp()
{
RequestLogLine requestLogLine = RequestLogLine.forNative(
query,
@ -58,7 +58,7 @@ public class RequestLogLineTest
}
@Test(expected = NullPointerException.class)
public void nullQueryStats() throws JsonProcessingException
public void nullQueryStats()
{
RequestLogLine requestLogLine = RequestLogLine.forNative(
query,