Skip to content

Commit

Permalink
Merge pull request #496 from ashigeru/wip/misc/suppress-checkstyle
Browse files Browse the repository at this point in the history
Reduce checkstyle warnings.
  • Loading branch information
akirakw committed Jul 2, 2015
2 parents 717e281 + b89c4d8 commit 4aa3437
Show file tree
Hide file tree
Showing 21 changed files with 80 additions and 26 deletions.
2 changes: 2 additions & 0 deletions asakusa-parent/pom.xml
Expand Up @@ -413,6 +413,8 @@ encoding/<project>=UTF-8
</dependencies>
<configuration>
<configLocation>com/asakusafw/checkstyle.xml</configLocation>
<suppressionsLocation>com/asakusafw/checkstyle-suppressions.xml</suppressionsLocation>
<suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
</configuration>
</plugin>
</plugins>
Expand Down
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress checks="FileLength" files="com.asakusafw.utils.java.model.syntax.ModelFactory\.java"/>
<suppress checks="FileLength" files="com.asakusafw.utils.java.internal.model.syntax.ModelFactoryImpl\.java"/>
</suppressions>
6 changes: 6 additions & 0 deletions build-tools/src/main/resources/com/asakusafw/checkstyle.xml
Expand Up @@ -13,6 +13,7 @@ Asakusa Framework Checks
<property name="severity" value="warning"/>
<module name="TreeWalker">
<property name="tabWidth" value="4"/>
<module name="FileContentsHolder"/>
<module name="JavadocMethod">
<property name="scope" value="protected"/>
<property name="allowUndeclaredRTE" value="true"/>
Expand Down Expand Up @@ -155,4 +156,9 @@ Asakusa Framework Checks
<property name="message" value="Line has trailing spaces."/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE\:OFF\s+([\w\|\.\*]+)"/>
<property name="onCommentFormat" value="CHECKSTYLE\:ON\s+([\w\|\.\*]+)"/>
<property name="checkFormat" value="$1"/>
</module>
</module>
Expand Up @@ -91,6 +91,7 @@ public ResultOutput(
this.counters = counters;
}

