Skip to content

Commit

Permalink
refactor: little style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BulatRuslanovich committed Oct 13, 2024
1 parent 5cda01d commit 0bb332f
Show file tree
Hide file tree
Showing 8 changed files with 433 additions and 2 deletions.
27 changes: 27 additions & 0 deletions dispatcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<telegrambots.version>6.9.7.1</telegrambots.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<checkstyle.version>10.12.7</checkstyle.version>
</properties>

<dependencies>
Expand All @@ -42,6 +44,12 @@
<groupId>org.telegram</groupId>
<artifactId>telegrambots-spring-boot-starter</artifactId>
<version>${telegrambots.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Kafka Support -->
Expand Down Expand Up @@ -88,6 +96,25 @@
<target>${maven.compiler.target}</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
<configuration>
<configLocation>../properties/checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
<logViolationsToConsole>true</logViolationsToConsole>
<failsOnError>true</failsOnError>
</configuration>
</plugin>
</plugins>
</build>
</project>
21 changes: 21 additions & 0 deletions node/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hashids.version>1.0.1</hashids.version>
<telegrambots.version>6.9.7.1</telegrambots.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<checkstyle.version>10.12.7</checkstyle.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -114,6 +116,25 @@
<target>${maven.compiler.target}</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
<configuration>
<configLocation>../properties/checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
<logViolationsToConsole>true</logViolationsToConsole>
<failsOnError>true</failsOnError>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions node/src/main/java/com/bipbup/entity/AppUserConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ public class AppUserConfig {
@JoinColumn(name = "app_user_id")
private AppUser appUser;

@Builder.Default
@OneToMany(mappedBy = "config", fetch = FetchType.EAGER)
private List<EducationLevel> educationLevels = new ArrayList<>();

@Builder.Default
@OneToMany(mappedBy = "config", fetch = FetchType.EAGER)
private List<ScheduleType> scheduleTypes = new ArrayList<>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ public interface ScheduleTypeCacheService {
List<ScheduleTypeParam> putScheduleTypes(long telegramId, ScheduleTypeParam param, List<ScheduleTypeParam> params);

@SuppressWarnings("UnusedReturnValue")
List<ScheduleTypeParam> removeScheduleTypes(long telegramId, ScheduleTypeParam param, List<ScheduleTypeParam> params);
List<ScheduleTypeParam> removeScheduleTypes(long telegramId, ScheduleTypeParam param,
List<ScheduleTypeParam> params);

List<ScheduleTypeParam> getScheduleTypes(long telegramId);

void clearScheduleTypes(long telegramId);
}
}
222 changes: 222 additions & 0 deletions properties/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="fileExtensions" value="java, properties, xml"/>

<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>

<module name="NewlineAtEndOfFile"/>

<module name="Translation"/>

<module name="UniqueProperties"/>

<module name="FileLength"/>
<module name="LineLength">
<property name="max" value="120"/>
<property name="fileExtensions" value="java"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>

<module name="FileTabCharacter"/>

<module name="SuppressWithPlainTextCommentFilter"/>
<module name="SuppressWarningsFilter"/>


<module name="TreeWalker">
<module name="JavadocMissingLeadingAsteriskCheck"/>
<module name="JavadocMissingWhitespaceAfterAsterisk"/>

<module name="JavadocStyle">
<property name="checkFirstSentence" value="false"/>
<property name="checkEmptyJavadoc" value="true"/>
<property name="tokens"
value="ANNOTATION_DEF, ANNOTATION_FIELD_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF, INTERFACE_DEF, METHOD_DEF, VARIABLE_DEF"/>
</module>


<module name="SingleLineJavadoc"/>
<module name="MissingOverride"/>
<module name="CatchParameterName"/>
<module name="ClassTypeParameterName"/>
<module name="ConstantName"/>
<module name="IllegalIdentifierName"/>
<module name="InterfaceTypeParameterName"/>
<module name="LambdaParameterName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="MethodTypeParameterName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="PatternVariableName"/>
<module name="RecordTypeParameterName"/>
<module name="RecordComponentName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>

<module name="AnonInnerLength">
<property name="max" value="40"/>
</module>

<module name="LambdaBodyLength">
<property name="max" value="40"/>
</module>

<module name="MethodLength"/>
<module name="OuterTypeNumber"/>
<module name="ParameterNumber"/>

<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoLineWrap"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="NoWhitespaceBeforeCaseDefaultColon"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapDot"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapComma"/>
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapEllipsis"/>
<property name="tokens" value="ELLIPSIS"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapArrayDeclarator"/>
<property name="tokens" value="ARRAY_DECLARATOR"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapMethodRef"/>
<property name="tokens" value="METHOD_REF"/>
<property name="option" value="nl"/>
</module>

<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when it's ctor, method, type, lambda or loop"/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>

<module name="RedundantModifier"/>

<module name="AvoidNestedBlocks">
<property name="allowInSwitchCase" value="true"/>
</module>
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<module name="LeftCurly"/>
<module name="RightCurly"/>


<module name="AvoidNoArgumentSuperConstructorCall"/>
<module name="CovariantEquals"/>
<module name="DefaultComesLast"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="FallThrough"/>
<module name="HiddenField">
<property name="tokens" value="VARIABLE_DEF"/>
</module>
<module name="IllegalInstantiation">
<property name="classes" value="java.lang.Boolean"/>
</module>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="ignoreHashCodeMethod" value="true"/>
<property name="ignoreAnnotation" value="true"/>
<message key="magic.number"
value="Most likely the value ''{0}'' is a configuration one. You should move it to configuration file instead of source code."/>
</module>
<module name="MissingSwitchDefault"/>
<module name="ModifiedControlVariable"/>
<module name="MultipleStringLiterals">
<property name="ignoreStringsRegexp" value='^(("")|(".")|("..")|("..>"))$'/>
</module>
<module name="MultipleVariableDeclarations"/>
<module name="NestedForDepth">
<property name="max" value="2"/>
</module>
<module name="NestedIfDepth">
<property name="max" value="2"/>
</module>
<module name="NestedTryDepth">
<property name="max" value="2"/>
</module>
<module name="NoClone"/>
<module name="NoFinalizer"/>
<module name="OneStatementPerLine"/>
<module name="PackageDeclaration"/>
<module name="ParameterAssignment"/>
<module name="ReturnCount">
<property name="max" value="4"/>
</module>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="SuperClone"/>
<module name="SuperFinalize"/>
<module name="FinalClass">
<property name="severity" value="warning"/>
<message key="final.class"
value="Private ctor in non-final class. Inspect the code and make sure it's intended."/>
</module>
<module name="HideUtilityClassConstructor"/>
<module name="SuppressionXpathSingleFilter">
<property name="checks" value="HideUtilityClassConstructor"/>
<property name="query"
value="//*[MODIFIERS//*[@text = 'UtilityClass' or @text='NoArgsConstructor' or @text = 'SpringBootApplication']]/descendant-or-self::node()"/>
</module>
<module name="InnerTypeLast"/>
<module name="MutableException"/>
<module name="OneTopLevelClass"/>
<module name="ArrayTypeStyle"/>
<module name="NoCodeInFile"/>

<module name="OuterTypeFilename"/>
<module name="UncommentedMain">
<property name="excludedClasses" value="Application|Main"/>
</module>
<module name="UpperEll"/>

<module name="CyclomaticComplexity">
<property name="max" value="16"/>
</module>

<module name="SuppressionCommentFilter"/>
<module name="SuppressWarningsHolder"/>
<module name="SuppressWithNearbyCommentFilter"/>
</module>
</module>

Loading

0 comments on commit 0bb332f

Please sign in to comment.