Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dobosevych committed Oct 13, 2022
0 parents commit e06dfd1
Show file tree
Hide file tree
Showing 11 changed files with 460 additions and 0 deletions.
306 changes: 306 additions & 0 deletions .github/linters/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">


<module name="Checker">


<!-- Checks that property files contain the same keys. -->
<module name="Translation"/>

<!-- Checks that no tab characters in the source code. -->
<!-- Reports only first instance. -->
<module name="FileTabCharacter">
<property name="eachLine" value="false"/>
</module>


<!-- Checks that no file is more than 1500 lines long. -->
<module name="FileLength">
<property name="max" value="1500"/>
</module>

<!-- Check that length of line is at most 80 characters. -->
<module name="LineLength">
<property name="max" value="80"/>
<property name="ignorePattern" value="^ *\* *[^ ]+$"/>
</module>


<!-- =========================================================================== -->
<!-- =========================================================================== -->
<!-- TREEWALKER BEGINS HERE -->
<!-- =========================================================================== -->
<!-- =========================================================================== -->

<module name="TreeWalker">

<!-- =========================================================================== -->
<!-- Check for annotations -->
<!-- http://checkstyle.sourceforge.net/config_annotation.html -->
<!-- =========================================================================== -->
<module name="SuppressWarnings">
<property name="format"
value="^unchecked$|^unused$"/>
<property name="tokens"
value="
CLASS_DEF,INTERFACE_DEF,ENUM_DEF,
ANNOTATION_DEF,ANNOTATION_FIELD_DEF,
ENUM_CONSTANT_DEF,METHOD_DEF,CTOR_DEF,
PARAMETER_DEF,VARIABLE_DEF
"/>
</module>

<!-- =========================================================================== -->
<!-- Block checks -->
<!-- http://checkstyle.sourceforge.net/config_blocks.html -->
<!-- =========================================================================== -->
<module name="EmptyBlock">
<property name="option" value="text"/>
</module>
<module name="AvoidNestedBlocks"/>


<!-- =========================================================================== -->
<!-- Class design -->
<!-- http://checkstyle.sourceforge.net/config_design.html -->
<!-- =========================================================================== -->
<!-- SPECIAL HACK FOR NON-STATIC PUBIC FINAL VARIABLE -->
<module name="VisibilityModifier">
<property name="publicMemberPattern" value="^SLOPE_ORDER$"/>
</module>
<!-- <module name="FinalClass"/> -->
<module name="InterfaceIsType"/>
<module name="MutableException"/>


<!-- =========================================================================== -->
<!-- Coding violations -->
<!-- http://checkstyle.sourceforge.net/config_coding.html -->
<!-- =========================================================================== -->
<module name="AvoidInlineConditionals"/>
<module name="CovariantEquals"/>
<!-- <module name="DoubleCheckedLocking"/> NO LONGER AVAILABLE IN CHECKSTYLE 5.6 -->
<module name="EmptyStatement"/>
<!-- <module name="EqualsHashCode"/> -->
<module name="HiddenField">
<property name="ignoreConstructorParameter" value="true"/>
</module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="tokens"
value="NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG"/>
<property name="ignoreNumbers" value="-1, 0, 0.5, 1, 2"/>
<property name="ignoreHashCodeMethod" value="true"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="ModifiedControlVariable"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="NestedForDepth">
<property name="max" value="4"/>
</module>
<module name="NestedIfDepth">
<property name="max" value="3"/>
</module>
<module name="NestedTryDepth">
<property name="max" value="1"/>
</module>
<module name="NoClone"/>
<module name="NoFinalizer"/>
<module name="SuperClone"/>
<module name="SuperFinalize"/>

<!-- Avoid masking of OutOfMemoryError or NullPointerExceptionError -->
<module name="IllegalCatch"/>

<!-- Don't allow variables to be declared of wrapper types -->
<module name="IllegalType">
<property name="illegalClassNames"
value="java.lang.Boolean, java.lang.Integer, java.lang.Double, java.lang.Float, java.lang.Character, java.lang.Long, java.lang.Short, java.lang.Byte, java.lang.Class"/>
</module>

<module name="DeclarationOrder"/>
<module name="ParameterAssignment"/>
<module name="DefaultComesLast"/>
<module name="FallThrough">
<property name="reliefPattern" value="continue in next case"/>
</module>
<module name="OneStatementPerLine"/>


<!-- =========================================================================== -->
<!-- Duplicate code -->
<!-- http://checkstyle.sourceforge.net/config_duplicates.html -->
<!-- =========================================================================== -->


<!-- =========================================================================== -->
<!-- Headers -->
<!-- http://checkstyle.sourceforge.net/config_header.html -->
<!-- =========================================================================== -->


<!-- =========================================================================== -->
<!-- Imports -->
<!-- http://checkstyle.sourceforge.net/config_imports.html -->
<!-- =========================================================================== -->
<module name="AvoidStarImport"/>
<module name="AvoidStaticImport"/>

