Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3c04232
Add Checkstyle config.
blackwinter Sep 4, 2021
0bef5fb
Disable Checkstyle runs against test sources.
blackwinter Sep 5, 2021
56c78b0
metafacture-biblio/ (main): Fix Checkstyle violations.
blackwinter Sep 4, 2021
5bb7af5
metafacture-commons/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
823fdde
metafacture-csv/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
713c413
metafacture-elasticsearch/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
cfef405
metafacture-files/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
7e744c7
metafacture-flowcontrol/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
c60f69d
metafacture-flux/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
ee5d3c9
metafacture-formatting/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
4956554
metafacture-formeta/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
2f8045f
metafacture-framework/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
7812615
metafacture-html/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
25401d5
metafacture-io/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
7e0ed18
metafacture-runner/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
5aa75d6
metafacture-scripting/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
d23f165
metafacture-plumbing/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
52c9559
metafacture-mangling/ (main): Fix Checkstyle violations.
blackwinter Sep 5, 2021
0cd5d86
metafacture-jdom/ (main): Fix Checkstyle violations.
blackwinter Sep 7, 2021
d3ad35b
metafacture-monitoring/ (main): Fix Checkstyle violations.
blackwinter Sep 7, 2021
1ff9662
metamorph-api/ (main): Fix Checkstyle violations.
blackwinter Sep 7, 2021
859d478
metafacture-linkeddata/ (main): Fix Checkstyle violations.
blackwinter Sep 7, 2021
54bd7a9
metafacture-json/ (main): Fix Checkstyle violations.
blackwinter Sep 7, 2021
000f06c
metafacture-statistics/ (main): Fix Checkstyle violations.
blackwinter Sep 7, 2021
b600d81
metafacture-strings/ (main): Fix Checkstyle violations.
blackwinter Sep 7, 2021
635f84f
metamorph-test/ (main): Fix Checkstyle violations.
blackwinter Sep 7, 2021
d1d49e8
metafacture-javaintegration/ (main): Fix Checkstyle violations.
blackwinter Sep 8, 2021
dfbeb84
metafacture-triples/ (main): Fix Checkstyle violations.
blackwinter Sep 8, 2021
0fc0346
metafacture-xml/ (main): Fix Checkstyle violations.
blackwinter Sep 8, 2021
85f3e2d
metamorph/ (main): Fix Checkstyle violations.
blackwinter Sep 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ subprojects {
apply plugin: 'signing'
apply plugin: 'maven'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'

check.dependsOn(editorconfigCheck)

Expand Down Expand Up @@ -85,6 +86,11 @@ subprojects {
archives javadocJar
}

checkstyle {
toolVersion '8.30'
checkstyleTest.enabled = false
}

signing {
required {
scmInfo.isRelease() && gradle.taskGraph.hasTask(tasks.uploadArchives)
Expand Down
167 changes: 167 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="SuppressWarningsFilter" />
<module name="SuppressionSingleFilter">
<property name="checks" value=".*"/>
<property name="files" value="generated-src"/>
</module>
<module name="TreeWalker">
<module name="AbstractClassName"/>
<module name="AnnotationUseStyle"/>
<module name="AnonInnerLength"/>
<module name="ArrayTypeStyle"/>
<module name="AvoidNestedBlocks"/>
<module name="AvoidNoArgumentSuperConstructorCall"/>
<module name="AvoidStarImport"/>
<module name="AvoidStaticImport"/>
<module name="BooleanExpressionComplexity"/>
<module name="CatchParameterName">
<property name="format" value="^e$"/>
</module>
<module name="ClassDataAbstractionCoupling"/>
<module name="ClassFanOutComplexity"/>
<module name="ClassTypeParameterName"/>
<module name="ConstantName"/>
<module name="CovariantEquals"/>
<module name="CustomImportOrder">
<property name="customImportOrderRules" value="SAME_PACKAGE(2)###THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###STATIC"/>
<property name="separateLineBetweenGroups" value="true"/>
</module>
<module name="CyclomaticComplexity"/>
<module name="DeclarationOrder"/>
<module name="DefaultComesLast"/>
<module name="EmptyLineSeparator">
<property name="allowMultipleEmptyLines" value="false"/>
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="EmptyStatement"/>
<module name="EqualsAvoidNull"/>
<module name="EqualsHashCode"/>
<module name="ExecutableStatementCount"/>
<module name="ExplicitInitialization"/>
<module name="FallThrough"/>
<module name="FinalLocalVariable">
<property name="validateEnhancedForLoopVariable" value="true"/>
</module>
<module name="FinalParameters">
<property name="tokens" value="CTOR_DEF,LITERAL_CATCH,METHOD_DEF"/>
</module>
<module name="GenericWhitespace"/>
<module name="HiddenField">
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
</module>
<module name="HideUtilityClassConstructor"/>
<module name="IllegalCatch"/>
<module name="IllegalThrows"/>
<module name="IllegalToken">
<property name="tokens" value="POST_INC,POST_DEC"/>
</module>
<module name="IllegalType"/>
<module name="Indentation"/>
<module name="InnerAssignment"/>
<module name="InnerTypeLast"/>
<module name="InterfaceIsType"/>
<module name="InterfaceTypeParameterName"/>
<module name="JavaNCSS"/>
<module name="JavadocType"/>
<module name="LambdaParameterName"/>
<module name="LeftCurly"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MagicNumber"/>
<module name="MemberName"/>
<module name="MethodLength"/>
<module name="MethodName"/>
<module name="MethodParamPad"/>
<module name="MethodTypeParameterName"/>
<module name="MissingCtor"/>
<module name="MissingDeprecated"/>
<module name="MissingOverride"/>
<module name="MissingSwitchDefault"/>
<module name="ModifiedControlVariable"/>
<module name="ModifierOrder"/>
<module name="MultipleStringLiterals">
<property name="allowedDuplicates" value="2"/>
<property name="ignoreStringsRegexp" value="^&quot;.?.?&quot;$"/>
</module>
<module name="MultipleVariableDeclarations"/>
<module name="MutableException"/>
<module name="NeedBraces"/>
<module name="NPathComplexity"/>
<module name="NoArrayTrailingComma"/>
<module name="NoClone"/>
<module name="NoEnumTrailingComma"/>
<module name="NoFinalizer"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OneStatementPerLine">
<property name="treatTryResourcesAsStatement" value="true"/>
</module>
<module name="OneTopLevelClass"/>
<module name="OperatorWrap">
<property name="option" value="eol"/>
</module>
<module name="OuterTypeFilename"/>
<module name="OuterTypeNumber"/>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="PackageDeclaration"/>
<module name="PackageName"/>
<module name="ParameterAssignment"/>
<module name="ParameterName"/>
<module name="ParameterNumber">
<property name="max" value="5"/>
</module>
<module name="ParenPad"/>
<module name="RedundantImport"/>
<module name="RedundantModifier"/>
<module name="RequireThis"/>
<module name="ReturnCount"/>
<module name="RightCurly">
<property name="option" value="alone"/>
</module>
<module name="SeparatorWrap">
<property name="tokens" value="COMMA,SEMI,ELLIPSIS,ARRAY_DECLARATOR"/>
<property name="option" value="eol"/>
</module>
<module name="SeparatorWrap">
<property name="tokens" value="DOT,AT,METHOD_REF"/>
<property name="option" value="nl"/>
</module>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StaticVariableName"/>
<module name="StringLiteralEquality"/>
<module name="SuperClone"/>
<module name="SuperFinalize"/>
<module name="SuppressWarnings">
<!-- allow: fallthrough, unchecked (cf. https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javac.html#BHCJBHDF) -->
<property name="format" value="^\s*(?:all|cast|classfile|deprecation|dep-ann|divzero|empty|finally|options|overrides|path|processing|rawtypes|Serial|static|try|varargs)\s*$"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="checkFormat" value="$1"/>
<property name="commentFormat" value="checkstyle-disable-line (\w+(?:\|\w+)?)"/>
</module>
<module name="SuppressWarningsHolder" />
<module name="ThrowsCount">
<property name="max" value="2"/>
</module>
<module name="TypecastParenPad"/>
<module name="TypeName"/>
<module name="UnnecessaryParentheses"/>
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration"/>
<module name="UnnecessarySemicolonInEnumeration"/>
<module name="UnnecessarySemicolonInTryWithResources">
<property name="allowWhenNoBraceAfterSemicolon" value="false"/>
</module>
<module name="UnusedImports"/>
<module name="UpperEll"/>
<module name="VisibilityModifier"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
</module>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.metafacture.biblio;

import org.metafacture.framework.FluxCommand;
Expand All @@ -21,6 +22,7 @@
import org.metafacture.framework.annotations.In;
import org.metafacture.framework.annotations.Out;
import org.metafacture.framework.helpers.DefaultXmlPipe;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

Expand Down Expand Up @@ -48,6 +50,9 @@ public final class AlephMabXmlHandler extends DefaultXmlPipe<StreamReceiver> {
private String currentTag = "";
private StringBuilder builder = new StringBuilder();

public AlephMabXmlHandler() {
}

@Override
public void characters(final char[] chars, final int start, final int length)
throws SAXException {
Expand All @@ -60,11 +65,14 @@ public void endElement(final String uri, final String localName, final String qN
if (AlephMabXmlHandler.CONTROLLFIELD.equals(localName)) {
getReceiver().literal(this.currentTag, this.builder.toString().trim());
getReceiver().endEntity();
} else if (AlephMabXmlHandler.SUBFIELD.equals(localName)) {
}
else if (AlephMabXmlHandler.SUBFIELD.equals(localName)) {
getReceiver().literal(this.currentTag, this.builder.toString().trim());
} else if (AlephMabXmlHandler.DATAFIELD.equals(localName)) {
}
else if (AlephMabXmlHandler.DATAFIELD.equals(localName)) {
getReceiver().endEntity();
} else if (AlephMabXmlHandler.RECORD.equals(localName)) {
}
else if (AlephMabXmlHandler.RECORD.equals(localName)) {
getReceiver().endRecord();
}
}
Expand All @@ -76,16 +84,20 @@ public void startElement(final String uri, final String localName, final String
this.builder = new StringBuilder();
this.currentTag = "";
getReceiver().startEntity(attributes.getValue(AlephMabXmlHandler.DATAFIELD_ATTRIBUTE));
} else if (AlephMabXmlHandler.SUBFIELD.equals(localName)) {
}
else if (AlephMabXmlHandler.SUBFIELD.equals(localName)) {
this.builder = new StringBuilder();
this.currentTag = attributes.getValue(AlephMabXmlHandler.SUBFIELD_ATTRIBUTE);
} else if (AlephMabXmlHandler.DATAFIELD.equals(localName)) {
getReceiver().startEntity(attributes.getValue(AlephMabXmlHandler.DATAFIELD_ATTRIBUTE)
+ attributes.getValue(AlephMabXmlHandler.INDICATOR1)
+ attributes.getValue(AlephMabXmlHandler.INDICATOR2));
} else if (AlephMabXmlHandler.RECORD.equals(localName)) {
}
else if (AlephMabXmlHandler.DATAFIELD.equals(localName)) {
getReceiver().startEntity(attributes.getValue(AlephMabXmlHandler.DATAFIELD_ATTRIBUTE) +
attributes.getValue(AlephMabXmlHandler.INDICATOR1) +
attributes.getValue(AlephMabXmlHandler.INDICATOR2));
}
else if (AlephMabXmlHandler.RECORD.equals(localName)) {
getReceiver().startRecord("");
} else if (AlephMabXmlHandler.LEADER.equals(localName)) {
}
else if (AlephMabXmlHandler.LEADER.equals(localName)) {
this.builder = new StringBuilder();
this.currentTag = AlephMabXmlHandler.LEADER;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.metafacture.biblio;

import org.metafacture.framework.FluxCommand;
Expand All @@ -31,11 +32,19 @@
@In(String.class)
@Out(StreamReceiver.class)
@FluxCommand("decode-aseq")
public final class AseqDecoder
extends DefaultObjectPipe<String, StreamReceiver> {
public final class AseqDecoder extends DefaultObjectPipe<String, StreamReceiver> {

private static final String FIELD_DELIMITER = "\n";

private static final int CATEGORY_BEGIN = 10;
private static final int CATEGORY_END = 15;
private static final int FIELD_CONTENT_BEGIN = 18;
private static final int RECORD_IDENTIFIER_BEGIN = 0;
private static final int RECORD_IDENTIFIER_END = 9;

public AseqDecoder() {
}

@Override
public void process(final String record) {
assert !isClosed();
Expand All @@ -44,16 +53,17 @@ public void process(final String record) {
return;
}
final String[] lines = trimedRecord.split(FIELD_DELIMITER);
for (int i = 0; i < lines.length; i++) {
for (int i = 0; i < lines.length; ++i) {
final String field = lines[i];
if (i == 0) {
getReceiver().startRecord(field.substring(0, 9));
getReceiver().startRecord(field.substring(RECORD_IDENTIFIER_BEGIN, RECORD_IDENTIFIER_END));
}
final String category = field.substring(10, 15).trim();
final String fieldContent = field.substring(18).trim();
final String category = field.substring(CATEGORY_BEGIN, CATEGORY_END).trim();
final String fieldContent = field.substring(FIELD_CONTENT_BEGIN).trim();
if (!fieldContent.startsWith("$$")) {
getReceiver().literal(category, fieldContent);
} else {
}
else {
getReceiver().startEntity(category);
final String[] subfields = fieldContent.split("\\$\\$");
for (final String subfield : subfields) {
Expand Down
Loading