Skip to content

Commit

Permalink
Added base classes, webdrivermanager and checkstyle/pmd
Browse files Browse the repository at this point in the history
  • Loading branch information
borzykin committed Mar 4, 2020
1 parent bf0f2f5 commit 7ea6a4a
Show file tree
Hide file tree
Showing 16 changed files with 631 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/testautomation-web.iml
/.idea/
/logs/log_file.txt
241 changes: 241 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Miscellaneous -->
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf"/>
</module>
<module name="Translation"/>
<module name="UniqueProperties"/>

<module name="SuppressionFilter">
<property name="file" value="./config/checkstyle/suppressions.xml"/>
</module>

<!-- Sizes Violations -->
<module name="FileLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="500"/>
</module>

<!-- Whitespaces -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>

<!-- Trailing spaces -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>

<!-- Space after 'for' and 'if' -->
<module name="RegexpSingleline">
<property name="format" value="^\s*(for|if)\b[^ ]"/>
<property name="message" value="Space needed before opening parenthesis."/>
</module>

<!-- For each spacing -->
<module name="RegexpSingleline">
<property name="format" value="^\s*for \(.*?([^ ]:|:[^ ])"/>
<property name="message" value="Space needed around ':' character."/>
</module>

<module name="TreeWalker">
<module name="LineLength">
<property name="max" value="160"/>
</module>

<!-- Javadoc Comments -->
<module name="AtclauseOrder"/>
<module name="JavadocMethod">
<property name="scope" value="public"/>
</module>
<module name="JavadocParagraph"/>
<module name="JavadocStyle">
<property name="scope" value="public"/>
</module>
<module name="JavadocTagContinuationIndentation"/>
<module name="JavadocType">
<property name="scope" value="public"/>
</module>
<module name="JavadocVariable">
<property name="scope" value="public"/>
<property name="ignoreNamePattern" value="log|logger"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="SingleLineJavadoc"/>
<module name="SummaryJavadocCheck">
<property name="period" value="."/>
<property name="forbiddenSummaryFragments"
value="^This method returns.*"/>
</module>
<module name="WriteTag"/>

<!-- Naming Conventions -->
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
</module>
<module name="AbstractClassName">
<property name="ignoreModifier" value="true"/>
</module>
<module name="CatchParameterName"/>
<module name="ClassTypeParameterName"/>
<module name="ConstantName">
<property name="format" value="^log?|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
</module>
<module name="InterfaceTypeParameterName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<property name="allowOneCharVarInForLoop" value="true"/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
</module>
<module name="MethodName"/>
<module name="MethodTypeParameterName"/>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
</module>
<module name="ParameterName">
<property name="id" value="ParameterNamePublic"/>
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<property name="accessModifiers" value="public"/>
</module>
<module name="ParameterName">
<property name="id" value="ParameterNameNonPublic"/>
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<property name="accessModifiers" value="protected, package, private"/>
</module>
<module name="StaticVariableName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
</module>
<module name="TypeName"/>

<!-- Imports -->
<module name="AvoidStarImport"/>
<module name="CustomImportOrder">
<property name="specialImportsRegExp" value="com.linkedinSearchService.*"/>
<property name="customImportOrderRules"
value="STANDARD_JAVA_PACKAGE###THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS###STATIC"/>
<property name="sortImportsInGroupAlphabetically" value="true"/>
</module>
<module name="IllegalImport">
<property name="illegalPkgs" value="java\.util"/>
</module>
<module name="RedundantImport"/>
<module name="UnusedImports"/>

<!-- Sizes Violations -->
<module name="AnonInnerLength">
<property name="max" value="31"/>
</module>
<module name="ExecutableStatementCount">
<property name="max" value="42"/>
</module>
<module name="MethodCount">
<property name="maxTotal" value="40"/>
</module>
<module name="MethodLength"/>
<module name="OuterTypeNumber"/>
<module name="ParameterNumber"/>

<!-- Whitespace -->
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad"/>
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
</module>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoLineWrap"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<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="SingleSpaceSeparator"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>

<!-- Modifiers -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>

<!-- Block Checks -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock">
<property name="option" value="text"/>
</module>
<module name="EmptyCatchBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
</module>

<!-- Checks for com.mobile.automation.framework.common coding problems-->
<module name="CovariantEquals"/>
<module name="EmptyStatement"/>
<module name="EqualsAvoidNull"/>
<module name="EqualsHashCode"/>
<module name="IllegalInstantiation"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<!-- Class Design -->
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InnerTypeLast"/>
<module name="InterfaceIsType"/>
<module name="MutableException"/>
<module name="OneTopLevelClass"/>
<module name="ThrowsCount">
<property name="max" value="2"/>
</module>
<module name="VisibilityModifier">
<property name="protectedAllowed" value="true"/>
</module>