<module name="IllegalImport">
<property name="illegalPkgs"
value="java.sql, sun, java.net, java.security, javax, java.applet, java.beans, java.nio, java.rmi, java.text, java.lang.reflect, java.lang.instrument"/>
</module>

<module name="RedundantImport"/>
<module name="UnusedImports"/>


<!-- =========================================================================== -->
<!-- Javadoc comments -->
<!-- http://checkstyle.sourceforge.net/config_javadoc.html -->
<!-- =========================================================================== -->


<!-- =========================================================================== -->
<!-- Metrics -->
<!-- http://checkstyle.sourceforge.net/config_metrics.html -->
<!-- =========================================================================== -->


<!-- =========================================================================== -->
<!-- Miscellaneous checks -->
<!-- http://checkstyle.sourceforge.net/config_misc.html -->
<!-- =========================================================================== -->
<module name="TodoComment"/>
<module name="UpperEll"/>
<module name="ArrayTypeStyle"/>
<module name="OuterTypeFilename"/>


<!-- =========================================================================== -->
<!-- Modifiers -->
<!-- http://checkstyle.sourceforge.net/config_modifier.html -->
<!-- =========================================================================== -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>


<!-- =========================================================================== -->
<!-- Naming conventions -->
<!-- http://checkstyle.sourceforge.net/config_naming.html -->
<!-- =========================================================================== -->

<!-- MODIFIED TO ALLOW SINGLE LETTER UPPERCASE NAMES -->
<!-- MODIFIED TO ALLOW FINAL VARIABLES TO BE ALL UPPER-CASE -->
<!-- Disallow underscore characters -->
<module name="ConstantName">
<property name="format" value="^[A-Z][A-Z_]*$"/>
</module>
<module name="LocalFinalVariableName">
<property name="format" value="^[A-Z][A-Z_]*$"/>
</module>
<module name="LocalVariableName">
<property name="format" value="^[a-z][a-zA-Z]*$"/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-zA-Z]*$"/>
</module>

<module name="MethodName">
<property name="format" value="^[a-z][a-zA-Z]*$"/>
</module>

<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z]*)*$"/>
</module>
<module name="PackageName"/>
<module name="ParameterName">
<property name="format" value="^[a-z][a-zA-Z]*$"/>
</module>
<module name="StaticVariableName">
<property name="format" value="^[a-z][a-zA-Z]*$|^[A-Z][A-Z_]*$"/>
</module>
<module name="TypeName">
<property name="format" value="^[A-Z][a-zA-Z]*$"/>
</module>

<!-- =========================================================================== -->
<!-- Regexp -->
<!-- http://checkstyle.sourceforge.net/config_regexp.html -->
<!-- =========================================================================== -->

<!-- Checks for calls to System.exit(). -->
<module name="RegexpSinglelineJava">
<property name="format" value="System\.exit"/>
<property name="ignoreComments" value="true"/>
<property name="message" value="Not permitted to call System.exit()"/>
</module>

<!-- Checks for calls to Math.pow(). -->
<module name="RegexpSinglelineJava">
<property name="format" value="Math\.pow\([^,]*, 2\)"/>
<property name="ignoreComments" value="true"/>
<property name="message" value="Use x*x instead of Math.pow(x, 2)"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="Math\.pow\([^,]*, 3\)"/>
<property name="ignoreComments" value="true"/>
<property name="message" value="Use x*x*x instead of Math.pow(x, 3)"/>
</module>


<!-- =========================================================================== -->
<!-- Size violations -->
<!-- http://checkstyle.sourceforge.net/config_sizes.html -->
<!-- =========================================================================== -->

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


<!-- =========================================================================== -->
<!-- Whitespace -->
<!-- http://checkstyle.sourceforge.net/config_whitespace.html -->
<!-- =========================================================================== -->
<module name="GenericWhitespace"/>
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<!-- removed PLUS, MINUS, STAR, DIV -->
<!-- removed GENERIC_START, GENERIC_END -->
<property name="tokens"
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR,
BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV_ASSIGN,
EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT,
LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED,
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS_ASSIGN, MOD,
MOD_ASSIGN, NOT_EQUAL, PLUS_ASSIGN, QUESTION, RCURLY,
SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR_ASSIGN,
TYPE_EXTENSION_AND, WILDCARD_TYPE"/>
</module>

<module name="NeedBraces"/>


</module>

</module>
27 changes: 27 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Java CI

on:
push:
branches: [master, main]
pull_request:
branches: [master, main]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 15
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'adopt'
- name: Lint Code Base
uses: github/super-linter/slim@v4
env:
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JAVA_FILE_NAME: checkstyle.xml
- name: Test with Maven
run: mvn --batch-mode --update-snapshots package
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
target/
42 changes: 42 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>ua.edu.ucu.apps</groupId>
<artifactId>Lab5.1</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
</plugin>
</plugins>
</build>

<properties>
<maven.compiler.source>15</maven.compiler.source>
<maven.compiler.target>15</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
Loading

0 comments on commit e06dfd1

Please sign in to comment.