Skip to content

Commit 923c682

Browse files
committed
Fix empty block checkstyle issues and ensure that DBMS names are written in lowercase
1 parent d27ffd5 commit 923c682

9 files changed

Lines changed: 16 additions & 25 deletions

File tree

checkstyle.xml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
<!-- Checks for blocks. You know, those {}'s -->
154154
<!-- See https://checkstyle.org/config_blocks.html -->
155155
<module name="AvoidNestedBlocks"/>
156-
<!-- TODO: <module name="EmptyBlock"/> -->
156+
<module name="EmptyBlock"/>
157157
<module name="LeftCurly"/>
158158
<module name="NeedBraces"/>
159159
<module name="RightCurly"/>
@@ -186,13 +186,10 @@
186186
<!-- <module name="TodoComment"/> -->
187187
<module name="UpperEll"/>
188188

189-
<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
190-
<module name="SuppressionXpathFilter">
191-
<property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}"
192-
default="checkstyle-xpath-suppressions.xml" />
193-
<property name="optional" value="true"/>
194-
</module>
195189

190+
191+
<module name="SuppressionCommentFilter"/>
192+
196193
</module>
197194

198195
</module>

src/sqlancer/Main.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ public static void main(String[] args) {
282282
Builder commandBuilder = JCommander.newBuilder().addObject(options);
283283
for (DatabaseProvider<?, ?> provider : providers) {
284284
String name = provider.getDBMSName();
285+
if (!name.toLowerCase().equals(name)) {
286+
throw new AssertionError(name + " should be in lowercase!");
287+
}
285288
Object command = provider.getCommand();
286289
if (command == null) {
287290
throw new IllegalStateException();

src/sqlancer/clickhouse/ClickhouseProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public Connection createDatabase(GlobalState<?> globalState) throws SQLException
148148

149149
@Override
150150
public String getDBMSName() {
151-
return "Clickhouse";
151+
return "clickhouse";
152152
}
153153

154154
@Override

src/sqlancer/duckdb/DuckDBProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public Connection createDatabase(GlobalState<?> globalState) throws SQLException
176176

177177
@Override
178178
public String getDBMSName() {
179-
return "DuckDB";
179+
return "duckdb";
180180
}
181181

182182
@Override

src/sqlancer/mysql/gen/MySQLTableGenerator.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ private Query create() {
4545
List<String> errors = new ArrayList<>();
4646

4747
sb.append("CREATE");
48-
if (Randomly.getBoolean()) {
49-
// sb.append(" TEMPORARY"); // FIXME support temporary tables in the schema
50-
}
48+
// TODO support temporary tables in the schema
5149
sb.append(" TABLE");
5250
if (Randomly.getBoolean()) {
5351
sb.append(" IF NOT EXISTS");

src/sqlancer/mysql/test/MySQLPivotedQuerySynthesisTester.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ public void check() throws SQLException {
5656
throw new AssertionError(queryString);
5757
}
5858
} catch (SQLException e) {
59-
if (e.getMessage().contains("BIGINT value is out of range")) {
60-
// IGNORE
61-
} else {
59+
if (!e.getMessage().contains("BIGINT value is out of range")) {
6260
throw e;
6361
}
6462
}

src/sqlancer/postgres/gen/PostgresQueryCatalogGenerator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ public static Query query() {
3636
public boolean execute(Connection con) throws SQLException {
3737
try (Statement s = con.createStatement()) {
3838
try (ResultSet rs = s.executeQuery(getQueryString())) {
39+
// CHECKSTYLE:OFF
3940
while (rs.next()) {
40-
// do nothing
41+
// only force the DBMS to fetch the records and hope that they cause an
42+
// invalid state
4143
}
44+
// CHECKSTYLE:ON
4245
}
4346
}
4447
return true;

src/sqlancer/sqlite3/ast/SQLite3Cast.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,6 @@ private static boolean unprintAbleCharThatLetsBecomeNumberZero(String s) {
218218

219219
static Connection castDatabase;
220220

221-
static {
222-
// try {
223-
//// castDatabase = new SQLite3Provider().createDatabase("test", null);
224-
// } catch (SQLException e) {
225-
// throw new AssertionError(e);
226-
// }
227-
}
228-
229221
public static SQLite3Constant castToText(SQLite3Constant cons) {
230222
if (cons.getDataType() == SQLite3DataType.TEXT) {
231223
return cons;

src/sqlancer/tidb/TiDBProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public Connection createDatabase(GlobalState<?> globalState) throws SQLException
213213

214214
@Override
215215
public String getDBMSName() {
216-
return "TiDB";
216+
return "tidb";
217217
}
218218

219219
@Override

0 commit comments

Comments
 (0)