<!-- Metrics -->
<module name="BooleanExpressionComplexity">
<property name="max" value="5"/>
</module>
<module name="ClassDataAbstractionCoupling">
<property name="max" value="9"/>
</module>
<module name="ClassFanOutComplexity">
<property name="max" value="25"/>
</module>
<module name="CyclomaticComplexity">
<property name="max" value="15"/>
</module>
<module name="JavaNCSS"/>
<!-- <module name="NPathComplexity"/>-->
</module>
</module>
9 changes: 9 additions & 0 deletions config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://checkstyle.sourceforge.net/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress checks="Javadoc" files=".*[\\/]src[\\/](main|test)[\\/]"/>
<suppress checks="WriteTag" files=".*[\\/]src[\\/](test)[\\/]"/>
<suppress checks="NonEmptyAtclauseDescription" files=".*[\\/]src[\\/](test)[\\/]"/>
<suppress checks="ClassFanOutComplexity" files=".*[\\/]src[\\/](test)[\\/]"/>
<suppress checks="MethodCount" files=".*.(OfferPage|RequestPage|WorkfolioPage)"/>
</suppressions>
119 changes: 119 additions & 0 deletions config/pmd/ruleSet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Linkedin Service Rule Sets"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>Linkedin Service Rule Sets</description>

<rule ref="category/java/bestpractices.xml">
<exclude name="ArrayIsStoredDirectly"/>
<exclude name="GuardLogStatement"/>
<exclude name="JUnit4SuitesShouldUseSuiteAnnotation"/>
<exclude name="JUnit4TestShouldUseAfterAnnotation"/>
<exclude name="JUnit4TestShouldUseBeforeAnnotation"/>
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
<exclude name="JUnitAssertionsShouldIncludeMessage"/>
<exclude name="JUnitTestContainsTooManyAsserts"/>
<exclude name="JUnitTestsShouldIncludeAssert"/>
<exclude name="JUnitUseExpected"/>
<exclude name="UseAssertEqualsInsteadOfAssertTrue"/>
<exclude name="UseAssertNullInsteadOfAssertTrue"/>
<exclude name="UseAssertSameInsteadOfAssertTrue"/>
<exclude name="UseAssertTrueInsteadOfAssertEquals"/>
</rule>

<rule ref="category/java/codestyle.xml">
<exclude name="AtLeastOneConstructor"/>
<exclude name="AvoidFinalLocalVariable"/>
<exclude name="CallSuperInConstructor"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="ConfusingTernary"/>
<exclude name="DefaultPackage"/>
<exclude name="ForLoopsMustUseBraces"/>
<exclude name="IfElseStmtsMustUseBraces"/>
<exclude name="IfStmtsMustUseBraces"/>
<exclude name="LinguisticNaming"/>
<exclude name="LocalHomeNamingConvention"/>
<exclude name="LocalInterfaceSessionNamingConvention"/>
<exclude name="LongVariable"/>
<exclude name="MDBAndSessionBeanNamingConvention"/>
<exclude name="OnlyOneReturn"/>
<exclude name="RemoteInterfaceNamingConvention"/>
<exclude name="RemoteSessionInterfaceNamingConvention"/>
<exclude name="ShortClassName"/>
<exclude name="TooManyStaticImports"/>
<exclude name="WhileLoopsMustUseBraces"/>
</rule>
<rule ref="category/java/codestyle.xml/ClassNamingConventions">
<properties>
<property name="utilityClassPattern" value="[A-Z][a-zA-Z0-9]*"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml/FieldNamingConventions">
<properties>
<property name="constantPattern" value="log?|[A-Z][A-Z_0-9]*"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml/ShortMethodName">
<properties>
<property name="minimum" value="2"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml/ShortVariable">
<properties>
<property name="minimum" value="2"/>
</properties>
</rule>

<rule ref="category/java/design.xml">
<exclude name="CouplingBetweenObjects"/>
<exclude name="DataClass"/>
<exclude name="ExcessiveImports"/>
<exclude name="ExcessivePublicCount"/>
<exclude name="LawOfDemeter"/>
<exclude name="LoosePackageCoupling"/>
<exclude name="ModifiedCyclomaticComplexity"/>
<exclude name="NcssConstructorCount"/>
<exclude name="NcssMethodCount"/>
<exclude name="NcssTypeCount"/>
<exclude name="NPathComplexity"/>
<exclude name="SimplifyBooleanAssertion"/>
<exclude name="StdCyclomaticComplexity"/>
<exclude name="TooManyFields"/>
</rule>
<rule ref="category/java/design.xml/TooManyMethods">
<properties>
<property name="maxmethods" value="40"/>
</properties>
</rule>

<rule ref="category/java/documentation.xml">
<exclude name="CommentRequired"/>
<exclude name="CommentSize"/>
</rule>

<rule ref="category/java/errorprone.xml">
<exclude name="AvoidFieldNameMatchingTypeName"/>
<exclude name="AvoidDuplicateLiterals"/>
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="CloseResource"/>
<exclude name="DataflowAnomalyAnalysis"/>
<exclude name="DoNotCallSystemExit"/>
<exclude name="DoNotHardCodeSDCard"/>
<exclude name="JUnitSpelling"/>
<exclude name="JUnitStaticSuite"/>
<exclude name="MoreThanOneLogger"/>
<exclude name="NonStaticInitializer"/>
<exclude name="SimpleDateFormatNeedsLocale"/>
<exclude name="StaticEJBFieldShouldBeFinal"/>
<exclude name="UnnecessaryBooleanAssertion"/>
<exclude name="UseLocaleWithCaseConversions"/>
<exclude name="UseProperClassLoader"/>
</rule>

<rule ref="category/java/multithreading.xml">
<exclude name="DoNotUseThreads"/>
</rule>

<rule ref="category/java/performance.xml"/>
</ruleset>
Loading

0 comments on commit 7ea6a4a

Please sign in to comment.