// CHECKSTYLE:OFF JavadocMethodCheck - Result.OutputException is ignored by checkstyle
/**
* Writes a key and value into current context.
* @param context current context
Expand All @@ -108,6 +109,7 @@ public static <K, V> void write(TaskInputOutputContext<?, ?, ? super K, ? super
throw new Result.OutputException(e);
}
}
// CHECKSTYLE:ON JavadocMethodCheck

@Override
public void add(T result) {
Expand Down
Expand Up @@ -198,11 +198,13 @@ protected int execute(String[] args) {
cleanResult = false;
} finally {
if (fs != null) {
// CHECKSTYLE:OFF EmptyBlockCheck
try {
fs.close();
} catch (IOException ignored) {
// ignored
}
// CHECKSTYLE:ON EmptyBlockCheck
}
}
}
Expand Down
Expand Up @@ -23,6 +23,7 @@
*/
public class ColumnInfo {

// CHECKSTYLE:OFF ParameterNumberCheck
/**
* インスタンスを生成する。
* @param tableName テーブル名
Expand Down Expand Up @@ -60,72 +61,73 @@ public ColumnInfo(String tableName, String columnName,
getterName = "get" + javaName.toTypeName() + "Option";
setterName = "set" + javaName.toTypeName() + "Option";
}
// CHECKSTYLE:ON ParameterNumberCheck

/**
* テーブル名。
*/
private String tableName;
private final String tableName;

/**
* カラム名。
*/
private String columnName;
private final String columnName;

/**
* カラムコメント。
*/
private String columnComment;
private final String columnComment;

/**
* カラムのデータ型。
*/
private MySqlDataType dataType;
private final MySqlDataType dataType;

/**
* 文字列型カラムの最大長。
*/
private long characterMaximumLength;
private final long characterMaximumLength;

/**
* Decimal型カラムの桁数。
*/
private int numericPrecision;
private final int numericPrecision;

/**
* Decimal型カラムの精度。
*/
private int numericScale;
private final int numericScale;

/**
* NULL可フラグ。
*/
private boolean nullable;
private final boolean nullable;

/**
* Key項目フラグ。
*/
private boolean key;
private final boolean key;

/**
* テスト条件。
*/
private ColumnMatchingCondition columnMatchingCondition;
private final ColumnMatchingCondition columnMatchingCondition;


/**
* NULL値の扱い。
*/
private NullValueCondition nullValueCondition;
private final NullValueCondition nullValueCondition;

/**
* JavaBeansのgetter名。
*/
private String getterName;
private final String getterName;

/**
* JavaBeansのsetter名。
*/
private String setterName;
private final String setterName;


/**
Expand Down
Expand Up @@ -47,7 +47,7 @@ public abstract class AbstractInspector implements Inspector {
/**
* KEYカラムの情報。
*/
private List<ColumnInfo> keyColumnInfos = new ArrayList<ColumnInfo>();
private final List<ColumnInfo> keyColumnInfos = new ArrayList<ColumnInfo>();

/**
* テストの開始時刻。
Expand All @@ -63,7 +63,7 @@ public abstract class AbstractInspector implements Inspector {
/**
* NG原因のリスト。
*/
private List<Cause> causes = new ArrayList<Cause>();
private final List<Cause> causes = new ArrayList<Cause>();


/**
Expand Down Expand Up @@ -229,11 +229,7 @@ protected final ValueOption<?> getValue(Writable model, ColumnInfo info) {

@Override
public boolean isSuccess() {
if (causes.size() == 0) {
return true;
} else {
return false;
}
return causes.isEmpty();
}

/**
Expand Down
Expand Up @@ -75,7 +75,7 @@ public <V> ModelOutput<V> createOutput(DataModelDefinition<V> definition,
try {
conn.close();
} catch (SQLException e) {
// ignored.
LOG.warn("error occurred while closing database connection", e);
}
}
}
Expand All @@ -99,7 +99,7 @@ public <V> DataModelSource createSource(DataModelDefinition<V> definition,
try {
conn.close();
} catch (SQLException e) {
// ignored.
LOG.warn("error occurred while closing database connection", e);
}
}
}
Expand Down
Expand Up @@ -72,7 +72,7 @@ public <V> ModelOutput<V> createOutput(
try {
conn.close();
} catch (SQLException e) {
// ignored.
LOG.warn("error occurred while closing database connection", e);
}
}
}
Expand Down
Expand Up @@ -104,7 +104,7 @@ public Map<String, FileProtocol.Kind> delete(
results = downstream.get(1, TimeUnit.SECONDS);
break;
} catch (TimeoutException e) {
// will retry
LOG.debugMessage("trying retry"); //$NON-NLS-1$
} catch (CancellationException e) {
upstream.cancel(true);
downstream.cancel(true);
Expand Down
Expand Up @@ -105,7 +105,7 @@ public Map<String, CacheInfo> get(ImportBean bean) throws BulkLoaderSystemExcept
result = downstream.get(1, TimeUnit.SECONDS);
break;
} catch (TimeoutException e) {
// will retry
LOG.debugMessage("trying retry"); //$NON-NLS-1$
} catch (CancellationException e) {
upstream.cancel(true);
downstream.cancel(true);
Expand Down
Expand Up @@ -187,6 +187,8 @@ protected static void checkAndSetParamHC() throws BulkLoaderSystemException {
Constants.PROP_DEFAULT_CACHE_BUILDER_PARALLEL);
}
}

// CHECKSTYLE:OFF MethodLengthCheck - FIXME refactoring
/**
* DBサーバのプロパティの必須チェックとデフォルト値を設定する。
* @throws BulkLoaderSystemException プロパティの中身が不正であった場合
Expand Down Expand Up @@ -346,6 +348,8 @@ protected static void checkAndSetParamDB() throws BulkLoaderSystemException {
"エクスポートファイルを置くディレクトリが設定されていません");
}
}
// CHECKSTYLE:ON MethodLengthCheck

/**
* 共通のプロパティの必須チェックとデフォルト値を設定する。
*/
Expand Down
Expand Up @@ -324,6 +324,8 @@ private String createDupSelectCondition(ExportTargetTableBean expTableBean,
selectCondition.append(maxRecord);
return selectCondition.toString();
}

// CHECKSTYLE:OFF MethodLengthCheck - FIXME refactoring
/**
* 更新データをExport対象テーブルにコピーする。
* テーブルロックを取得していない場合、コピーしたデータは行ロック状態に更新する。
Expand Down Expand Up @@ -519,6 +521,8 @@ private boolean copyUpdateData(
return false;
}
}
// CHECKSTYLE:ON MethodLengthCheck

/**
* 更新レコードコピーでエラーになったレコードを取得するSQLを作成する。
* @param tempTableName テンポラリテーブル名
Expand Down
Expand Up @@ -49,6 +49,7 @@ public class ExportFileReceive {

static final Log LOG = new Log(ExportFileReceive.class);

// CHECKSTYLE:OFF MethodLengthCheck - FIXME refactoring
/**
* HDFSのNameノードのCollectorを呼出し、Exportファイルを受信してローカルにファイルを書き出す。
* @param bean パラメータを保持するBean
Expand Down Expand Up @@ -220,6 +221,7 @@ public boolean receiveFile(ExporterBean bean) {
}
return true;
}
// CHECKSTYLE:ON MethodLengthCheck

/**
* ファイルに対するアウトプットストリームを作成する。
Expand Down
Expand Up @@ -62,6 +62,7 @@ public static void main(String[] args) {
System.exit(result);
}

// CHECKSTYLE:OFF MethodLengthCheck - FIXME refactoring
/**
* Exporterの処理を実行する。
* @param args コマンドライン引数
Expand Down Expand Up @@ -260,6 +261,8 @@ protected int execute(String[] args) {
DBAccessUtil.releaseJobflowInstanceLock(lockConn);
}
}
// CHECKSTYLE:ON MethodLengthCheck

/**
* パラメータを保持するBeanを作成する。
* @param targetName ターゲット名
Expand Down
Expand Up @@ -143,6 +143,7 @@ protected int execute(String[] args) {
}
}

// CHECKSTYLE:OFF MethodLengthCheck - FIXME refactoring
/**
* Imports tables described in the specified bean.
* @param bean target
Expand Down Expand Up @@ -305,6 +306,7 @@ public int importTables(ImportBean bean) throws BulkLoaderSystemException, BulkL
}
}
}
// CHECKSTYLE:ON MethodLengthCheck

/**
* パラメータを保持するBeanを作成する。
Expand Down
Expand Up @@ -248,6 +248,7 @@ private int judgeExitCode(String targetName, String executionId) {
}
}

// CHECKSTYLE:OFF MethodLengthCheck - FIXME refactoring
/**
* リカバリ処理を行う。
* 処理結果として以下の通り戻り値を返す。
Expand Down Expand Up @@ -409,8 +410,9 @@ private void recovery(ExporterBean exporterBean) throws BulkLoaderSystemExceptio
// ジョブフローインスタンスIDの排他を解除
DBAccessUtil.releaseJobflowInstanceLock(lockConn);
}

}
// CHECKSTYLE:ON MethodLengthCheck

/**
* 当該ジョブフローインスタンスがリカバリ対象かどうかを判断する。
* @param exporterBean Exporterで使用するパラメータを保持するオブジェクト
Expand Down
Expand Up @@ -19,12 +19,16 @@
import java.util.Collections;
import java.util.List;

import javax.annotation.Generated;

import com.asakusafw.utils.java.internal.model.util.ExpressionPriority;
import com.asakusafw.utils.java.model.syntax.*;

//CHECKSTYLE:OFF
/**
* {@link ModelFactory}の実装。
*/
@Generated("com.asakusafw.utils.java.model.syntax.ModelFactory")
public class ModelFactoryImpl implements ModelFactory {

@Override
Expand Down Expand Up @@ -2369,3 +2373,4 @@ private Expression parenthesizeRight(Expression expression, ExpressionPriority c
}
}
}
//CHECKSTYLE:ON
Expand Up @@ -17,9 +17,12 @@

import java.util.List;

import javax.annotation.Generated;

/**
* {@link Model}を生成するファクトリのインターフェース。
*/
@Generated("com.asakusafw.utils.java.model.syntax.ModelFactory")
public interface ModelFactory {

/**
Expand Down

0 comments on commit 4aa3437

Please sign in to comment.