├── .0pdd.yml ├── .gitattributes ├── .github └── workflows │ ├── actionlint.yml │ ├── codecov.yml │ ├── copyrights.yml │ ├── markdown-lint.yml │ ├── mvn.yml │ ├── ort.yml │ ├── pdd.yml │ ├── reuse.yml │ ├── typos.yml │ ├── up.yml │ ├── xcop.yml │ └── yamllint.yml ├── .gitignore ├── .pdd ├── .rultor.yml ├── LICENSE.txt ├── LICENSES └── MIT.txt ├── README.md ├── REUSE.toml ├── pom.xml ├── qulice-checkstyle ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── qulice │ │ │ └── checkstyle │ │ │ ├── BracketsStructureCheck.java │ │ │ ├── BranchContains.java │ │ │ ├── CascadeIndentationCheck.java │ │ │ ├── CheckstyleListener.java │ │ │ ├── CheckstyleValidator.java │ │ │ ├── ChildStream.java │ │ │ ├── ConditionalRegexpMultilineCheck.java │ │ │ ├── ConstantUsageCheck.java │ │ │ ├── CurlyBracketsStructureCheck.java │ │ │ ├── DiamondOperatorCheck.java │ │ │ ├── EmptyLinesCheck.java │ │ │ ├── FinalSemicolonInTryWithResourcesCheck.java │ │ │ ├── ImportCohesionCheck.java │ │ │ ├── JavadocEmptyLineCheck.java │ │ │ ├── JavadocLocationCheck.java │ │ │ ├── JavadocParameterOrderCheck.java │ │ │ ├── JavadocTagsCheck.java │ │ │ ├── LineRange.java │ │ │ ├── LineRanges.java │ │ │ ├── MethodBodyCommentsCheck.java │ │ │ ├── MethodsOrderCheck.java │ │ │ ├── MultiLineCommentCheck.java │ │ │ ├── MultilineJavadocTagsCheck.java │ │ │ ├── NoJavadocForOverriddenMethodsCheck.java │ │ │ ├── NonStaticMethodCheck.java │ │ │ ├── ProhibitNonFinalClassesCheck.java │ │ │ ├── ProhibitUnusedPrivateConstructorCheck.java │ │ │ ├── ProtectedMethodInFinalClassCheck.java │ │ │ ├── QualifyInnerClassCheck.java │ │ │ ├── RequiredJavaDocTag.java │ │ │ ├── SingleLineCommentCheck.java │ │ │ ├── StringLiteralsConcatenationCheck.java │ │ │ ├── package-info.java │ │ │ └── parameters │ │ │ ├── Arguments.java │ │ │ ├── Parameters.java │ │ │ ├── TypeParameters.java │ │ │ └── package-info.java │ └── resources │ │ └── com │ │ └── qulice │ │ └── checkstyle │ │ ├── checks.xml │ │ └── suppressions.xml │ ├── site │ ├── apt │ │ └── index.apt.vm │ └── site.xml │ └── test │ ├── java │ └── com │ │ └── qulice │ │ └── checkstyle │ │ ├── ChecksTest.java │ │ ├── CheckstyleValidatorTest.java │ │ ├── License.java │ │ ├── RequiredJavaDocTagTest.java │ │ └── package-info.java │ └── resources │ ├── com │ └── qulice │ │ └── checkstyle │ │ ├── AnnotationConstant.java │ │ ├── AnnotationIndentation.java │ │ ├── AnnotationIndentationNegative.java │ │ ├── AtClauseOrder.java │ │ ├── BlankLinesInsideMethodsFail.java │ │ ├── BlankLinesOutsideMethodsPass.java │ │ ├── CatchParameterNames.java │ │ ├── ChecksTest │ │ ├── BracketsStructureCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── CommentCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── ConstantUsageCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── CurlyBracketsStructureCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── EmptyLinesCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── ImportCohesionCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── JavadocEmptyLineCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── JavadocLocationCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── JavadocParameterOrderCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── JavadocTagsCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── MethodBodyCommentsCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── MethodsOrderCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── MultilineJavadocTagsCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── NoJavadocForOverriddenMethodsCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── NonStaticMethodCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── ProhibitNonFinalClassesCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── ProhibitUnusedPrivateConstructorCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── ProtectedMethodInFinalClassCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── QualifyInnerClassCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── RequireThisCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ └── StringLiteralsConcatenationCheck │ │ │ ├── Invalid.java │ │ │ ├── Valid.java │ │ │ ├── config.xml │ │ │ └── violations.txt │ │ ├── ConstructorParams.java │ │ ├── DefaultMethods.java │ │ ├── DiamondUsageNotNeeded.java │ │ ├── DoNotUseCharEncoding.java │ │ ├── ExtraSemicolon.java │ │ ├── HiddenParameter.java │ │ ├── InstanceMethodRef.java │ │ ├── InvalidAbbreviationAsWordInNameXML.java │ │ ├── InvalidDiamondsUsage.java │ │ ├── InvalidIndentation.java │ │ ├── InvalidMethodDoc.java │ │ ├── LineWrapPackage.java │ │ ├── LocalVariableNames.java │ │ ├── MissingJavadocTest.java │ │ ├── ParametrizedClass.java │ │ ├── ReturnCount.java │ │ ├── TooLongLines.java │ │ ├── UrlInLongLine.java │ │ ├── ValidAbbreviationAsWordInName.java │ │ ├── ValidAbbreviationAsWordInNameIT.java │ │ ├── ValidDiamondsUsage.java │ │ ├── ValidIT.java │ │ ├── ValidITCase.java │ │ ├── ValidIndentation.java │ │ ├── ValidLambdaAndGenericsAtEndOfLine.java │ │ ├── ValidLiteralComparisonCheck.java │ │ ├── ValidRecord.java │ │ ├── ValidSemicolon.java │ │ ├── ValidSingleLineCommentCheck.java │ │ ├── WindowsEol.java │ │ └── WindowsEolLinux.java │ └── log4j.properties ├── qulice-maven-plugin ├── LICENSE.txt ├── pom.xml └── src │ ├── it │ ├── checkstyle-newlines │ │ ├── LICENSE.txt │ │ ├── invoker.properties │ │ ├── pom.xml │ │ ├── src │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── qulice │ │ │ │ │ └── plugin │ │ │ │ │ └── violations │ │ │ │ │ └── Violations.java │ │ │ │ └── resources │ │ │ │ └── tabs.txt │ │ └── verify.groovy │ ├── checkstyle-violations │ │ ├── LICENSE.txt │ │ ├── invoker.properties │ │ ├── pom.xml │ │ ├── src │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── qulice │ │ │ │ │ └── plugin │ │ │ │ │ └── violations │ │ │ │ │ ├── Brackets.java │ │ │ │ │ ├── Constants.java │ │ │ │ │ ├── Iface.java │ │ │ │ │ ├── IndentationChecks.java │ │ │ │ │ ├── NewLines.java │ │ │ │ │ ├── SomeTest.java │ │ │ │ │ ├── Tabs.java │ │ │ │ │ ├── Violations.java │ │ │ │ │ └── Юникод.java │ │ │ │ └── resources │ │ │ │ ├── newlines.txt │ │ │ │ └── tabs.txt │ │ └── verify.groovy │ ├── dependency-not-matches-exclude │ │ ├── LICENSE.txt │ │ ├── invoker.properties │ │ ├── pom.xml │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── qulice │ │ │ │ └── entity │ │ │ │ ├── hibernate.cfg.xml │ │ │ │ └── model │ │ │ │ ├── TestModel.java │ │ │ │ └── package-info.java │ │ └── verify.groovy │ ├── dependency-violations-exclude │ │ ├── LICENSE.txt │ │ ├── invoker.properties │ │ ├── pom.xml │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── qulice │ │ │ │ └── foo │ │ │ │ ├── Sample.java │ │ │ │ └── package-info.java │ │ └── verify.groovy │ ├── dependency-violations │ │ ├── LICENSE.txt │ │ ├── invoker.properties │ │ ├── pom.xml │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── qulice │ │ │ │ └── foo │ │ │ │ ├── Sample.java │ │ │ │ └── package-info.java │ │ └── verify.groovy │ ├── duplicate-finder-ignore-deps │ │ ├── invoker.properties │ │ ├── pom.xml │ │ └── verify.groovy │ ├── duplicate-finder-violations │ │ ├── invoker.properties │ │ ├── pom.xml │ │ └── verify.groovy │ ├── hibernate-validator-check │ │ ├── LICENSE.txt │ │ ├── invoker.properties │ │ ├── pom.xml │ │ ├── src │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── qulice │ │ │ │ └── foo │ │ │ │ ├── Sample.java │ │ │ │ └── package-info.java │ │ └── verify.groovy │ ├── log-check │ │ ├── LICENSE.txt │ │ ├── invoker.properties │ │ ├── pom.xml │ │ └── verify.groovy │ ├── multi-module │ │ ├── LICENSE.txt │ │ ├── invoker.properties │ │ ├── mod-alpha │ │ │ ├── LICENSE.txt │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ ├── main │ │ │ │ └── java │ │ │ │ │ └── com │ │ │ │ │ └── qulice │ │ │ │ │ └── plugin │ │ │ │ │ └── alpha │ │ │ │ │ ├── Main.java │ │ │ │ │ └── package-info.java │ │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── qulice │ │ │ │ └── plugin │ │ │ │ └── alpha │ │ │ │ ├── MainTest.java │ │ │ │ └── package-info.java │ │ ├── mod-tk │ │ │ ├── LICENSE.txt │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── LICENSE.txt │ │ ├── pom.xml │ │ ├── src │ │ │ └── .gitignore │ │ └── verify.groovy │ ├── pmd-violations │ │ ├── LICENSE.txt │ │ ├── invoker.properties │ │ ├── pom.xml │ │ ├── src │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── qulice │ │ │ │ │ └── foo │ │ │ │ │ ├── Violations.java │ │ │ │ │ └── package-info.java │ │ │ │ └── util │ │ │ │ └── some.tex │ │ └── verify.groovy │ ├── pom-xpath-validator-violations │ │ ├── invoker.properties │ │ ├── pom.xml │ │ └── verify.groovy │ ├── relocation │ │ ├── LICENSE.txt │ │ ├── invoker.properties │ │ ├── pom.xml │ │ └── verify.groovy │ ├── settings.xml │ └── snapshots │ │ ├── invoker.properties │ │ ├── pom.xml │ │ └── verify.groovy │ ├── main │ └── java │ │ └── com │ │ └── qulice │ │ └── maven │ │ ├── AbstractQuliceMojo.java │ │ ├── CheckMojo.java │ │ ├── DefaultMavenEnvironment.java │ │ ├── DefaultValidatorsProvider.java │ │ ├── DependenciesValidator.java │ │ ├── DuplicateFinderValidator.java │ │ ├── EnforcerValidator.java │ │ ├── MavenEnvironment.java │ │ ├── MavenValidator.java │ │ ├── MojoExecutor.java │ │ ├── PomXpathValidator.java │ │ ├── SnapshotsValidator.java │ │ ├── SvnPropertiesValidator.java │ │ ├── ValidatorsProvider.java │ │ └── package-info.java │ ├── site │ ├── apt │ │ ├── example-exclude.apt.vm │ │ ├── index.apt.vm │ │ └── usage.apt.vm │ ├── fml │ │ └── faq.fml │ └── site.xml │ └── test │ ├── java │ └── com │ │ └── qulice │ │ └── maven │ │ ├── CheckMojoTest.java │ │ ├── DefaultMavenEnvironmentTest.java │ │ ├── DefaultValidatorsProviderTest.java │ │ ├── DependenciesValidatorTest.java │ │ ├── MavenEnvironmentMocker.java │ │ ├── MavenProjectMocker.java │ │ ├── PomXpathValidatorTest.java │ │ ├── SvnPropertiesValidatorTest.java │ │ ├── ValidationExclusionTest.java │ │ ├── ValidatorsProviderMocker.java │ │ └── package-info.java │ └── resources │ ├── LICENSE.txt │ └── com │ └── qulice │ └── maven │ ├── PomXpathValidator │ └── pom.xml │ └── ValidationExclusion │ ├── CheckstyleExample.txt │ └── PmdExample.txt ├── qulice-pmd ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── qulice │ │ │ └── pmd │ │ │ ├── PmdError.java │ │ │ ├── PmdListener.java │ │ │ ├── PmdRenderer.java │ │ │ ├── PmdValidator.java │ │ │ ├── SourceValidator.java │ │ │ ├── package-info.java │ │ │ └── rules │ │ │ ├── ProhibitPlainJunitAssertionsRule.java │ │ │ ├── UnnecessaryLocalRule.java │ │ │ ├── UseStringIsEmptyRule.java │ │ │ └── package-info.java │ └── resources │ │ └── com │ │ └── qulice │ │ └── pmd │ │ └── ruleset.xml │ ├── site │ ├── apt │ │ └── index.apt.vm │ └── site.xml │ └── test │ ├── java │ └── com │ │ └── qulice │ │ └── pmd │ │ ├── EmptyCollectionRuleTest.java │ │ ├── LocalVariableCouldBeFinalRuleTest.java │ │ ├── PmdAssert.java │ │ ├── PmdDisabledRulesTest.java │ │ ├── PmdEmptyTest.java │ │ ├── PmdValidatorTest.java │ │ ├── UnusedImportsRuleTest.java │ │ ├── UseStringIsEmptyRuleTest.java │ │ └── package-info.java │ └── resources │ ├── com │ └── qulice │ │ └── pmd │ │ ├── AccessToStaticFieldsViaThis.java │ │ ├── AccessToStaticMethodsViaThis.java │ │ ├── AllowAssertFail.java │ │ ├── AllowNonTransientFields.java │ │ ├── AllowsDuplicateLiteralsInAnnotations.java │ │ ├── ArrayOfStringsLengthGreaterThanZero.java │ │ ├── AvoidUsingVolatile.java │ │ ├── CallSuperInConstructor.java │ │ ├── CallToConstructorInConstructor.java │ │ ├── CloneMethodMustBePublic.java │ │ ├── CloneMethodReturnTypeMustMatchClassName.java │ │ ├── CodeInConstructor.java │ │ ├── DefaultPackage.java │ │ ├── DirectAccessToStaticFields.java │ │ ├── DoNotUseThreads.java │ │ ├── EmptyCatchBlock.java │ │ ├── EmptyFinallyBlock.java │ │ ├── EmptyIfStmt.java │ │ ├── EmptyInitializer.java │ │ ├── EmptyStatementBlock.java │ │ ├── EmptyStatementNotInLoop.java │ │ ├── EmptyStaticInitializer.java │ │ ├── EmptySwitchStmt.java │ │ ├── EmptySynchronizedBlock.java │ │ ├── EmptyWhileStmt.java │ │ ├── ExcessiveImports.java │ │ ├── FieldInitConstructor.java │ │ ├── FieldInitNoConstructor.java │ │ ├── FieldInitOneConstructor.java │ │ ├── FieldInitSeveralConstructors.java │ │ ├── FilesCreateFileOther.java │ │ ├── FilesCreateFileTest.java │ │ ├── Junit3TestClassShouldBeFinal.java │ │ ├── Junit4TestClassShouldBeFinal.java │ │ ├── Junit5TestClassShouldBeFinal.java │ │ ├── JunitStaticPublicMethods.java │ │ ├── JunitTestClassIsFinal.java │ │ ├── LambdaInConstructor.java │ │ ├── LocalVariableCouldBeFinal.java │ │ ├── MissingSerialVersionUID.java │ │ ├── NullCollection.java │ │ ├── PlainJUnitAssertionStaticImportBlock.java │ │ ├── PlainJUnitAssertionTestMethod.java │ │ ├── PositionLiteralsFirstInComparisons.java │ │ ├── RecordParsed.java │ │ ├── SimplifiedTernary.java │ │ ├── StaticAccessToStaticFields.java │ │ ├── StaticFieldInitConstructor.java │ │ ├── StaticPublicMethod.java │ │ ├── StaticPublicVoidMainMethod.java │ │ ├── StringLengthEqualsZero.java │ │ ├── StringLengthGreaterOrEqualOne.java │ │ ├── StringLengthGreaterOrEqualZero.java │ │ ├── StringLengthGreaterThanZero.java │ │ ├── StringLengthLessOrEqualZero.java │ │ ├── StringLengthLessThanOne.java │ │ ├── StringLengthNotEqualsZero.java │ │ ├── SwaggerApi.java │ │ ├── TestShouldBePackagePrivate.java │ │ ├── UnderstandsMethodReferences.java │ │ ├── UnicodeCharactersInMethodNames.java │ │ ├── UnnecessaryFinalModifier.java │ │ ├── UnusedImports.java │ │ ├── UseConcurrentHashMap.java │ │ └── UselessParentheses.java │ └── log4j.properties ├── qulice-spi ├── LICENSE.txt ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── qulice │ │ └── spi │ │ ├── Environment.java │ │ ├── ResourceValidator.java │ │ ├── ValidationException.java │ │ ├── Validator.java │ │ ├── Violation.java │ │ └── package-info.java │ ├── site │ ├── apt │ │ └── index.apt.vm │ └── site.xml │ └── test │ └── java │ └── com │ └── qulice │ └── spi │ ├── EnvironmentTest.java │ └── package-info.java ├── renovate.json └── src └── site ├── apt ├── index.apt.vm └── quality.apt.vm ├── resources ├── CNAME └── logo.svg └── site.xml /.0pdd.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | errors: 5 | - yegor256@gmail.com 6 | - krzysztof.krason@gmail.com 7 | # alerts: 8 | # github: 9 | # - yegor256 10 | 11 | tags: 12 | - pdd 13 | - bug 14 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Check out all text files in UNIX format. 2 | * text eol=lf 3 | 4 | # Explicitly declare text files we want to always be normalized and converted 5 | # to native line endings on checkout. 6 | *.txt text 7 | *.java text 8 | *.groovy text 9 | *.xml text 10 | *.md text 11 | *.pom text 12 | *.properties text 13 | 14 | # These files are meant to check violations against use of Windows line endings 15 | NewLines.java -text 16 | newlines.txt -text 17 | 18 | # Denote all files that are truly binary and should not be modified. 19 | *.png binary 20 | *.jpg binary 21 | -------------------------------------------------------------------------------- /.github/workflows/actionlint.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: actionlint 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | actionlint: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: Download actionlint 20 | id: get_actionlint 21 | run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 22 | shell: bash 23 | - name: Check workflow files 24 | run: ${{ steps.get_actionlint.outputs.executable }} -color 25 | shell: bash 26 | -------------------------------------------------------------------------------- /.github/workflows/codecov.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: codecov 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | jobs: 11 | codecov: 12 | timeout-minutes: 15 13 | runs-on: ubuntu-24.04 14 | steps: 15 | - uses: actions/checkout@v4 16 | - uses: actions/setup-java@v4 17 | with: 18 | distribution: 'temurin' 19 | java-version: 20 20 | - uses: actions/cache@v4 21 | with: 22 | path: ~/.m2/repository 23 | key: maven-${{ hashFiles('**/pom.xml') }} 24 | restore-keys: | 25 | maven- 26 | - run: mvn install -Pjacoco -Dinvoker.skip 27 | - uses: codecov/codecov-action@v5 28 | with: 29 | token: ${{ secrets.CODECOV_TOKEN }} 30 | files: qulice-spi/target/site/jacoco/jacoco.xml,qulice-checkstyle/target/site/jacoco/jacoco.xml,qulice-pmd/target/site/jacoco/jacoco.xml,qulice-ant/target/site/jacoco/jacoco.xml,qulice-maven-plugin/target/site/jacoco/jacoco.xml 31 | fail_ci_if_error: true 32 | -------------------------------------------------------------------------------- /.github/workflows/copyrights.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: copyrights 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | copyrights: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: yegor256/copyrights-action@0.0.8 20 | with: 21 | ignore: >- 22 | qulice-maven-plugin/src/it/pmd-violations/src/main/util/some.tex 23 | qulice-checkstyle/src/test/resources/com/qulice/checkstyle/**/*.java 24 | qulice-maven-plugin/src/it/checkstyle-violations/src/main/java/com/qulice/plugin/violations/IndentationChecks.java 25 | -------------------------------------------------------------------------------- /.github/workflows/markdown-lint.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: markdown-lint 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | markdown-lint: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: DavidAnson/markdownlint-cli2-action@v20.0.0 20 | -------------------------------------------------------------------------------- /.github/workflows/mvn.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: mvn 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | mvn: 15 | timeout-minutes: 15 16 | runs-on: ${{ matrix.os }} 17 | strategy: 18 | matrix: 19 | os: [windows-2022, ubuntu-24.04, macos-15] 20 | java: [11, 21] 21 | steps: 22 | - uses: actions/checkout@v4 23 | - uses: actions/setup-java@v4 24 | with: 25 | distribution: 'temurin' 26 | java-version: ${{ matrix.java }} 27 | - uses: actions/cache@v4 28 | with: 29 | path: ~/.m2/repository 30 | key: ${{ runner.os }}-jdk-${{ matrix.java }}-maven-${{ hashFiles('**/pom.xml') }} 31 | restore-keys: | 32 | ${{ runner.os }}-jdk-${{ matrix.java }}-maven- 33 | - run: mvn -B install -Pqulice 34 | -------------------------------------------------------------------------------- /.github/workflows/ort.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: ort 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | ort: 15 | if: false 16 | timeout-minutes: 15 17 | runs-on: ubuntu-24.04 18 | steps: 19 | - uses: actions/checkout@v4 20 | - uses: oss-review-toolkit/ort-ci-github-action@v1 21 | with: 22 | allow-dynamic-versions: 'true' 23 | fail-on: 'violations' 24 | -------------------------------------------------------------------------------- /.github/workflows/pdd.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: pdd 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | pdd: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: volodya-lombrozo/pdd-action@master 20 | -------------------------------------------------------------------------------- /.github/workflows/reuse.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: reuse 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | reuse: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: fsfe/reuse-action@v5 20 | -------------------------------------------------------------------------------- /.github/workflows/typos.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: typos 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | typos: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: crate-ci/typos@v1.32.0 20 | -------------------------------------------------------------------------------- /.github/workflows/up.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: up 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | tags: 11 | - '*' 12 | concurrency: 13 | group: up-${{ github.ref }} 14 | cancel-in-progress: true 15 | jobs: 16 | up: 17 | timeout-minutes: 15 18 | runs-on: ubuntu-24.04 19 | steps: 20 | - uses: actions/checkout@v4 21 | - run: |- 22 | git fetch --tags --force && \ 23 | latest=$(git tag --sort=creatordate | tail -1) && \ 24 | sed -E -i "s/[^<]+/${latest}/g" README.md 25 | - uses: peter-evans/create-pull-request@v6 26 | with: 27 | branch: version-up 28 | commit-message: 'new version in README' 29 | delete-branch: true 30 | title: 'New version in README' 31 | assignees: yegor256 32 | base: master 33 | -------------------------------------------------------------------------------- /.github/workflows/xcop.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: xcop 6 | 'on': 7 | push: 8 | pull_request: 9 | jobs: 10 | xcop: 11 | timeout-minutes: 15 12 | runs-on: ubuntu-24.04 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: g4s8/xcop-action@master 16 | -------------------------------------------------------------------------------- /.github/workflows/yamllint.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | name: yamllint 6 | 'on': 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | jobs: 14 | yamllint: 15 | timeout-minutes: 15 16 | runs-on: ubuntu-24.04 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: ibiqlik/action-yamllint@v3 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .DS_Store 3 | .idea 4 | .idea/ 5 | .project 6 | .settings/ 7 | *.iml 8 | /bin 9 | local-repo/ 10 | node_modules/ 11 | target/ 12 | -------------------------------------------------------------------------------- /.pdd: -------------------------------------------------------------------------------- 1 | --source=. 2 | --verbose 3 | --exclude=target/**/* 4 | --exclude=qulice-*/target/**/* 5 | --exclude=src/main/resources/images/**/* 6 | --exclude=qulice-checkstyle/src/main/resources/com/qulice/checkstyle/checks.xml 7 | --exclude=qulice-checkstyle/src/test/resources/**/* 8 | --exclude=qulice-checkstyle/src/test/resources/com/qulice/checkstyle/AtClauseOrder.java 9 | --rule min-words:4 10 | --rule min-estimate:0 11 | --rule max-estimate:120 12 | -------------------------------------------------------------------------------- /.rultor.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | --- 4 | # yamllint disable rule:line-length 5 | docker: 6 | image: yegor256/rultor-image:1.24.0 7 | assets: 8 | settings.xml: yegor256/home#assets/qulice/settings.xml 9 | secring.gpg: yegor256/home#assets/secring.gpg 10 | pubring.gpg: yegor256/home#assets/pubring.gpg 11 | install: | 12 | pdd --file=/dev/null 13 | merge: 14 | script: |- 15 | mvn clean install -Pqulice-profile -Pqulice --errors --batch-mode 16 | release: 17 | pre: false 18 | sensitive: 19 | - settings.xml 20 | script: |- 21 | [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1 22 | mvn versions:set "-DnewVersion=${tag}" 23 | git commit -am "${tag}" 24 | mvn clean deploy -Pqulice-profile -Pqulice -Psonatype --errors --settings ../settings.xml 25 | mvn clean site-deploy -Pgh-pages -Pqulice-profile -Psite --errors --settings ../settings.xml 26 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2025 Yegor Bugayenko 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 1) Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 2) Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer in the documentation and/or other materials provided 12 | with the distribution. 3) Neither the name of the Qulice.com nor 13 | the names of its contributors may be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 19 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 | THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 28 | OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /LICENSES/MIT.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2025 Yegor Bugayenko 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 1) Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 2) Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer in the documentation and/or other materials provided 12 | with the distribution. 3) Neither the name of the Qulice.com nor 13 | the names of its contributors may be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 19 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 | THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 28 | OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /REUSE.toml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | version = 1 5 | [[annotations]] 6 | path = [ 7 | ".DS_Store", 8 | ".gitattributes", 9 | ".gitignore", 10 | ".pdd", 11 | "**.fml", 12 | "**.json", 13 | "**.md", 14 | "**.svg", 15 | "**.txt", 16 | "**.vm", 17 | "**/.DS_Store", 18 | "**/.gitignore", 19 | "**/.pdd", 20 | "**/*.csv", 21 | "**/*.fml", 22 | "**/*.jpg", 23 | "**/*.json", 24 | "**/*.md", 25 | "**/*.pdf", 26 | "**/*.png", 27 | "**/*.svg", 28 | "**/*.txt", 29 | "**/*.vm", 30 | "**/CNAME", 31 | "CNAME", 32 | "qulice-checkstyle/src/test/resources/**.java", 33 | "qulice-maven-plugin/src/it/**.java", 34 | "README.md", 35 | "renovate.json", 36 | ] 37 | precedence = "override" 38 | SPDX-FileCopyrightText = "Copyright (c) 2025 Yegor Bugayenko" 39 | SPDX-License-Identifier = "MIT" 40 | -------------------------------------------------------------------------------- /qulice-checkstyle/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2025 Yegor Bugayenko 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 1) Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 2) Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer in the documentation and/or other materials provided 12 | with the distribution. 3) Neither the name of the Qulice.com nor 13 | the names of its contributors may be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 19 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 | THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 28 | OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/main/java/com/qulice/checkstyle/ConditionalRegexpMultilineCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.checkstyle; 6 | 7 | import com.puppycrawl.tools.checkstyle.api.FileText; 8 | import com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck; 9 | import java.io.File; 10 | import java.util.regex.Pattern; 11 | 12 | /** 13 | * Performs multiline regexp match only if a regexp condition passes. 14 | * @since 0.5 15 | */ 16 | public final class ConditionalRegexpMultilineCheck extends 17 | RegexpMultilineCheck { 18 | /** 19 | * Condition that has to pass. 20 | */ 21 | private Pattern condition = Pattern.compile("."); 22 | 23 | @Override 24 | public void processFiltered(final File file, final FileText lines) { 25 | boolean found = false; 26 | for (final String line: lines.toLinesArray()) { 27 | if (this.condition.matcher(line).find()) { 28 | found = true; 29 | break; 30 | } 31 | } 32 | if (found) { 33 | super.processFiltered(file, lines); 34 | } 35 | } 36 | 37 | /** 38 | * Condition regexp that has to match before checking the core one. 39 | * @param cond Regexp that has to match in file. 40 | */ 41 | public void setCondition(final String cond) { 42 | this.condition = Pattern.compile(cond); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/main/java/com/qulice/checkstyle/FinalSemicolonInTryWithResourcesCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.checkstyle; 6 | 7 | import com.puppycrawl.tools.checkstyle.api.AbstractCheck; 8 | import com.puppycrawl.tools.checkstyle.api.DetailAST; 9 | import com.puppycrawl.tools.checkstyle.api.TokenTypes; 10 | 11 | /** 12 | * Checks that try-with-resources does not end with a semicolon. Implementation 13 | * relies on existence of semicolon inside of RESOURCE_SPECIFICATION token 14 | * as interpreted by Checkstyle. 15 | * 16 | * @since 0.15 17 | */ 18 | public final class FinalSemicolonInTryWithResourcesCheck extends AbstractCheck { 19 | 20 | @Override 21 | public int[] getDefaultTokens() { 22 | return new int[]{ 23 | TokenTypes.RESOURCE_SPECIFICATION, 24 | }; 25 | } 26 | 27 | @Override 28 | public int[] getAcceptableTokens() { 29 | return this.getDefaultTokens(); 30 | } 31 | 32 | @Override 33 | public int[] getRequiredTokens() { 34 | return this.getDefaultTokens(); 35 | } 36 | 37 | @Override 38 | public void visitToken(final DetailAST ast) { 39 | final int semicolons = ast.getChildCount(TokenTypes.SEMI); 40 | if (semicolons > 0) { 41 | this.log( 42 | ast.getLineNo(), 43 | "Extra semicolon in the end of try-with-resources head." 44 | ); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/main/java/com/qulice/checkstyle/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Checkstyle checks. 8 | * 9 | * @since 0.3 10 | */ 11 | package com.qulice.checkstyle; 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/main/java/com/qulice/checkstyle/parameters/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Argument and generic type parameters. 8 | * 9 | * @since 0.18.18 10 | */ 11 | package com.qulice.checkstyle.parameters; 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/main/resources/com/qulice/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/java/com/qulice/checkstyle/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Tests of checkstyle checks. 8 | * 9 | * @since 0.3 10 | */ 11 | package com.qulice.checkstyle; 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/AnnotationIndentation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | @SuppressWarnings({ 11 | "PMD.TooManyMethods", 12 | "PMD.ExcessiveImports", 13 | "PMD.AvoidDuplicateLiterals" 14 | }) 15 | public final class AnnotationIndentation { 16 | } 17 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/AnnotationIndentationNegative.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | @SuppressWarnings( 11 | { 12 | "PMD.TooManyMethods", 13 | "PMD.ExcessiveImports", 14 | "PMD.AvoidDuplicateLiterals" 15 | } 16 | ) 17 | public final class AnnotationIndentation {} 18 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/AtClauseOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Correct Javadoc for class {@link AtClauseOrder}. 8 | * 9 | * @see AtClauseOrder 10 | * @serial Serial 11 | * @serialField 12 | * @serialData 13 | * @since 1.0 14 | * @deprecated Reason 15 | */ 16 | @Deprecated 17 | public final class AtClauseOrder { 18 | /** 19 | * Empty constructor. 20 | * @checkstyle Suppression 21 | * @todo Puzzle 22 | */ 23 | private AtClauseOrder() { 24 | } 25 | 26 | /** 27 | * Just a method with valid Javadoc. 28 | * 29 | * @param input Valid parameter 30 | * @return Some value 31 | * @throws Exception 32 | * @exception Exception 33 | * @see AtClauseOrder 34 | * @since 1.0 35 | * @deprecated Reason 36 | * @todo Puzzle 37 | * @checkstyle Suppression 38 | */ 39 | @Deprecated 40 | public static int firstMethod(final int input) { 41 | return input; 42 | } 43 | 44 | /** 45 | * Just a method with invalid Javadoc. 46 | * 47 | * @see AtClauseOrder 48 | * @return Some value 49 | */ 50 | public static int secondMethod() { 51 | return input; 52 | } 53 | 54 | /** 55 | * Just a class with invalid Javadoc. 56 | * 57 | * @since 1.0 58 | */ 59 | private class Class { 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/BlankLinesInsideMethodsFail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public final class BlankLinesInsideMethodsFail { 11 | /** 12 | * Method with space between anonymous innter class methods. 13 | */ 14 | public void methodwithAnonymousInnerClass() { 15 | 16 | final Runnable runnable = new Runnable() { 17 | @Override 18 | public void run() { 19 | 20 | this.doSomething(); 21 | 22 | } 23 | 24 | private void doSomething() { 25 | 26 | } 27 | }; 28 | 29 | final Runnable runnables = new Runnable() { 30 | @Override 31 | public void run() { 32 | 33 | this.doSomething(); 34 | 35 | } 36 | 37 | private void doSomething() { 38 | 39 | } 40 | }; 41 | 42 | } 43 | 44 | /** 45 | * Some comment. 46 | */ 47 | public static void methodWithoutInnerClasses() { 48 | 49 | final Integer foo = 5; 50 | 51 | System.out.println(foo); 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/BlankLinesOutsideMethodsPass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public final class BlankLinesOutsideMethodsPass { 11 | /** 12 | * Method with space between anonymous innter class methods. 13 | */ 14 | public void methodwithAnonymousInnerClass() { 15 | final Runnable runnable = new Runnable() { 16 | 17 | @Override 18 | public void run() { 19 | this.doSomething(); 20 | } 21 | 22 | private void doSomething() { 23 | } 24 | 25 | }; 26 | final Runnable runnables = new Runnable() { 27 | 28 | @Override 29 | public void run() { 30 | this.doSomething(); 31 | } 32 | 33 | private void doSomething() { 34 | } 35 | 36 | }; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/CatchParameterNames.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | import java.io.IOException; 7 | import java.util.concurrent.TimeoutException; 8 | 9 | /** 10 | * Simple. 11 | * @since 1.0 12 | * @checkstyle HiddenField (100 lines) 13 | */ 14 | public final class CatchParameterNames { 15 | /** 16 | * Dummy variable. 17 | */ 18 | private int var; 19 | 20 | /** 21 | * Invalid exception parameter name. 22 | */ 23 | void invalidOne() { 24 | try { 25 | this.var += 1; 26 | } catch (final IOException ex_invalid_1) { 27 | this.var -= 1; 28 | } catch (final IllegalArgumentException $xxx) { 29 | this.var -= 1; 30 | } catch (final TimeoutException _exp) { 31 | this.var -= 1; 32 | } 33 | } 34 | 35 | /** 36 | * Valid exception parameter name. 37 | */ 38 | void validOne() { 39 | try { 40 | this.var += 1; 41 | } catch (final IOException ex) { 42 | this.var -= 1; 43 | } catch (final IllegalArgumentException exp) { 44 | this.var -= 1; 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/BracketsStructureCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/BracketsStructureCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 8:Parameters should start on a new line 2 | 9:Closing bracket should be on a new line 3 | 12:Closing bracket should be on a new line 4 | 14:Closing bracket should be on a new line 5 | 18:Parameters should start on a new line 6 | 19:Closing bracket should be on a new line 7 | 22:Closing bracket should be on a new line 8 | 24:Closing bracket should be on a new line 9 | 29:Parameters should start on a new line 10 | 30:Closing bracket should be on a new line 11 | 33:Closing bracket should be on a new line 12 | 35:Closing bracket should be on a new line 13 | 36:Parameters should start on a new line 14 | 37:Closing bracket should be on a new line 15 | 40:Closing bracket should be on a new line 16 | 42:Closing bracket should be on a new line 17 | 54:Closing bracket should be on a new line 18 | 61:Closing bracket should be on a new line 19 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/CommentCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | 6 | /* C-style comment */ 7 | public final class ProhibitedCStyleComment { 8 | 9 | /** first sentence in a single-line comment should start with a capital letter */ 10 | public void main() { 11 | } 12 | 13 | /** 14 | * the first sentence in a multiline comment should start with a capital letter. 15 | */ 16 | private static String TEXT = "some text"; 17 | 18 | /** the first sentence in a multi-line comment must begin with a capital letter, even if the comment begins with two asterisks. 19 | */ 20 | private static String OTHER_TEXT = "some text"; 21 | } 22 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/CommentCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | 6 | /** 7 | * Class comment. 8 | * @since 0.23.1 9 | */ 10 | public final class Valid { 11 | 12 | /** 13 | * Valid multiline comment 14 | */ 15 | private static String VALID_CSTYLE_LITERAL = " /* C-style comment */"; 16 | 17 | /** 18 | * Valid multiline comment starts with two spaces 19 | */ 20 | private static String VALID_CSTYLE_LITERAL_WITH_TWO_SP = " /* C-style comment */"; 21 | 22 | /** Valid single-line comment. */ 23 | private static String SINGLE_LINE_LITERAL = 24 | " /** first sentence in a comment should start with a capital letter */"; 25 | 26 | /** Valid single-line comment starts with two spaces. */ 27 | private static String SINGLE_LINE_LITERAL_WITH_TWO_SP = 28 | " /** first sentence in a comment should start with a capital letter */"; 29 | 30 | /** Valid multiline comment 31 | */ 32 | public void main() { 33 | } 34 | 35 | /** Valid multiline comment starts with two spaces 36 | */ 37 | public void mainTwo() { 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/CommentCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 6:This kind of comment is not allowed. 2 | 9:The first sentence in a multiline comment should start with a capital letter, even if the comment begins with two asterisks. 3 | 9:The first sentence in a single-line comment should start with a capital letter. 4 | 15:The first sentence in a multiline comment should start with a capital letter. 5 | 19:The first sentence in a multiline comment should start with a capital letter, even if the comment begins with two asterisks. 6 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ConstantUsageCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | public final class Invalid { 6 | private static final Invalid INSTANCE = new Invalid(); 7 | private static final int[] OTHER_INSTANCE = { 1, 2, 3, 4 }; 8 | private final int NUMBER = 5; 9 | protected String NAME = "DDD"; 10 | private static final int N = NUMBER*2; 11 | static { 12 | System.out.println(N); 13 | } 14 | { 15 | System.out.println("Before start"); 16 | } 17 | public int do1(int y) { 18 | return y * y; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ConstantUsageCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ConstantUsageCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 6:Private constant "INSTANCE" is not used 2 | 7:Private constant "OTHER_INSTANCE" is not used 3 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/CurlyBracketsStructureCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/CurlyBracketsStructureCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 15:Closing bracket should be on a new line 2 | 18:Closing bracket should be on a new line 3 | 19:Parameters should start on a new line 4 | 23:Closing bracket should be on a new line 5 | 28:Closing bracket should be on a new line 6 | 31:Closing bracket should be on a new line 7 | 32:Parameters should start on a new line 8 | 36:Closing bracket should be on a new line 9 | 41:Closing bracket should be on a new line 10 | 44:Closing bracket should be on a new line 11 | 45:Parameters should start on a new line 12 | 49:Closing bracket should be on a new line 13 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/EmptyLinesCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | public final class Invalid { 6 | public void main() { 7 | // The following empty line is prohibited and should be 8 | // caught by our EmptyLinesCheck: 9 | 10 | int works = true; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/EmptyLinesCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | public final class Valid { 6 | public void main() { 7 | int works = true; 8 | new Take() { 9 | public Response act(final Request req) { 10 | ref.set(req); 11 | return new Response() { 12 | public Iterable head() throws IOException { 13 | return Collections.singletonList("HTTP/1.1 200 OK"); 14 | } 15 | 16 | public InputStream body() throws IOException { 17 | return req.body(); 18 | } 19 | }; 20 | } 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/EmptyLinesCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/EmptyLinesCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 9:Empty line inside method 2 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ImportCohesionCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | import java.util.List; 6 | // This line is not valid, since it's a comment, and the next one is 7 | // not valid too since it's empty 8 | 9 | import java.util.Map; 10 | public final class Invalid { 11 | public void main() { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ImportCohesionCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | public final class Invalid { 10 | public void main() { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ImportCohesionCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ImportCohesionCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 4:Line before imports should be empty 2 | 6:Empty line or comment between imports is not allowed 3 | 7:Empty line or comment between imports is not allowed 4 | 8:Empty line or comment between imports is not allowed 5 | 10:Line after imports should be empty 6 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocEmptyLineCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocEmptyLineCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 8:Empty Javadoc line at the beginning 2 | 15:Empty Javadoc line at the beginning 3 | 21:Empty Javadoc line at the beginning 4 | 28:Empty Javadoc line at the end 5 | 33:Empty Javadoc line at the beginning 6 | 39:Empty Javadoc line at the beginning 7 | 43:Empty Javadoc line at the end 8 | 50:Empty Javadoc line at the beginning 9 | 57:Empty Javadoc line at the beginning 10 | 68:Empty Javadoc line at the end 11 | 73:Empty Javadoc line at the beginning 12 | 82:Empty Javadoc line at the beginning 13 | 93:Empty Javadoc line at the end 14 | 98:Empty Javadoc line at the beginning 15 | 104:Empty Javadoc line at the beginning 16 | 112:Empty Javadoc line at the beginning 17 | 114:Empty Javadoc line at the end 18 | 119:Empty Javadoc line at the beginning 19 | 126:Empty Javadoc line at the end 20 | 132:Empty Javadoc line at the end 21 | 141:Empty Javadoc line at the end 22 | 146:Empty Javadoc line at the beginning 23 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocLocationCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | 6 | public final class Invalid { 7 | 8 | /** 9 | * 10 | */ 11 | 12 | private int x = 0; 13 | 14 | /** 15 | * 16 | */ 17 | 18 | 19 | public Invalid() {} 20 | 21 | /** 22 | * 23 | */ 24 | 25 | public void method() { 26 | } 27 | 28 | public void method2() { 29 | } 30 | } 31 | /** 32 | * This is not a real Java class. It won't be compiled ever. It is used 33 | * only as a text resource in integration.ChecksIT. 34 | */ 35 | 36 | interface I1 { 37 | public void method3() { 38 | } 39 | 40 | /** 41 | * Integer variable. 42 | */ 43 | 44 | private int x = 0; 45 | 46 | } 47 | 48 | interface I2 { 49 | 50 | } 51 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocLocationCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | public final class Valid { 6 | 7 | /** 8 | * Integer variable. 9 | */ 10 | private int x = 0; 11 | 12 | private int y = 0; 13 | 14 | /** 15 | * Public ctor. 16 | * @param num Some number 17 | */ 18 | @SuppressWarnings("test") 19 | public Valid(final Integer num) {} 20 | 21 | /** 22 | * Some other method. 23 | * @param alpha Some number 24 | * @param beta Some string 25 | */ 26 | @SuppressWarnings("test") 27 | public byte[] method(final int[] alpha, final String beta) { 28 | int a = 5; 29 | int b = 3; 30 | final String texts = new String[] {"hello there!"}; 31 | assert a != b; 32 | final Runnable runnable = new Runnable() { 33 | @Override 34 | void run() { 35 | Valid.this.send(new String[] {"oops"}); 36 | } 37 | }; 38 | return new byte[] {1}; 39 | } 40 | } 41 | /** 42 | * This is not a real Java class. It won't be compiled ever. It is used 43 | * only as a text resource in integration.ChecksIT. 44 | */ 45 | interface I1 { 46 | /** 47 | * Integer variable. 48 | */ 49 | private int x = 0; 50 | } 51 | 52 | interface I2 { 53 | 54 | } 55 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocLocationCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocLocationCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 5:Empty line between javadoc and subject 2 | 11:Empty line between javadoc and subject 3 | 17:Empty line between javadoc and subject 4 | 18:Empty line between javadoc and subject 5 | 24:Empty line between javadoc and subject 6 | 35:Empty line between javadoc and subject 7 | 43:Empty line between javadoc and subject 8 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocParameterOrderCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Empty javadoc line at the beginning. 3 | */ 4 | package com.qulice.checkstyle; 5 | 6 | /** 7 | * This is not a real Java class. It won't be compiled ever. It is used 8 | * only as a text resource in integration.ChecksIT. 9 | */ 10 | public final class Valid { 11 | 12 | /** 13 | * A field. 14 | */ 15 | private final String field; 16 | 17 | /** 18 | * Javadoc with parameters in same order than the constructor signature. 19 | * @param bparam - param b. 20 | * @param aparam - param a. 21 | */ 22 | Valid(final String bparam, final String aparam) { 23 | this.field = bparam.concat(aparam); 24 | } 25 | 26 | /** 27 | * Javadoc with parameters in same order than the method signature. 28 | * @param bparam - param b. 29 | * @param aparam - param a. 30 | * @return Param. 31 | */ 32 | public String method(final String bparam, final String aparam) { 33 | return bparam + aparam; 34 | } 35 | 36 | /** 37 | * Correct order of parameters. 38 | * @param list List. 39 | * @param index Index. 40 | * @param Type. 41 | * @return Element. 42 | */ 43 | public T get(final List list, final int index) { 44 | return list.get(index); 45 | } 46 | 47 | /** 48 | * Correct order of parameters. 49 | * @param Key. 50 | * @param Value. 51 | */ 52 | public final static class Entry { 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocParameterOrderCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocParameterOrderCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 11:Javadoc parameter order different than method signature 2 | 12:Javadoc parameter order different than method signature 3 | 24:Javadoc parameter order different than method signature 4 | 25:Javadoc parameter order different than method signature 5 | 33:Javadoc parameter order different than method signature 6 | 34:Javadoc parameter order different than method signature 7 | 47:Number of javadoc parameters different than method signature 8 | 55:Number of javadoc parameters different than method signature 9 | 64:Number of javadoc parameters different than method signature 10 | 70:Javadoc parameter order different than method signature 11 | 71:Javadoc parameter order different than method signature 12 | 72:Javadoc parameter order different than method signature 13 | 82:Number of javadoc parameters different than method signature 14 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocTagsCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | 6 | /** 7 | * This comment doesn't have since tag. 8 | */ 9 | public final class ProhibitedTagsAndMissingSince { 10 | public void main() { 11 | } 12 | } 13 | 14 | /** 15 | * @since a1.0 16 | */ 17 | public final class InvalidSince { 18 | } 19 | 20 | /** 21 | * This class have an inner class with no since tag. 22 | * @since 1.0 23 | */ 24 | public final class InvalidInner { 25 | /** 26 | * Inner class without since tag. 27 | */ 28 | public final class InvalidInnerSince { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocTagsCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | 6 | /** 7 | * @since 0.28.3 8 | */ 9 | public final class Valid { 10 | public void main() { 11 | } 12 | 13 | /** 14 | * Inner. 15 | * 16 | * @since 3.14 17 | */ 18 | private final static class Inner { 19 | public void other() { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocTagsCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/JavadocTagsCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 6:Missing '@since' tag in class/interface comment 2 | 15:Tag text 'a1.0' does not match the pattern '^\d+(\.\d+){1,2}(\.[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$' 3 | 25:Missing '@since' tag in class/interface comment 4 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/MethodBodyCommentsCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | public final class Invalid { 6 | /** 7 | * Comments. 8 | */ 9 | public Invalid(String name, String value) { 10 | /* Comments */ 11 | int i; 12 | // Comments 13 | } 14 | public void print(String format, String text) { 15 | // Comments 16 | int c = 0; 17 | /* Comments */ 18 | } 19 | 20 | public int invalidCommentInside() { 21 | final int first = 1; 22 | /* invalid comment */ final int second = 2; 23 | return first + second; 24 | } 25 | 26 | public int invalidMultilineInside() { 27 | /** 28 | * invalid multiline comment 29 | */ 30 | } 31 | 32 | void submit() { 33 | new Runnable() { 34 | @Override 35 | public void run() { 36 | /* run 37 | */ 38 | } 39 | }; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/MethodBodyCommentsCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | public final class Valid { 6 | /** 7 | * Comments. 8 | */ 9 | public Invalid(String name, String value) { 10 | this.a = b; 11 | // @checkstyle MagicNumber (1 line) 12 | this.a = b; 13 | } 14 | /** 15 | * Comments. 16 | */ 17 | public void print(String format, String text) { 18 | int c = 0; 19 | // @checkstyle MagicNumber (1 line) 20 | this.a = b; 21 | } 22 | public void print() { 23 | // empty method, nothing here but a comment 24 | } 25 | /** 26 | * Some comment. 27 | */ 28 | @Override 29 | public void print() { 30 | // empty 31 | } 32 | /** 33 | * Some method. 34 | */ 35 | public void someMethod() { 36 | final Closeable resource = new Closeable() { 37 | @Override 38 | public void close() { 39 | // nothing to close here 40 | } 41 | }; 42 | } 43 | } 44 | 45 | /** 46 | * Example with an interface. 47 | */ 48 | public interface ValidInterface { 49 | /** 50 | * Some method with no body 51 | */ 52 | void method(); 53 | 54 | /* Some plain comment outside method*/ 55 | void method(); 56 | /* Another plain comment outside method */ 57 | } 58 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/MethodBodyCommentsCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/MethodBodyCommentsCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 10:Comments in method body are prohibited 2 | 12:Comments in method body are prohibited 3 | 15:Comments in method body are prohibited 4 | 17:Comments in method body are prohibited 5 | 22:Comments in method body are prohibited 6 | 27:Comments in method body are prohibited 7 | 36:Comments in method body are prohibited 8 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/MethodsOrderCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.checkstyle.ChecksTest.MethodsOrderCheck; 6 | 7 | /** 8 | * This is not a real Java class. It won't be compiled ever. It is used 9 | * only as a text resource in integration.ChecksIT. 10 | */ 11 | public final class Invalid { 12 | public void print(String format, String text ) { 13 | } 14 | private void print(String format, String[] text) { 15 | } 16 | protected void print(){ 17 | } 18 | void print(){ 19 | } 20 | private void print(String format, String text ) { 21 | } 22 | static class InvalidStaticInner { 23 | protected void print(){ 24 | } 25 | private void print(String format, String[] text) { 26 | } 27 | private Valid(String name, String value) { 28 | } 29 | public void print(String format, String text ) { 30 | } 31 | void print(){ 32 | } 33 | } 34 | 35 | class InvalidInner { 36 | public void print(String format, String text ) { 37 | } 38 | protected void print(){ 39 | } 40 | void print(){ 41 | } 42 | private void print(String format, String[] text) { 43 | } 44 | private Valid(String name, String value) { 45 | } 46 | protected void print(){ 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/MethodsOrderCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/MethodsOrderCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 16:Wrong method declaration order 2 | 18:Wrong method declaration order 3 | 29:Wrong method declaration order 4 | 31:Wrong method declaration order 5 | 46:Wrong method declaration order 6 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/MultilineJavadocTagsCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * LICENSE. 3 | */ 4 | /** 5 | * Some text. 6 | * sadsdada 7 | * @param text Some text, which description 8 | * takes a few lines 9 | */ 10 | package foo; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * This is not a real Java class. It won't be compiled ever. It is used 16 | * only as a text resource in integration.ChecksIT. 17 | */ 18 | public final class Valid { 19 | /** 20 | * Some text. 21 | * sadsdada 22 | * @param text Some text, which description 23 | * takes a few lines 24 | */ 25 | public void Valid() { 26 | } 27 | /** 28 | * @param text Some text, which description 29 | * takes a few lines 30 | * takes a few lines 31 | */ 32 | public void Valid(int x) { 33 | } 34 | /** 35 | * Some text. 36 | * @param text Some text, which description 37 | * takes a few lines 38 | * @return The result 39 | */ 40 | public void main() { 41 | } 42 | /** 43 | * @param text Some text, which description 44 | * takes a few lines 45 | * takes a few lines 46 | * @return The result 47 | */ 48 | public void main1() { 49 | } 50 | /** 51 | * No params here. 52 | */ 53 | public void someMethod() { 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/MultilineJavadocTagsCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/MultilineJavadocTagsCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 3:Should contain one indentation space 2 | 4:Should contain one indentation space 3 | 18:Should contain one indentation space 4 | 20:Should contain one indentation space 5 | 27:Should contain one indentation space 6 | 28:Should contain one indentation space 7 | 31:Should contain one indentation space 8 | 33:Should contain one indentation space 9 | 37:Should contain one indentation space 10 | 47:Should contain one indentation space 11 | 49:Should contain one indentation space 12 | 56:Should contain one indentation space 13 | 57:Should contain one indentation space 14 | 60:Should contain one indentation space 15 | 62:Should contain one indentation space 16 | 66:Should contain one indentation space 17 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/NoJavadocForOverriddenMethodsCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | 6 | public final class Invalid { 7 | 8 | /** 9 | * Javadoc. 10 | */ 11 | @Override 12 | public void javadoc() { 13 | } 14 | 15 | /** 16 | * {@inheritDoc} 17 | */ 18 | @Override 19 | public void inherited() { 20 | } 21 | 22 | /** Javadoc. */ 23 | @Override 24 | public void inherited() { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/NoJavadocForOverriddenMethodsCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | 6 | public final class Valid { 7 | 8 | @Override 9 | public void main() { 10 | } 11 | 12 | /** 13 | * Javadoc. 14 | */ 15 | public void note() { 16 | } 17 | 18 | @Override 19 | public void inherit() { 20 | } 21 | 22 | /** 23 | * Javadoc. 24 | */ 25 | public void doc() { 26 | } 27 | 28 | //todo 29 | @Override 30 | public void good() { 31 | } 32 | 33 | /* 34 | comment 35 | */ 36 | @Override 37 | public void well() { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/NoJavadocForOverriddenMethodsCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/NoJavadocForOverriddenMethodsCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 11:Overridden methods should not have Javadoc 2 | 18:Overridden methods should not have Javadoc 3 | 23:Overridden methods should not have Javadoc 4 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/NonStaticMethodCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | public class InvalidTest { 6 | public String name() { 7 | return "test"; 8 | } 9 | public String name() { 10 | return "this"; 11 | } 12 | @Deprecated 13 | public String name() { 14 | return "method with non-override annotation"; 15 | } 16 | public synchronized String name() { 17 | return "method with non-native and non-abstract modifier"; 18 | } 19 | public String name() { 20 | try { 21 | ThatClass.name(); 22 | } catch (IOException e) { 23 | throw new IllegalStateException(e); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/NonStaticMethodCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/NonStaticMethodCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 6:This method must be static, because it does not refer to "this" 2 | 9:This method must be static, because it does not refer to "this" 3 | 12:This method must be static, because it does not refer to "this" 4 | 16:This method must be static, because it does not refer to "this" 5 | 19:This method must be static, because it does not refer to "this" 6 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProhibitNonFinalClassesCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.checkstyle.ChecksTest.ProhibitNonFinalClassesCheck; 6 | 7 | /** 8 | * This is not a real Java class. It won't be compiled ever. It is used 9 | * only as a text resource in integration.ChecksIT. 10 | */ 11 | public class Invalid { 12 | public void foo() {} 13 | 14 | private static class Inner { 15 | protected void bar() {} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProhibitNonFinalClassesCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.checkstyle.ChecksTest.ProhibitNonFinalClassesCheck; 6 | 7 | /** 8 | * This is not a real Java class. It won't be compiled ever. It is used 9 | * only as a text resource in integration.ChecksIT. 10 | */ 11 | public final class Valid { 12 | public void foo() {} 13 | 14 | private static final class Inner { 15 | protected void bar() {} 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProhibitNonFinalClassesCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProhibitNonFinalClassesCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 11:Classes should be final 2 | 14:Classes should be final 3 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProhibitUnusedPrivateConstructorCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.checkstyle.ChecksTest.ProhibitUnusedPrivateConstructorCheck; 6 | 7 | /* 8 | * This is not a real Java class. It won't be compiled ever. It is used 9 | * only as a text resource in integration.ChecksIT. 10 | */ 11 | public final class Invalid { 12 | 13 | private final String s; 14 | 15 | public Invalid(String s) { 16 | this.s = s; 17 | } 18 | 19 | private Invalid(int x) { 20 | this(String.valueOf(x)); 21 | } 22 | 23 | public static Invalid create() { 24 | return new Invalid("0"); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProhibitUnusedPrivateConstructorCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.checkstyle.ChecksTest.ProhibitUnusedPrivateConstructorCheck; 6 | /* 7 | * This is not a real Java class. It won't be compiled ever. It is used 8 | * only as a text resource in integration.ChecksIT. 9 | */ 10 | public final class Valid { 11 | 12 | private final int i; 13 | 14 | public Valid(final String s) { 15 | this(s.length()); 16 | } 17 | 18 | private Valid(int i) { 19 | this.i = i; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProhibitUnusedPrivateConstructorCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProhibitUnusedPrivateConstructorCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 19:Unused private constructor. 2 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProtectedMethodInFinalClassCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.checkstyle.ChecksTest.ProtectedMethodInFinalClassCheck; 6 | 7 | /** 8 | * This is not a real Java class. It won't be compiled ever. It is used 9 | * only as a text resource in integration.ChecksIT. 10 | */ 11 | public final class Invalid { 12 | public void foo() {} 13 | protected void invalid() {} 14 | private void bar() {} 15 | protected void invalid2() {} 16 | 17 | private static final class Bar { 18 | protected void valid() {} 19 | } 20 | 21 | private abstract static class Foo { 22 | void valid() {}; 23 | } 24 | 25 | private final static class FooChild extends Invalid.Foo { 26 | @Override 27 | protected void valid() { 28 | return; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProtectedMethodInFinalClassCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.checkstyle.ChecksTest.ProtectedMethodInFinalClassCheck; 6 | 7 | import java.util.concurrent.Callable; 8 | 9 | /** 10 | * This is not a real Java class. It won't be compiled ever. It is used 11 | * only as a text resource in integration.ChecksIT. 12 | */ 13 | public final class Valid { 14 | 15 | protected int num = 1; 16 | 17 | public void foo() {} 18 | private void bar() {} 19 | 20 | private static class Bar { 21 | protected void valid() {} 22 | } 23 | 24 | private abstract static class Foo { 25 | protected void valid(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProtectedMethodInFinalClassCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/ProtectedMethodInFinalClassCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 13:Final class should not contain protected methods 2 | 15:Final class should not contain protected methods 3 | 18:Final class should not contain protected methods 4 | 26:Protected method is overriding default scoped method 5 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/QualifyInnerClassCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | public final class Invalid { 6 | 7 | public void methodBeforeDef(int num) { 8 | new Bar(num); 9 | } 10 | 11 | private static final class Bar { 12 | 13 | private final int member; 14 | 15 | Bar(int num) { 16 | this.member = num; 17 | } 18 | } 19 | 20 | public void methodAfterDef(int num) { 21 | new Bar(num); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/QualifyInnerClassCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | public final class Valid { 6 | 7 | public void methodBeforeDef(int num) { 8 | new Valid.Bar(num); 9 | } 10 | 11 | private static final class Bar { 12 | private final int num; 13 | 14 | Bar(int num) { 15 | this.num = num; 16 | } 17 | } 18 | 19 | public void methodAfterDef(int num) { 20 | new Valid.Bar(num); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/QualifyInnerClassCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/QualifyInnerClassCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 8:Static inner class should be qualified with outer class 2 | 21:Static inner class should be qualified with outer class 3 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/RequireThisCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | 6 | public final class Invalid { 7 | private final int number = 1; 8 | 9 | public int check() { 10 | int sum = number; 11 | sum += other(); 12 | return sum; 13 | } 14 | 15 | private int other() { 16 | return 0; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/RequireThisCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | 6 | public final class Valid { 7 | private final int number = 1; 8 | 9 | public int check() { 10 | int sum = this.number; 11 | sum += this.other(); 12 | return sum; 13 | } 14 | 15 | private int other() { 16 | return 0; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/RequireThisCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/RequireThisCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 10:Reference to instance variable 'number' needs "this.". 2 | 11:Method call to 'other' needs "this.". 3 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/StringLiteralsConcatenationCheck/Invalid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | public final class Invalid { 6 | public void foo1() { 7 | if (true) { 8 | String str = "a" + "b"; 9 | } 10 | } 11 | 12 | public void foo2() { 13 | String a = "a"; 14 | String str = a + "b"; 15 | } 16 | 17 | public void foo3() { 18 | System.out.println("File not found: " + file); 19 | } 20 | 21 | public void foo4() { 22 | String x = "x"; 23 | x += "done"; 24 | } 25 | 26 | public void foo5() { 27 | final Exception ex = new RuntimeException(); 28 | throw new IllegalStateException("Failed to create checker" 29 | + " test" + ex.getMessage(), ex 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/StringLiteralsConcatenationCheck/Valid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is not a real Java class. It won't be compiled ever. It is used 3 | * only as a text resource in integration.ChecksIT. 4 | */ 5 | public final class Valid { 6 | public void main() { 7 | String a = ""; 8 | String c = a.concat("b"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/StringLiteralsConcatenationCheck/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ChecksTest/StringLiteralsConcatenationCheck/violations.txt: -------------------------------------------------------------------------------- 1 | 8:Concatenation of string literals prohibited 2 | 14:Concatenation of string literals prohibited 3 | 18:Concatenation of string literals prohibited 4 | 23:Concatenation of string literals prohibited 5 | 29:Concatenation of string literals prohibited 6 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ConstructorParams.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public final class ConstructorParams { 11 | /** 12 | * Some number. 13 | */ 14 | private final int number; 15 | 16 | /** 17 | * Constructor. 18 | * @param number Some nice number. 19 | */ 20 | public ConstructorParams(final int number) { 21 | this.number = number; 22 | } 23 | 24 | /** 25 | * Add an external number to internal one. 26 | * @param number Number to add. 27 | * @return Sum of numbers. 28 | */ 29 | public int addNumber(final int number) { 30 | return this.number + number; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/DefaultMethods.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | import java.util.List; 7 | import java.util.function.Consumer; 8 | 9 | /** 10 | * Simple. 11 | * @since 1.0 12 | */ 13 | public interface DefaultMethods { 14 | /** 15 | * Some data. 16 | * @return Some data. 17 | */ 18 | List data(); 19 | 20 | /** 21 | * Some default method. 22 | * @param action Value to print 23 | */ 24 | default void forEach(final Consumer action) { 25 | for (final String blah : this.data()) { 26 | action.accept(blah); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/DiamondUsageNotNeeded.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * Some comment. 11 | * 12 | * @since 1.0 13 | */ 14 | public final class DiamondUsageNotNeeded { 15 | 16 | @Override 17 | public List firstTen(final String... args) { 18 | return new ArrayList(2); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/DoNotUseCharEncoding.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | import com.google.common.base.Charsets; 7 | import org.apache.commons.codec.CharEncoding; 8 | import org.apache.commons.lang.CharEncoding; 9 | import org.apache.commons.lang3.CharEncoding; 10 | 11 | /** 12 | * Simple. 13 | * @since 1.0 14 | */ 15 | public final class DoNotUseCharEncoding { 16 | /** 17 | * Act. 18 | */ 19 | public void act() { 20 | System.out.println(this + CharEncoding.UTF_8); 21 | System.out.println(this + Charsets.UTF_8); 22 | System.out.println(org.apache.commons.lang3.CharEncoding.UTF_8); 23 | System.out.println(org.apache.commons.lang.CharEncoding.ISO_8859_1); 24 | System.out.println(org.apache.commons.codec.CharEncoding.UTF_16); 25 | System.out.println(com.google.common.base.Charsets.UTF_8); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ExtraSemicolon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public final class ExtraSemicolon { 11 | /** 12 | * Method with extra semicolon in the end 13 | * of try-with-resources head. 14 | */ 15 | public void view() { 16 | try ( 17 | Closeable door = new Door(); 18 | Closeable window = new Window(); 19 | Closeable win = new Window(); 20 | ) { 21 | int data = input.read(); 22 | while (data != -1) { 23 | System.out.print((char) data); 24 | data = input.read(); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/HiddenParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Hidden parameter test. 8 | * @since 1.0 9 | */ 10 | class HiddenParameter { 11 | private final String test = ""; 12 | 13 | /** 14 | * Some documentation for the function. 15 | * @param test Test 16 | */ 17 | void bar(final String test) { // error is here 18 | System.out.println("Hello: " + test); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/InstanceMethodRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | /** 6 | * Simple. 7 | * @since 1.0 8 | */ 9 | public final class InstanceMethodRef { 10 | /** 11 | * Start. Check fails in this method. 12 | */ 13 | private void start() { 14 | Collections.singletonList("1") 15 | .forEach(this::doSomething); 16 | } 17 | 18 | /** 19 | * Method to be referenced. 20 | * @param value Value to print 21 | */ 22 | private static void doSomething(final String value) { 23 | System.out.println(value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/InvalidAbbreviationAsWordInNameXML.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Uppercase abbreviation XML in class name is not allowed. 8 | * 9 | * @since 1.0 10 | */ 11 | public class InvalidAbbreviationAsWordInNameXML { 12 | /** 13 | * Uppercase abbreviation HTML in nested class name is not allowed. 14 | */ 15 | class InvalidHTML { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/InvalidDiamondsUsage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | import java.util.ArrayList; 7 | import java.util.Arrays; 8 | import java.util.List; 9 | 10 | /** 11 | * Better to use diamond operator where possible. 12 | * 13 | * @since 1.0 14 | */ 15 | public final class InvalidDiamondsUsage { 16 | 17 | @Override 18 | public List firstTen(final String... args) { 19 | final List list = new ArrayList(args.length); 20 | list.addAll(Arrays.asList(args)); 21 | return list; 22 | } 23 | 24 | /** 25 | * Wrong diamonds usage when instantiate an inner class type. 26 | */ 27 | public static void innerClassUsage() { 28 | final SimpleInterface.InnerClass inner = 29 | new SimpleInterface.InnerClass(); 30 | } 31 | 32 | /** 33 | * Simple interface, used as wrapper. 34 | * @since 1.0.0 35 | */ 36 | interface SimpleInterface { 37 | 38 | /** 39 | * Inner class with generic parameter. 40 | * @param generic parameter 41 | * @since 1.0.0 42 | */ 43 | final class InnerClass implements SimpleInterface { 44 | 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/InvalidIndentation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo.bar; 5 | 6 | /** 7 | * Simple. 8 | */ 9 | public class InvalidIndentation { 10 | /** 11 | * Ctor. 12 | */ 13 | public InvalidIndentation() { 14 | final String first = String.format( 15 | "incorrect" 16 | ); 17 | final String correct = String.format( 18 | "correct" 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/InvalidMethodDoc.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello 3 | */ 4 | package foo; 5 | 6 | /** 7 | * The {@code InvalidMethodDoc#method} comment isn't javadoc, but it's not a reason 8 | * to fail {@code MultilineJavadocTagsCheck} validation with an unhandled exception. 9 | * @foo bar 10 | */ 11 | class InvalidMethodDoc { 12 | /* 13 | * Run method. 14 | */ 15 | void method() { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/LineWrapPackage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo 5 | .bar; 6 | 7 | /** 8 | * Simple. 9 | * @since 1.0 10 | */ 11 | public interface LineWrapPackage { 12 | /** 13 | * Some data. 14 | * @return Some data. 15 | */ 16 | Integer data(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/MissingJavadocTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | import org.junit.jupiter.api.Test; 7 | 8 | /** 9 | * Simple. 10 | * @since 1.0 11 | */ 12 | class MissingJavadocTest { 13 | 14 | @Test 15 | public void testSomething() { 16 | return "something"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ParametrizedClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Simple. 10 | * @since 1.0 11 | */ 12 | public interface ParametrizedClass { 13 | /** 14 | * Some data. 15 | * @return Some data. 16 | */ 17 | List data(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ReturnCount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public final class ReturnCount { 11 | /** 12 | * Method with two {@code return} statements. 13 | * @param number Some nice number. 14 | */ 15 | public int methodWithTwoReturns(final int number) { 16 | if (number == 0) { 17 | return 0; 18 | } 19 | return 1; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/TooLongLines.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo.bar; 5 | 6 | /** 7 | * Very long lines. 8 | * @deprecated Very very very very very very very very very very very long reason, extended line length. 9 | */ 10 | @Deprecated 11 | public class TooLongLines { 12 | // @deprecated is used here because of very very very very very very long reason, even longer line. 13 | } 14 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/UrlInLongLine.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Very long lines. 8 | * https://very-long.net/thisUrlIsVeryLong?AndItHasQueryParams=1&url%2encoding#withHashTags 9 | * @since 1.0 10 | */ 11 | public interface UrlInLongLine { 12 | } 13 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ValidAbbreviationAsWordInName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Classname contains no abbreviations. 8 | * Contains overridden method for which otherwise invalid uppercase use is 9 | * allowed. 10 | * 11 | * @since 1.0 12 | */ 13 | public class ValidAbbreviationAsWordInName extends SomeClass { 14 | 15 | /** 16 | * Example final static is valid and does not need to be in camelcase. 17 | */ 18 | private static final String CONST_VALUE = "foo"; 19 | 20 | @Override 21 | public final String UPPERCASE() { 22 | return ValidAbbreviationAsWordInName.CONST_VALUE; 23 | } 24 | 25 | /** 26 | * ValidInnerHtml example class having the abbreviation in camelcase. 27 | * @since 1.0 28 | */ 29 | public class ValidInnerHtml { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ValidAbbreviationAsWordInNameIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Uppercase abbreviation IT in class name is allowed. 8 | * @since 1.0 9 | */ 10 | public class ValidAbbreviationAsWordInNameIT { 11 | /** 12 | * Valid name on inner class, because the IT abbreviation is allowed. 13 | * @since 1.0 14 | */ 15 | class ValidInnerIT { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ValidIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public class ValidIT { 11 | /** 12 | * Any action. 13 | * @return Any string 14 | */ 15 | public final String action() { 16 | return "something"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ValidITCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public class ValidITCase { 11 | /** 12 | * Any action. 13 | * @return Any string 14 | */ 15 | public final String action() { 16 | return "something"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ValidIndentation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public class ValidIndentation { 11 | /** 12 | * Ctor. 13 | */ 14 | public ValidIndentation() { 15 | Arrays.asList( 16 | new Integer( 17 | 1 18 | ) 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ValidLambdaAndGenericsAtEndOfLine.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public final class ValidLambdaAndGenericsAtEndOfLine { 11 | 12 | /** 13 | * Final. 14 | */ 15 | private final int zero = 0; 16 | 17 | /** 18 | * Main method. 19 | */ 20 | public void main() { 21 | final Proc proc = () -> 22 | this.zero; 23 | final Func func = var -> 24 | var * 2; 25 | final BiFunc bifunc = (param, par) -> 26 | param * par; 27 | final List 28 | list = new ArrayList<>(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ValidLiteralComparisonCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public final class ValidLiteralComparisonCheck { 11 | /** 12 | * Some text. 13 | */ 14 | private final String text; 15 | 16 | /** 17 | * Constructor. 18 | * @param txt Some text. 19 | */ 20 | public ValidLiteralCheck(final String txt) { 21 | this.text = txt; 22 | } 23 | 24 | /** 25 | * Method using input.equals("contents") 26 | * instead of "contents".equals(input). 27 | */ 28 | public void validStringComparison() { 29 | System.out.println(this.text.equals("contents")); 30 | System.out.println("contents".equals(this.text)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ValidRecord.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Defines a simple record type. 8 | * @since 1.0 9 | */ 10 | public final class ValidRecord { 11 | /** 12 | * Just a record type which should be successfully parsed. 13 | * @param hello Some field. 14 | * @param world Another field. 15 | * @since 1.0 16 | */ 17 | private record SomeRecord(String hello, int world) { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ValidSemicolon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public final class ValidSemicolon { 11 | /** 12 | * Dummy data. 13 | */ 14 | private int dat = 1; 15 | 16 | /** 17 | * Method without extra semicolon in the end 18 | * of try-with-resources head. 19 | */ 20 | public void view() { 21 | try ( 22 | Closeable door = new Door(); 23 | Closeable window = new Window(); 24 | Closeable win = new Window() 25 | ) { 26 | int data = input.read() + this.dat; 27 | while (data != -1) { 28 | System.out.print((char) data); 29 | data = input.read(); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/ValidSingleLineCommentCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Correct Javadoc for class {@link AtClauseOrder}. 8 | * 9 | * @since 1.0 10 | */ 11 | public final class ValidSingleLineCommentCheck { 12 | /** 13 | * A valid literal (Qulice may not report its contents as it is domain-specific string, 14 | * not Java code). 15 | */ 16 | public static final String LITERAL_WHICH_LOOKS_LIKE_COMMENT = "/* Hello */"; 17 | 18 | /** 19 | * Same here. 20 | */ 21 | public static final String ANOTHER_LITERAL = "/**/"; 22 | 23 | /** Valid single line literal. */ 24 | public static final String SINGLE_LINE_LITERAL = "/** this is not comment **/"; 25 | 26 | /** 27 | * Valid multi line literal. 28 | */ 29 | public static final String[] MULTILINE_LITERAL = { 30 | " /**", " * @since 0.3.4.4.", " **/", 31 | " /**", 32 | " * @since 0.3.4.4.", 33 | " **/", 34 | }; 35 | 36 | /** 37 | * Empty constructor. 38 | */ 39 | private AtClauseOrder() { 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/WindowsEol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | * 4 | * World. 5 | */ 6 | package foo; 7 | /** 8 | * Simple class. 9 | * @since 1.0 10 | */ 11 | public class WindowsEol { } 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/com/qulice/checkstyle/WindowsEolLinux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Welcome. 3 | * 4 | * Friend. 5 | */ 6 | package foo; 7 | /** 8 | * Just a simple class. 9 | * @since 1.0 10 | */ 11 | public class WindowsEolLinux { } 12 | -------------------------------------------------------------------------------- /qulice-checkstyle/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | # Set root logger level to DEBUG and its only appender to CONSOLE 5 | log4j.rootLogger=WARN, CONSOLE 6 | 7 | # "Console" is set to be a ConsoleAppender. 8 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 9 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 10 | log4j.appender.CONSOLE.layout.ConversionPattern = [%-5p] %c: %m\n 11 | 12 | # Application-specific logging 13 | log4j.logger.com.qulice.checkstyle=DEBUG 14 | -------------------------------------------------------------------------------- /qulice-maven-plugin/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2025 Yegor Bugayenko 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 1) Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 2) Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer in the documentation and/or other materials provided 12 | with the distribution. 3) Neither the name of the Qulice.com nor 13 | the names of its contributors may be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 19 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 | THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 28 | OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-newlines/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 5 | # SPDX-License-Identifier: MIT 6 | 7 | 8 | invoker.goals = clean verify 9 | invoker.buildResult = failure 10 | invoker.mavenOpts=-Dline.separator=\r\n 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-newlines/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | 9 | com.jcabi 10 | parent 11 | 0.54.1 12 | 13 | com.qulice.plugin 14 | checkstyle-newlines 15 | 1.0-SNAPSHOT 16 | jar 17 | checkstyle-newlines 18 | 19 | 3.0 20 | 21 | 22 | 23 | 24 | com.qulice 25 | qulice-maven-plugin 26 | @project.version@ 27 | 28 | file:${basedir}/LICENSE.txt 29 | 30 | 31 | 32 | 33 | check 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-newlines/src/main/java/com/qulice/plugin/violations/Violations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.plugin.violations; 6 | public class Violations { 7 | public void test() { 8 | System.setProperty("test", "test value"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-newlines/src/main/resources/tabs.txt: -------------------------------------------------------------------------------- 1 | This file contains a tab. 2 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-newlines/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert !log.text.contains('(NewlineAtEndOfFileCheck)') 9 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | invoker.buildResult = failure 6 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | 9 | com.jcabi 10 | parent 11 | 0.54.1 12 | 13 | com.qulice.plugin 14 | checkstyle-violations 15 | 1.0-SNAPSHOT 16 | jar 17 | checkstyle-violations 18 | 19 | 3.0 20 | 21 | 22 | 23 | 24 | com.qulice 25 | qulice-maven-plugin 26 | @project.version@ 27 | 28 | file:${basedir}/LICENSE.txt 29 | 30 | 31 | 32 | 33 | check 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/src/main/java/com/qulice/plugin/violations/Brackets.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.plugin.violations; 6 | 7 | import java.util.concurrent.atomic.AtomicInteger; 8 | 9 | /** 10 | * Validation of bracket structure check. 11 | */ 12 | public final class Brackets { 13 | 14 | /** 15 | * Simple method. 16 | */ 17 | public void wrongBrackets() { 18 | new Foo(null, new int[]{1}, 19 | null 20 | ); 21 | new Foo(new String(""), 22 | null, null 23 | ); 24 | this.call(null, 25 | null 26 | ); 27 | final AtomicInteger atom = new AtomicInteger( 28 | 1); 29 | } 30 | 31 | private void call(final String start, final String end) { 32 | // do nothing 33 | } 34 | 35 | /** 36 | * Check brackets structure. 37 | */ 38 | private final class Foo { 39 | 40 | /** 41 | * Constructor. 42 | * @param start First param. 43 | * @param list Second param. 44 | * @param rest Last param. 45 | */ 46 | public Foo(final String start, final int[] list, final String rest) { 47 | // ignore 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/src/main/java/com/qulice/plugin/violations/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.plugin.violations; 6 | 7 | /** 8 | * Validation of constants check. 9 | */ 10 | public final class Constants { 11 | 12 | private static final String ONCE = "test"; 13 | 14 | private static final String TWICE = "test"; 15 | 16 | public void print() { 17 | System.out.println(Constants.ONCE + Constants.TWICE); 18 | } 19 | 20 | public void anotherPrint() { 21 | System.out.println(Constants.TWICE); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/src/main/java/com/qulice/plugin/violations/Iface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.plugin.violations; 6 | 7 | final class Simple { 8 | private final String name = ""; 9 | private final int iaccount; 10 | public Simple() { 11 | this.iaccount = 1; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/src/main/java/com/qulice/plugin/violations/IndentationChecks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Test file. 3 | */ 4 | package com.qulice.plugin.violations; 5 | 6 | /** 7 | * Indentation checks. 8 | */ 9 | public final class IndentationChecks { 10 | 11 | /** 12 | * This should not produce any violations. 13 | */ 14 | public void triggersNoViolation() { 15 | new String() 16 | .substring( 17 | 0, 2 18 | ) 19 | .substring( 20 | 0, 1 21 | ); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/src/main/java/com/qulice/plugin/violations/NewLines.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | public final class NewLines { 6 | public void doNothing() { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/src/main/java/com/qulice/plugin/violations/SomeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.plugin.violations; 6 | 7 | public class SomeTest { 8 | 9 | public void testing() { 10 | System.out.println("I'm doing nothing"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/src/main/java/com/qulice/plugin/violations/Tabs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.plugin.violations; 6 | public class Tabs { 7 | public void test() { 8 | System.setProperty("test", "test value"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/src/main/java/com/qulice/plugin/violations/Violations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.plugin.violations; 6 | 7 | import java.util.ArrayList; 8 | 9 | public class Violations { 10 | public void test() { 11 | System.setProperty("test", "test value"); 12 | } 13 | 14 | /** 15 | * Test method. 16 | */ 17 | public final void foreach() { 18 | for (String txt : new String[] {"test"}) { 19 | System.out.println(txt); 20 | } 21 | } 22 | 23 | /** 24 | * Missing final in catch. 25 | */ 26 | public final void catchFinal() { 27 | try { 28 | Integer.parseInt("123"); 29 | } catch (NumberFormatException ex) { 30 | throw new IllegalStateException(ex); 31 | } 32 | } 33 | /** 34 | * ArrayList without initializer. 35 | */ 36 | public final void arrayLists() { 37 | System.out.println(new ArrayList()); 38 | System.out.println(new java.util.ArrayList()); 39 | System.out.println(new ArrayList(1)); 40 | System.out.println(new java.util.ArrayList(2)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/src/main/java/com/qulice/plugin/violations/Юникод.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.plugin.violations; 6 | 7 | /** 8 | * Validation of unicode characters in class name check. 9 | */ 10 | public final class Юникод { 11 | 12 | /** 13 | * Simple method with unicode name. 14 | */ 15 | public void метод() { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/src/main/resources/newlines.txt: -------------------------------------------------------------------------------- 1 | Wrong end of line here 2 | not here 3 | but here. 4 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/src/main/resources/tabs.txt: -------------------------------------------------------------------------------- 1 | This file contains a tab. 2 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/checkstyle-violations/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert log.text.findAll('.*Brackets.java.*BracketsStructureCheck').size() == 4 9 | assert log.text.contains('Tabs.java[8]: Line contains a tab character. (FileTabCharacterCheck)') 10 | assert log.text.findAll('Brackets.java.*(HeaderCheck)').empty 11 | //assert log.text.contains('Violations.java[6]: This method must be static, because it does not refer to "this"') 12 | assert log.text.contains('Brackets.java[28]: Closing bracket should be on a new line (BracketsStructureCheck)') 13 | assert log.text.contains('Violations.java[18]: Parameter txt should be final. (FinalParametersCheck)') 14 | assert log.text.contains('Violations.java[29]: Parameter ex should be final. (FinalParametersCheck)') 15 | assert log.text.contains('Violations.java[37]: ArrayList should be initialized with a size parameter') 16 | assert log.text.contains('Violations.java[38]: ArrayList should be initialized with a size parameter') 17 | assert !log.text.contains('Got an exception - java.lang.NullPointerException') 18 | assert log.text.findAll('SomeTest.java .+ (JavadocMethodCheck)').isEmpty() 19 | assert !log.text.contains('IndentationChecks.java[49]: method call rparen at indentation level 12') 20 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-not-matches-exclude/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | invoker.buildResult = failure 6 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-not-matches-exclude/src/main/java/com/qulice/entity/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | true 10 | 11 | 12 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-not-matches-exclude/src/main/java/com/qulice/entity/model/TestModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.entity.model; 6 | 7 | 8 | import javax.persistence.Entity; 9 | import javax.persistence.Table; 10 | 11 | @Entity 12 | @Table(name = "TEST_TABLE") 13 | public class TestModel { 14 | } 15 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-not-matches-exclude/src/main/java/com/qulice/entity/model/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Package docs. 8 | * @since 0.1 9 | */ 10 | package com.qulice.entity.model; 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-not-matches-exclude/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | def log = new File(basedir, 'build.log') 7 | assert !log.text.contains('Caused by: java.lang.NullPointerException') 8 | assert log.text.contains('Unused declared dependencies found') 9 | assert log.text.contains('1 dependency problem(s) found') 10 | assert log.text.contains('org.hibernate:hibernate-entitymanager:jar:5.0.7.Final:compile') 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-violations-exclude/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-violations-exclude/src/main/java/com/qulice/foo/Sample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.foo; 6 | 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import org.apache.commons.io.IOUtils; 10 | 11 | /** 12 | * Test class. 13 | * @since 1.0 14 | */ 15 | public final class Sample { 16 | 17 | /** 18 | * Test method. 19 | * @return Stream. 20 | * @checkstyle NonStaticMethod (2 lines) 21 | */ 22 | public InputStream test() throws IOException { 23 | return IOUtils.toInputStream("oops", "UTF-8"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-violations-exclude/src/main/java/com/qulice/foo/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Package docs. 8 | * @since 0.1 9 | */ 10 | package com.qulice.foo; 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-violations-exclude/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert log.text.contains('No dependency problems found') 9 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-violations/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | invoker.buildResult = failure 6 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-violations/src/main/java/com/qulice/foo/Sample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.foo; 6 | 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import org.apache.commons.io.IOUtils; 10 | 11 | /** 12 | * Test class. 13 | * @since 1.0 14 | */ 15 | public final class Sample { 16 | 17 | /** 18 | * Test method. 19 | * @return Stream. 20 | * @checkstyle NonStaticMethod (2 lines) 21 | */ 22 | public InputStream test() throws IOException { 23 | return IOUtils.toInputStream("oops", "UTF-8"); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-violations/src/main/java/com/qulice/foo/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Package docs. 8 | * @since 0.1 9 | */ 10 | package com.qulice.foo; 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/dependency-violations/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert log.text.contains('Unused declared dependencies found') 9 | assert log.text.contains('1 dependency problem(s) found') 10 | assert log.text.contains('commons-lang:commons-lang:jar:2.5:compile') 11 | assert !log.text.contains('commons-io:commons-io:jar:2.0.1:compile') 12 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/duplicate-finder-ignore-deps/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/duplicate-finder-ignore-deps/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert log.text.contains('BUILD SUCCESS') 9 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/duplicate-finder-violations/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | invoker.buildResult = failure 6 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/duplicate-finder-violations/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | 9 | com.jcabi 10 | parent 11 | 0.54.1 12 | 13 | com.qulice.plugin 14 | duplicate-finder-violations 15 | 1.0-SNAPSHOT 16 | jar 17 | duplicate-finder-violations 18 | 19 | 20 | 21 | com.qulice 22 | qulice-maven-plugin 23 | @project.version@ 24 | 25 | 26 | 27 | check 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.apache.xmlgraphics 37 | batik-ext 38 | 1.7 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/duplicate-finder-violations/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert log.text.contains('Found duplicate and different classes in ' + 9 | '[org.apache.xmlgraphics:batik-ext:1.7, xml-apis:xml-apis:1.4.01]') 10 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/hibernate-validator-check/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/hibernate-validator-check/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | 9 | com.jcabi 10 | parent 11 | 0.54.1 12 | 13 | com.qulice.plugin 14 | hibernate-validator-check 15 | 1.0-SNAPSHOT 16 | jar 17 | hibernate-validator-check 18 | 19 | 20 | 21 | com.qulice 22 | qulice-maven-plugin 23 | @project.version@ 24 | 25 | file:${basedir}/LICENSE.txt 26 | 27 | 28 | 29 | 30 | check 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/hibernate-validator-check/src/main/java/com/qulice/foo/Sample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.foo; 6 | 7 | /** 8 | * Test class. 9 | * @since 1.0 10 | */ 11 | public final class Sample { 12 | 13 | /** 14 | * Test method. 15 | * @return Stream. 16 | * @checkstyle NonStaticMethod (2 lines) 17 | */ 18 | public String test() { 19 | return "oops"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/hibernate-validator-check/src/main/java/com/qulice/foo/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Package docs. 8 | * @since 0.1 9 | */ 10 | package com.qulice.foo; 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/hibernate-validator-check/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert !log.text.contains('JSR-303 validator failed to initialize') 9 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/log-check/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/log-check/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | 9 | com.jcabi 10 | parent 11 | 0.54.1 12 | 13 | com.qulice.plugin 14 | log-check 15 | 1.0-SNAPSHOT 16 | jar 17 | log-check 18 | 19 | 20 | 21 | com.qulice 22 | qulice-maven-plugin 23 | @project.version@ 24 | 25 | file:${basedir}/LICENSE.txt 26 | 27 | 28 | 29 | 30 | check 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/log-check/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert log.text.contains('Checking compile classpath') 9 | assert log.text.contains('Qulice quality check completed') 10 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/multi-module/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/multi-module/mod-alpha/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | 9 | com.qulice.plugin 10 | mod 11 | 1.0-SNAPSHOT 12 | 13 | mod-alpha 14 | jar 15 | mod-alpha 16 | 17 | 18 | junit 19 | junit 20 | 4.13.2 21 | test 22 | 23 | 24 | org.hamcrest 25 | hamcrest-all 26 | 1.3 27 | test 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/multi-module/mod-alpha/src/main/java/com/qulice/plugin/alpha/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.plugin.alpha; 6 | 7 | /** 8 | * Sample class. 9 | * 10 | * @since 1.0 11 | */ 12 | @SuppressWarnings("PMD.ProhibitPublicStaticMethods") 13 | public final class Main { 14 | /** 15 | * Utility constructor. 16 | */ 17 | private Main() { 18 | // do nothing 19 | } 20 | 21 | /** 22 | * Calculate square of a number. 23 | * @param num The number 24 | * @return The square 25 | */ 26 | public static int square(final int num) { 27 | return num * num; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/multi-module/mod-alpha/src/main/java/com/qulice/plugin/alpha/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Package docs. 8 | * @since 0.1 9 | */ 10 | package com.qulice.plugin.alpha; 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/multi-module/mod-alpha/src/test/java/com/qulice/plugin/alpha/MainTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.plugin.alpha; 6 | 7 | import org.hamcrest.MatcherAssert; 8 | import org.hamcrest.Matchers; 9 | import org.junit.jupiter.api.Test; 10 | 11 | /** 12 | * Simple test of the Main class. 13 | * @since 1.0 14 | */ 15 | final class MainTest { 16 | 17 | /** 18 | * Simple testing. 19 | */ 20 | @Test 21 | void testSquare() { 22 | MatcherAssert.assertThat( 23 | "Square for 1 should be 1", 24 | 1, Matchers.is(Main.square(1)) 25 | ); 26 | MatcherAssert.assertThat( 27 | "Square for 2 should be 4", 28 | 4, Matchers.is(Main.square(2)) 29 | ); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/multi-module/mod-alpha/src/test/java/com/qulice/plugin/alpha/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Package docs. 8 | * @since 0.1 9 | */ 10 | package com.qulice.plugin.alpha; 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/multi-module/mod-tk/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | com.qulice.plugin 9 | mod-tk 10 | 1.0-SNAPSHOT 11 | jar 12 | mod-tk 13 | 14 | 15 | 16 | com.qulice 17 | maven-qulice-plugin 18 | 1.0-SNAPSHOT 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/multi-module/src/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory. Don't remove this file! 2 | # Without it Git don't see the folder 3 | * 4 | # Except this file 5 | !.gitignore 6 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/multi-module/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | // Let's validate that the build never touched Groovy files 8 | // see ticket #39 for explanation 9 | def log = new File(basedir, 'build.log') 10 | assert !log.text.contains('CodeNarc completed:') 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/pmd-violations/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | invoker.buildResult = failure 6 | #invoker.mavenOpts = -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 7 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/pmd-violations/src/main/java/com/qulice/foo/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Package docs. 8 | * @since 0.1 9 | */ 10 | package com.qulice.foo; 11 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/pmd-violations/src/main/util/some.tex: -------------------------------------------------------------------------------- 1 | % SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | % SPDX-License-Identifier: MIT 3 | 4 | \usepackage{setspace} 5 | \linespread{1.2} 6 | \usepackage{xcolor} 7 | \definecolor{zblue}{rgb}{0,0.5765,0.8196} 8 | \usepackage{hyperref} 9 | \hypersetup{colorlinks=true,urlcolor=zblue,pdfborder={0 0 0}} 10 | \usepackage{mathpazo} 11 | \usepackage{graphicx} 12 | \usepackage[absolute]{textpos} 13 | \TPGrid{16}{16} 14 | \usepackage[top=2\TPVertModule, bottom=4\TPVertModule, left=2\TPHorizModule, right=2\TPHorizModule]{geometry} 15 | \usepackage{tikz} 16 | \usepackage{fancyhdr} 17 | \pagestyle{fancy} 18 | \renewcommand{\headrulewidth}{0pt} 19 | \fancyhf{} 20 | \lfoot{ 21 | \begin{textblock}{14}[0,0](1,12){ 22 | \color{gray}\footnotesize\texttt{\pgp} 23 | }\end{textblock} 24 | } 25 | 26 | \begin{document} 27 | \setlength{\topskip}{0mm} 28 | \setlength{\parindent}{0pt} 29 | \setlength{\parskip}{6pt} 30 | \raggedright 31 | \large 32 | \interfootnotelinepenalty=10000 33 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/pmd-violations/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert log.text.contains("Avoid unused private fields such as 'var'") 9 | assert !log.text.contains('java.lang.Error: Invalid escape character') 10 | // @see https://github.com/tpc2/qulice/issues/146 11 | //assert log.text.contains("Avoid creating unnecessary local variables like 'name'") 12 | //assert log.text.contains("Avoid creating unnecessary local variables like 'message'") 13 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/pom-xpath-validator-violations/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | invoker.buildResult = failure 6 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/pom-xpath-validator-violations/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert !log.text.contains('pom.xml don\'t match the xpath query [/pom:project/pom:build/pom:plugins/' + 9 | 'pom:plugin[pom:artifactId=\'qulice-maven-plugin\']/pom:artifactId/text()]') 10 | assert log.text.contains('pom.xml don\'t match the xpath query [/pom:project/pom:dependencies/' + 11 | 'pom:dependency[pom:artifactId=\'commons-io\']/pom:version[.=\'1.2.5\']/text()]') 12 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/relocation/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/relocation/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert log.text.contains('BUILD SUCCESS') 9 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | it-repo 10 | 11 | true 12 | 13 | 14 | 15 | local.central 16 | @localRepositoryUrl@ 17 | 18 | true 19 | 20 | 21 | true 22 | 23 | 24 | 25 | 26 | 27 | local.central 28 | @localRepositoryUrl@ 29 | 30 | true 31 | 32 | 33 | true 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/snapshots/invoker.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | invoker.goals = clean verify 5 | #invoker.buildResult = failure 6 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/snapshots/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | 9 | com.jcabi 10 | parent 11 | 0.54.1 12 | 13 | com.qulice.plugin 14 | snapshots 15 | 1.0 16 | jar 17 | snapshots 18 | 19 | 20 | 21 | com.qulice 22 | qulice-maven-plugin 23 | @project.version@ 24 | 25 | 26 | 27 | check 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/it/snapshots/verify.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 4 | * SPDX-License-Identifier: MIT 5 | */ 6 | 7 | def log = new File(basedir, 'build.log') 8 | assert log.text.contains('dependencies are in SNAPSHOT state') 9 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/main/java/com/qulice/maven/EnforcerValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.maven; 6 | 7 | import com.qulice.spi.ValidationException; 8 | import java.util.Properties; 9 | 10 | /** 11 | * Validate with maven-enforcer-plugin. 12 | * 13 | * @since 0.3 14 | */ 15 | public final class EnforcerValidator implements MavenValidator { 16 | 17 | @Override 18 | @SuppressWarnings("PMD.AvoidDuplicateLiterals") 19 | public void validate(final MavenEnvironment env) 20 | throws ValidationException { 21 | if (!env.exclude("enforcer", "")) { 22 | final Properties props = new Properties(); 23 | final Properties rules = new Properties(); 24 | props.put("rules", rules); 25 | final Properties maven = new Properties(); 26 | rules.put("requireMavenVersion", maven); 27 | maven.put("version", "3.0"); 28 | final Properties java = new Properties(); 29 | rules.put("requireJavaVersion", java); 30 | java.put("version", "1.7"); 31 | env.executor().execute( 32 | "org.apache.maven.plugins:maven-enforcer-plugin:3.1.0", 33 | "enforce", 34 | props 35 | ); 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/main/java/com/qulice/maven/MavenValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.maven; 6 | 7 | import com.qulice.spi.ValidationException; 8 | 9 | /** 10 | * Validator inside Maven. 11 | * 12 | * @since 0.3 13 | */ 14 | interface MavenValidator { 15 | 16 | /** 17 | * Validate this environment. 18 | * @param env The environment 19 | * @throws ValidationException In case of violations 20 | */ 21 | void validate(MavenEnvironment env) throws ValidationException; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/main/java/com/qulice/maven/ValidatorsProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.maven; 6 | 7 | import com.qulice.spi.ResourceValidator; 8 | import com.qulice.spi.Validator; 9 | import java.util.Collection; 10 | import java.util.Set; 11 | 12 | /** 13 | * Provider of validators. 14 | * 15 | * @since 0.3 16 | */ 17 | interface ValidatorsProvider { 18 | 19 | /** 20 | * Get a collection of internal validators. 21 | * @return List of them 22 | * @see CheckMojo#execute() 23 | */ 24 | Set internal(); 25 | 26 | /** 27 | * Get a collection of external validators. 28 | * @return List of them 29 | * @see CheckMojo#execute() 30 | */ 31 | Set external(); 32 | 33 | /** 34 | * Get a collection of external validators. 35 | * @return List of them 36 | * @see CheckMojo#execute() 37 | */ 38 | Collection externalResource(); 39 | } 40 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/main/java/com/qulice/maven/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Maven plugin. 8 | * 9 | * @since 0.3 10 | */ 11 | package com.qulice.maven; 12 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/test/java/com/qulice/maven/DefaultValidatorsProviderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.maven; 6 | 7 | import com.qulice.spi.Environment; 8 | import org.hamcrest.MatcherAssert; 9 | import org.hamcrest.Matchers; 10 | import org.junit.jupiter.api.Disabled; 11 | import org.junit.jupiter.api.Test; 12 | 13 | /** 14 | * Test case for {@link ValidatorsProvider} class. 15 | * @since 0.3 16 | */ 17 | final class DefaultValidatorsProviderTest { 18 | 19 | @Test 20 | void producesCollectionOfValidators() throws Exception { 21 | MatcherAssert.assertThat( 22 | "internal validators should be returned", 23 | new DefaultValidatorsProvider(new Environment.Mock()) 24 | .internal().size(), 25 | Matchers.greaterThan(0) 26 | ); 27 | } 28 | 29 | @Test 30 | @Disabled 31 | void producesCollectionOfExtValidators() throws Exception { 32 | MatcherAssert.assertThat( 33 | "external validators should be returned", 34 | new DefaultValidatorsProvider(new Environment.Mock()) 35 | .external().size(), 36 | Matchers.greaterThan(0) 37 | ); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/test/java/com/qulice/maven/SvnPropertiesValidatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.maven; 6 | 7 | import org.junit.jupiter.api.Test; 8 | 9 | /** 10 | * Test case for {@link SvnPropertiesValidator}. 11 | * @since 0.3 12 | */ 13 | final class SvnPropertiesValidatorTest { 14 | 15 | /** 16 | * Let's simulate the property reading request. 17 | * @throws Exception If something goes wrong 18 | */ 19 | @Test 20 | void testSimulatesSvnPropgetRequest() throws Exception { 21 | final MavenValidator validator = new SvnPropertiesValidator(); 22 | final MavenEnvironment env = new MavenEnvironmentMocker().mock(); 23 | validator.validate(env); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/test/java/com/qulice/maven/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Tests of maven plugin. 8 | * 9 | * @since 0.3 10 | */ 11 | package com.qulice.maven; 12 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/test/resources/com/qulice/maven/PomXpathValidator/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 4.0.0 8 | 9 | com.qulice 10 | qulice 11 | 1.0-SNAPSHOT 12 | 13 | qulice-spi 14 | jar 15 | qulice-spi 16 | 17 | 18 | commons-io 19 | commons-io 20 | 1.2.5 21 | 22 | 23 | commons-collections 24 | commons-collections 25 | 3.2.2 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/test/resources/com/qulice/maven/ValidationExclusion/CheckstyleExample.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Hello. 3 | */ 4 | package foo; 5 | 6 | /** 7 | * Simple. 8 | * @since 1.0 9 | */ 10 | public class MissingJavadoc { 11 | public String testSomething() { 12 | return "something"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /qulice-maven-plugin/src/test/resources/com/qulice/maven/ValidationExclusion/PmdExample.txt: -------------------------------------------------------------------------------- 1 | package foo; 2 | 3 | public final class LocalVariableCouldBeFinal { 4 | 5 | public int method() { 6 | int nonfinal = 0; 7 | return nonfinal; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /qulice-pmd/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2025 Yegor Bugayenko 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 1) Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 2) Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer in the documentation and/or other materials provided 12 | with the distribution. 3) Neither the name of the Qulice.com nor 13 | the names of its contributors may be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 19 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 | THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 28 | OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /qulice-pmd/src/main/java/com/qulice/pmd/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * PMD validator. 8 | * 9 | * @since 0.3 10 | */ 11 | package com.qulice.pmd; 12 | -------------------------------------------------------------------------------- /qulice-pmd/src/main/java/com/qulice/pmd/rules/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * PMD custom rules. 8 | * 9 | * @since 0.4 10 | */ 11 | package com.qulice.pmd.rules; 12 | -------------------------------------------------------------------------------- /qulice-pmd/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/java/com/qulice/pmd/EmptyCollectionRuleTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | import org.hamcrest.Matchers; 8 | import org.junit.jupiter.api.Test; 9 | 10 | /** 11 | * Test case for ReturnEmptyCollectionRatherThanNull. 12 | * 13 | * @since 0.19 14 | */ 15 | final class EmptyCollectionRuleTest { 16 | /** 17 | * Makes sure that empty collections not returned as null. 18 | * @throws Exception when something goes wrong 19 | */ 20 | @Test 21 | void failsForNullCollection() throws Exception { 22 | new PmdAssert( 23 | "NullCollection.java", 24 | Matchers.is(false), 25 | Matchers.containsString( 26 | "Return an empty collection rather than null. (ReturnEmptyCollectionRatherThanNull)" 27 | ) 28 | ).validate(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/java/com/qulice/pmd/LocalVariableCouldBeFinalRuleTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | import org.hamcrest.core.IsEqual; 8 | import org.hamcrest.core.StringStartsWith; 9 | import org.junit.jupiter.api.Test; 10 | 11 | /** 12 | * Test case for LocalVariableCouldBeFinal. 13 | * 14 | * @since 0.18 15 | */ 16 | final class LocalVariableCouldBeFinalRuleTest { 17 | 18 | /** 19 | * LocalVariableCouldBeFinal can detect when variable is not 20 | * final and shows correct message. 21 | * 22 | * @throws Exception If something goes wrong 23 | */ 24 | @Test 25 | void detectLocalVariableCouldBeFinal() throws Exception { 26 | new PmdAssert( 27 | "LocalVariableCouldBeFinal.java", 28 | new IsEqual<>(false), 29 | new StringStartsWith( 30 | String.join( 31 | " ", 32 | "PMD: LocalVariableCouldBeFinal.java[10-10]:", 33 | "Local variable 'nonfinal' could be declared final", 34 | "(LocalVariableCouldBeFinal)" 35 | ) 36 | ) 37 | ).validate(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/java/com/qulice/pmd/UnusedImportsRuleTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | import org.hamcrest.core.IsEqual; 8 | import org.hamcrest.core.StringStartsWith; 9 | import org.junit.jupiter.api.Test; 10 | 11 | /** 12 | * Test case for LocalVariableCouldBeFinal. 13 | * 14 | * @since 0.18 15 | */ 16 | final class UnusedImportsRuleTest { 17 | 18 | /** 19 | * UnusedImport can detect when the class has an unused import line and 20 | * show error message correctly. 21 | * 22 | * @throws Exception If something goes wrong 23 | */ 24 | @Test 25 | void detectUnusedImportLine() throws Exception { 26 | new PmdAssert( 27 | "UnusedImports.java", 28 | new IsEqual<>(false), 29 | new StringStartsWith( 30 | String.join( 31 | " ", 32 | "PMD: UnusedImports.java[7-7]: Unused import", 33 | "'unused.bar.foo.UnusedImport'", 34 | "(UnnecessaryImport)" 35 | ).trim() 36 | ) 37 | ).validate(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/java/com/qulice/pmd/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Tests of PMD validator. 8 | * 9 | * @since 0.3 10 | */ 11 | package com.qulice.pmd; 12 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/AccessToStaticFieldsViaThis.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class AccessToStaticFieldsViaThis { 8 | private static final int num = 1; 9 | 10 | public int number() { 11 | return this.num; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/AccessToStaticMethodsViaThis.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class AccessToStaticMethodsViaThis { 8 | private static int number() { 9 | return 1; 10 | } 11 | 12 | public int another() { 13 | return 1 + this.number(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/AllowAssertFail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | import org.hamcrest.Matchers; 8 | import org.junit.jupiter.api.Assertions; 9 | import org.junit.jupiter.api.Test; 10 | 11 | final class AllowAssertFail { 12 | 13 | @Test 14 | void prohibitPlainJunitAssertionsInTests() throws Exception { 15 | Matchers.assertThat("errorMessage", "expected", Matchers.is("actual")); 16 | Assertions.fail("fail test"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/AllowNonTransientFields.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class AllowNonTransientFields { 8 | 9 | private final int nontransient; 10 | 11 | public AllowNonTransientFields(final int a) { 12 | this.nontransient = a; 13 | } 14 | 15 | public int field() { 16 | return nontransient; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/AllowsDuplicateLiteralsInAnnotations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | @SuppressWarnings("unchecked") 8 | public final class AllowsDuplicateLiteralsInAnnotations { 9 | 10 | @SuppressWarnings("unchecked") 11 | public void methodOne() { 12 | // empty body 13 | } 14 | 15 | @SuppressWarnings("unchecked") 16 | public void methodTwo() { 17 | // empty body 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/ArrayOfStringsLengthGreaterThanZero.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class ArrayOfStringsLengthGreaterThanZero { 8 | 9 | private final String[] strings; 10 | 11 | public ArrayOfStringsLengthGreaterThanZero(final String... args) { 12 | this.strings = args.clone(); 13 | } 14 | 15 | public String[] args() { 16 | return this.strings.clone(); 17 | } 18 | 19 | public boolean arrayFromArgs(final String... args) { 20 | return args.length > 0; 21 | } 22 | 23 | public boolean arrayFromField() { 24 | return this.strings.length > 0; 25 | } 26 | 27 | public boolean arrayFromMethod() { 28 | return this.args().length > 0; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/AvoidUsingVolatile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class AvoidUsingVolatile { 8 | private volatile int num = 0; 9 | } 10 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/CallSuperInConstructor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class CallSuperInConstructor { 8 | 9 | private final int number; 10 | private final int other; 11 | 12 | public CallSuperInConstructor(final int parameter) { 13 | this(parameter, parameter * 2); 14 | } 15 | 16 | public CallSuperInConstructor(final int parameter, final int other) { 17 | this.number = parameter; 18 | this.another = other; 19 | } 20 | 21 | public int num() { 22 | return number + another; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/CallToConstructorInConstructor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class CallToConstructorInConstructor extends Super { 8 | private final transient int number; 9 | private final transient int another; 10 | 11 | public CallToConstructorInConstructor() { 12 | this(2); 13 | } 14 | 15 | public CallToConstructorInConstructor(final int a) { 16 | super(a); 17 | this.number = 2; 18 | this.another = a; 19 | } 20 | 21 | public int num() { 22 | return number; 23 | } 24 | 25 | public int getAnother() { 26 | return another; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/CloneMethodMustBePublic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public class CloneMethodMustBePublic implements Cloneable { 8 | @Override 9 | protected CloneMethodMustBePublic clone() throws CloneNotSupportedException { 10 | return ((CloneMethodMustBePublic) super.clone()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/CloneMethodReturnTypeMustMatchClassName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public class CloneMethodReturnTypeMustMatchClassName implements Cloneable { 8 | @Override 9 | public Object clone() throws CloneNotSupportedException { 10 | return super.clone(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/CodeInConstructor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class CodeInConstructor { 8 | private final transient int number; 9 | private final transient int another; 10 | 11 | public CodeInConstructor() { 12 | this.number = 2; 13 | int a = number + 3; 14 | this.another = a; 15 | } 16 | 17 | public int num() { 18 | return number + another; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/DefaultPackage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class DefaultPackage { 8 | 9 | int method() { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/DirectAccessToStaticFields.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class DirectAccessToStaticFields { 8 | private static int num = 1; 9 | 10 | public static int number() { 11 | return num; 12 | } 13 | 14 | public int another() { 15 | return 0; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/DoNotUseThreads.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class DoNotUseThreads implements Runnable { 8 | @Override 9 | public void run() { 10 | // do nothing 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/EmptyCatchBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package emp; 6 | 7 | class EmptyCatchBlock { 8 | public void bar() { 9 | try { 10 | final int x = 1; 11 | } catch (Exception ioe) { 12 | // not good 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/EmptyFinallyBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package emp; 6 | 7 | class EmptyFinallyBlock { 8 | public void bar() { 9 | try { 10 | final int x = 1; 11 | x += 5; 12 | x++; 13 | } finally { 14 | // not good 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/EmptyIfStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package emp; 6 | 7 | class EmptyIf { 8 | public void bar() { 9 | if (1 == 2) { 10 | //empty 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/EmptyInitializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package emp; 6 | 7 | class EmptyInitializer { 8 | static {} // Why ? 9 | 10 | {} // Again, why ? 11 | } 12 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/EmptyStatementBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package emp; 6 | 7 | class EmptyStatementBlock { 8 | private int baz; 9 | 10 | public void setBar(int bar) { 11 | { baz = bar; } // Why not? 12 | {} // But remove this. 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/EmptyStatementNotInLoop.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package emp; 6 | 7 | class EmptyStatementNotInLoop { 8 | public void bar() { 9 | // this is probably not what you meant to do 10 | ; 11 | // the extra semicolon here this is not necessary 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/EmptyStaticInitializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package emp; 6 | 7 | public class EmptyStaticInitializer { 8 | static { 9 | // empty 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/EmptySwitchStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package emp; 6 | 7 | class EmptySwitchStmt { 8 | public void bar() { 9 | final int x = 2; 10 | switch (x) { 11 | // empty! 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/EmptySynchronizedBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package emp; 6 | 7 | class EmptySynchronizedBlock { 8 | public void bar() { 9 | synchronized (this) { 10 | // empty! 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/EmptyWhileStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package emp; 6 | 7 | class EmptyWhileStmt { 8 | public void bar() { 9 | while (1 == 2) { 10 | // empty! 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/ExcessiveImports.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | import com.jcabi.http.request.JdkRequest; 8 | import com.jcabi.http.response.RestResponse; 9 | import java.io.ByteArrayInputStream; 10 | import java.io.IOException; 11 | import java.net.HttpURLConnection; 12 | import java.net.ServerSocket; 13 | import java.net.Socket; 14 | import java.net.SocketException; 15 | import java.net.URI; 16 | import java.nio.charset.StandardCharsets; 17 | import org.apache.commons.io.IOUtils; 18 | import org.hamcrest.MatcherAssert; 19 | import org.hamcrest.Matchers; 20 | import org.mockito.Mockito; 21 | import org.mockito.invocation.InvocationOnMock; 22 | import org.mockito.stubbing.Answer; 23 | import org.takes.Request; 24 | import org.takes.Response; 25 | import org.takes.Take; 26 | import org.takes.facets.fork.FkRegex; 27 | import org.takes.facets.fork.TkFork; 28 | import org.takes.misc.Utf8String; 29 | import org.takes.rq.RqGreedy; 30 | import org.takes.rq.RqLengthAware; 31 | import org.takes.rq.RqMethod; 32 | import org.takes.rq.RqPrint; 33 | import org.takes.rs.RsHtml; 34 | import org.takes.rs.RsText; 35 | import org.takes.tk.TkFailure; 36 | import org.takes.tk.TkText; 37 | 38 | public final class ExcessiveImports { 39 | 40 | public int method() { 41 | return null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/FieldInitConstructor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class FieldInitConstructor { 8 | private final transient int number; 9 | private final transient String text = ""; 10 | 11 | public FieldInitConstructor() { 12 | this.number = 2; 13 | } 14 | 15 | public int num() { 16 | return number; 17 | } 18 | 19 | public String tex() { 20 | return text; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/FieldInitNoConstructor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class FieldInitNoConstructor { 8 | private final transient int number = 1; 9 | 10 | public int num() { 11 | return number; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/FieldInitOneConstructor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | public class FieldInitOneConstructor { 8 | private final transient Engine engine; 9 | private final transient Steering steering; 10 | 11 | public FieldInitOneConstructor(final Engine eng, final Steering steer) { 12 | this.engine = eng; 13 | this.steering = steer; 14 | } 15 | 16 | public FieldInitOneConstructor(final Engine eng) { 17 | this(eng, new DefaultSteering()); 18 | } 19 | 20 | public FieldInitOneConstructor() { 21 | this(new DefaultEngine(), new DefaultSteering()); 22 | } 23 | 24 | public Engine getEngine() { 25 | return this.engine; 26 | } 27 | 28 | public Steering getSteering() { 29 | return steering; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/FieldInitSeveralConstructors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public class FieldInitSeveralConstructors { 8 | private final transient Engine engine; 9 | private final transient Steering steering; 10 | 11 | public FieldInitSeveralConstructors(final Engine eng, final Steering steer) { 12 | this.engine = eng; 13 | this.steering = steer; 14 | } 15 | 16 | public FieldInitSeveralConstructors(final Engine eng) { 17 | this.engine = eng; 18 | this.steering = new DefaultSteering(); 19 | } 20 | 21 | public FieldInitSeveralConstructors() { 22 | this(new DefaultEngine(), new DefaultSteering()); 23 | } 24 | 25 | public Engine getEngine() { 26 | return this.engine; 27 | } 28 | 29 | public Steering getSteering() { 30 | return steering; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/FilesCreateFileOther.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | import java.nio.file.Files; 8 | import java.nio.file.Paths; 9 | 10 | public final class FilesCreateFileOther { 11 | public void other() { 12 | Files.createFile(Paths.get("test")); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/FilesCreateFileTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | import java.nio.file.Files; 8 | import java.nio.file.Paths; 9 | 10 | public final class FilesCreateFileTest { 11 | @Test 12 | public void test() { 13 | Files.createFile(Paths.get("test")); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/Junit3TestClassShouldBeFinal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | import junit.framework.TestCase; 8 | 9 | class SomeTest { 10 | 11 | @TestCase 12 | void testOne() { 13 | // empty body 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/Junit4TestClassShouldBeFinal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | import org.junit.Test; 8 | 9 | class SomeTest { 10 | 11 | @Test 12 | void testOne() { 13 | // empty body 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/Junit5TestClassShouldBeFinal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | import org.junit.jupiter.api.Test; 8 | 9 | class SomeTest { 10 | 11 | @Test 12 | void testOne() { 13 | // empty body 14 | } 15 | 16 | @Test 17 | void testTwo() { 18 | // empty body 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/JunitStaticPublicMethods.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo.test; 6 | 7 | import org.junit.AfterClass; 8 | import org.junit.BeforeClass; 9 | import org.junit.jupiter.api.Test; 10 | 11 | import java.util.Collection; 12 | import java.util.Collections; 13 | 14 | final class SomeTest { 15 | 16 | @BeforeClass 17 | public static void beforeClass(){ 18 | // setup before class 19 | } 20 | 21 | @Test 22 | void emptyTest(){ 23 | //test something 24 | } 25 | 26 | @AfterClass 27 | public static void afterClass() throws Exception { 28 | //tear down after class 29 | } 30 | 31 | @Parameterized.Parameters 32 | public static Collection parameters() { 33 | return Collections.EMPTY_LIST; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/JunitTestClassIsFinal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | import org.junit.jupiter.api.Test; 8 | 9 | final class SomeTest { 10 | 11 | @Test 12 | void testOne() { 13 | // empty body 14 | } 15 | 16 | @Test 17 | void testTwo() { 18 | // empty body 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/LambdaInConstructor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class LambdaInConstructor { 8 | private final transient int number; 9 | private final transient int another; 10 | 11 | public LambdaInConstructor(final int parameter) { 12 | this( 13 | parameter, 14 | () -> { 15 | final int ret; 16 | if (parameter % 2 == 0){ 17 | ret = 10; 18 | } else { 19 | ret = 20; 20 | } 21 | return ret; 22 | } 23 | ); 24 | } 25 | 26 | public LambdaInConstructor(final int parameter, final int other) { 27 | this.number = parameter; 28 | this.another = other; 29 | } 30 | 31 | public int num() { 32 | return number + another; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/LocalVariableCouldBeFinal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class LocalVariableCouldBeFinal { 8 | 9 | public int method() { 10 | int nonfinal = 0; 11 | return nonfinal; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/MissingSerialVersionUID.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class MissingSerialVersionUID extends Exception { 8 | 9 | public boolean method(String other) { 10 | return other.equals("True"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/NullCollection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package emp; 6 | 7 | import java.util.List; 8 | 9 | class NullCollection { 10 | 11 | public final List method() { 12 | return null; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/PlainJUnitAssertionStaticImportBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | import org.junit.jupiter.api.Test; 8 | 9 | import static org.junit.Assert.assertEquals; 10 | 11 | 12 | public class PlainJUnitAssertionStaticImportBlock { 13 | 14 | @Test 15 | public void prohibitPlainJunitAssertionsInTests() throws Exception { 16 | assertEquals("errorMessage", "expected", "actual"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/PlainJUnitAssertionTestMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | import org.junit.Assert; 8 | import org.junit.jupiter.api.Test; 9 | 10 | public class PlainJUnitAssertionTestMethod { 11 | 12 | @Test 13 | public void prohibitPlainJunitAssertionsInTests() throws Exception { 14 | Assert.assertEquals("errorMessage", "expected", "actual"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/PositionLiteralsFirstInComparisons.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | 8 | public final class PositionLiteralsFirstInComparisons { 9 | 10 | public boolean method(String other) { 11 | return other.equals("True"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/RecordParsed.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public record RecordParsed( 8 | Object symbol, 9 | int line, 10 | String msg 11 | ) { 12 | } 13 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/SimplifiedTernary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public class SimplifiedTernary { 8 | public boolean test() { 9 | return condition ? true : something(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/StaticAccessToStaticFields.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class StaticAccessToStaticFields { 8 | private static int num = 1; 9 | 10 | private static int number() { 11 | return StaticAccessToStaticFields.num; 12 | } 13 | 14 | public int another() { 15 | return 0; 16 | } 17 | 18 | public int addToNum(final int another) { 19 | return another + StaticAccessToStaticFields.number() + this.another(); 20 | } 21 | 22 | class InternalClass { 23 | final int num; 24 | 25 | InternalClass(final int par) { 26 | this.num = par; 27 | } 28 | static int another() { 29 | return 1; 30 | } 31 | 32 | public int add(final int a) { 33 | return a + this.num; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/StaticFieldInitConstructor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class StaticFieldInitConstructor { 8 | private static final String TEXT = "text"; 9 | private final transient int number; 10 | 11 | public FieldInitConstructor() { 12 | this.number = 2; 13 | } 14 | 15 | public int num() { 16 | return number; 17 | } 18 | 19 | public String tex() { 20 | return StaticFieldInitConstructor.TEXT; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/StaticPublicMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class StaticPublicMethod { 8 | 9 | private FieldInitConstructor() { 10 | super(); 11 | } 12 | 13 | public static StaticPublicMethod create() { 14 | return new StaticPublicMethod(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/StaticPublicVoidMainMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public class StaticPublicVoidMainMethod { 8 | 9 | public static final InnerClass INNER = new InnerClass(10); 10 | 11 | public static void main(final String... args) { 12 | // allow main method 13 | } 14 | 15 | public void doNothing() { 16 | //do nothing here 17 | } 18 | 19 | public static class InnerClass { 20 | private final int number; 21 | 22 | public InnerClass(final int num) { 23 | this.number = num; 24 | } 25 | 26 | public int calculate() { 27 | return number; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/StringLengthEqualsZero.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class StringLengthEqualsZero { 8 | 9 | private final String somestring; 10 | 11 | public StringLengthEqualsZero(final String str) { 12 | this.somestring = str; 13 | } 14 | 15 | public String someMethod() { 16 | return this.somestring; 17 | } 18 | 19 | public boolean lengthOnMethodWithThis() { 20 | return this.someMethod().length() == 0; 21 | } 22 | 23 | public boolean lengthOnMethodWithThisInversed() { 24 | return 0 == this.someMethod().length(); 25 | } 26 | 27 | public boolean lengthOnFieldWithThis() { 28 | return this.somestring.length() == 0; 29 | } 30 | 31 | public boolean lengthOnFieldWithThisInversed() { 32 | return 0 == this.somestring.length(); 33 | } 34 | 35 | public boolean lengthOnVariable(final String somestring) { 36 | return somestring.length() == 0; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/StringLengthGreaterOrEqualOne.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class StringLengthGreaterOrEqualOne { 8 | 9 | private final String somestring; 10 | 11 | public StringLengthGreaterOrEqualOne(final String str) { 12 | this.somestring = str; 13 | } 14 | 15 | public String someMethod() { 16 | return this.somestring; 17 | } 18 | 19 | public boolean lengthOnMethodWithThis() { 20 | return this.someMethod().length() >= 1; 21 | } 22 | 23 | public boolean lengthOnMethodWithThisInversed() { 24 | return 1 <= this.someMethod().length(); 25 | } 26 | 27 | public boolean lengthOnFieldWithThis() { 28 | return this.somestring.length() >= 1; 29 | } 30 | 31 | public boolean lengthOnFieldWithThisInversed() { 32 | return 1 <= this.somestring.length(); 33 | } 34 | 35 | public boolean lengthOnVariable(final String somestring) { 36 | return somestring.length() >= 1; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/StringLengthGreaterOrEqualZero.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class StringLengthGreaterOrEqualZero { 8 | 9 | private final String somestring; 10 | 11 | public StringLengthGreaterOrEqualZero(final String str) { 12 | this.somestring = str; 13 | } 14 | 15 | public String someMethod() { 16 | return this.somestring; 17 | } 18 | 19 | public boolean lengthOnMethodWithThis() { 20 | return this.someMethod().length() >= 0; 21 | } 22 | 23 | public boolean lengthOnMethodWithThisInversed() { 24 | return 0 <= this.someMethod().length(); 25 | } 26 | 27 | public boolean lengthOnFieldWithThis() { 28 | return this.somestring.length() >= 0; 29 | } 30 | 31 | public boolean lengthOnFieldWithThisInversed() { 32 | return 0 <= this.somestring.length(); 33 | } 34 | 35 | public boolean lengthOnVariable(final String somestring) { 36 | return somestring.length() >= 0; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/StringLengthGreaterThanZero.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class StringLengthGreaterThanZero { 8 | 9 | private final String somestring; 10 | 11 | public StringLengthGreaterThanZero(final String str) { 12 | this.somestring = str; 13 | } 14 | 15 | public String someMethod() { 16 | return this.somestring; 17 | } 18 | 19 | public boolean lengthOnMethodWithThis() { 20 | return this.someMethod().length() > 0; 21 | } 22 | 23 | public boolean lengthOnMethodWithThisInversed() { 24 | return 0 < this.someMethod().length(); 25 | } 26 | 27 | public boolean lengthOnFieldWithThis() { 28 | return this.somestring.length() > 0; 29 | } 30 | 31 | public boolean lengthOnFieldWithThisInversed() { 32 | return 0 < this.somestring.length(); 33 | } 34 | 35 | public boolean lengthOnVariable(final String somestring) { 36 | return somestring.length() > 0; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/StringLengthLessOrEqualZero.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class StringLengthMinorOrEqualsThanZero { 8 | 9 | private final String somestring; 10 | 11 | public StringLengthMinorOrEqualsThanZero(final String str) { 12 | this.somestring = str; 13 | } 14 | 15 | public String someMethod() { 16 | return this.somestring; 17 | } 18 | 19 | public boolean lengthOnMethodWithThis() { 20 | return this.someMethod().length() <= 0; 21 | } 22 | 23 | public boolean lengthOnMethodWithThisInversed() { 24 | return 0 >= this.someMethod().length(); 25 | } 26 | 27 | public boolean lengthOnFieldWithThis() { 28 | return this.somestring.length() <= 0; 29 | } 30 | 31 | public boolean lengthOnFieldWithThisInversed() { 32 | return 0 >= this.somestring.length(); 33 | } 34 | 35 | public boolean lengthOnVariable(final String somestring) { 36 | return somestring.length() <= 0; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/StringLengthLessThanOne.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class StringLengthLessThanOne { 8 | 9 | private final String somestring; 10 | 11 | public StringLengthLessThanOne(final String str) { 12 | this.somestring = str; 13 | } 14 | 15 | public String someMethod() { 16 | return this.somestring; 17 | } 18 | 19 | public boolean lengthOnMethodWithThis() { 20 | return this.someMethod().length() < 1; 21 | } 22 | 23 | public boolean lengthOnMethodWithThisInversed() { 24 | return 1 > this.someMethod().length(); 25 | } 26 | 27 | public boolean lengthOnFieldWithThis() { 28 | return this.somestring.length() < 1; 29 | } 30 | 31 | public boolean lengthOnFieldWithThisInversed() { 32 | return 1 > this.somestring.length(); 33 | } 34 | 35 | public boolean lengthOnVariable(final String somestring) { 36 | return somestring.length() < 1; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/StringLengthNotEqualsZero.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class StringLengthNotEqualsZero { 8 | 9 | private final String somestring; 10 | 11 | public StringLengthNotEqualsZero(final String str) { 12 | this.somestring = str; 13 | } 14 | 15 | public String someMethod() { 16 | return this.somestring; 17 | } 18 | 19 | public boolean lengthOnMethodWithThis() { 20 | return this.someMethod().length() != 0; 21 | } 22 | 23 | public boolean lengthOnMethodWithThisInversed() { 24 | return 0 != this.someMethod().length(); 25 | } 26 | 27 | public boolean lengthOnFieldWithThis() { 28 | return this.somestring.length() != 0; 29 | } 30 | 31 | public boolean lengthOnFieldWithThisInversed() { 32 | return 0 != this.somestring.length(); 33 | } 34 | 35 | public boolean lengthOnVariable(final String somestring) { 36 | return somestring.length() != 0; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/SwaggerApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | /** 8 | * Test class for swagger annotation. 9 | */ 10 | class SwaggerApi { 11 | /** 12 | * Get settings by name. 13 | * @param name Name. 14 | * @return Setting value. 15 | */ 16 | @Operation( 17 | summary = "Get repository settings by name", 18 | description = """ 19 | java 20 | multiline 21 | text 22 | block 23 | """, 24 | responses = { 25 | @ApiResponse( 26 | description = "Returns repository setting json", 27 | responseCode = "200", 28 | content = @Content(mediaType = "application/json") 29 | ), 30 | @ApiResponse(responseCode = "404", description = "Repository not found") 31 | } 32 | ) 33 | public final String setting(final String name) { 34 | throw RuntimeException("Not implemented"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/TestShouldBePackagePrivate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.pmd; 6 | 7 | import org.junit.jupiter.api.Test; 8 | 9 | public class SomeTest { 10 | 11 | @Test 12 | public void testOne() { 13 | // empty body 14 | } 15 | 16 | @Test 17 | public void testTwo() { 18 | // empty body 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/UnderstandsMethodReferences.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | import java.util.ArrayList; 8 | 9 | public final class UnderstandsMethodReferences { 10 | public void test() { 11 | new ArrayList().forEach( 12 | UnderstandsMethodReferences::other 13 | ); 14 | } 15 | private static void other() { 16 | // body 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/UnicodeCharactersInMethodNames.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class UnderstandsMethodReferences { 8 | private static final String SOME_STRING = "φ"; 9 | 10 | public String φTestMethod() { 11 | return UnderstandsMethodReferences.SOME_STRING; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/UnnecessaryFinalModifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public final class UnnecessaryFinalModifier { 8 | 9 | public final int foo() { 10 | return 1; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/UnusedImports.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | import unused.bar.foo.UnusedImport; 8 | 9 | public final class UnusedImports { 10 | 11 | public int method() { 12 | return null; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/UseConcurrentHashMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | import java.util.Map; 8 | import java.util.HashMap; 9 | 10 | public final class UseConcurrentHashMap { 11 | public void getMyInstance() { 12 | final Map map = new HashMap<>(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/com/qulice/pmd/UselessParentheses.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package foo; 6 | 7 | public class UselessParentheses { 8 | private int bar1; 9 | private Integer bar2; 10 | 11 | public void setBar(int n) { 12 | bar1 = Integer.valueOf((n)); 13 | bar2 = (n); 14 | } 15 | 16 | public int sum() { 17 | return bar1 + bar2; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /qulice-pmd/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 2 | # SPDX-License-Identifier: MIT 3 | 4 | # Set root logger level to DEBUG and its only appender to CONSOLE 5 | log4j.rootLogger=WARN, CONSOLE 6 | 7 | # "Console" is set to be a ConsoleAppender. 8 | log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 9 | log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 10 | log4j.appender.CONSOLE.layout.ConversionPattern = [%-5p] %c: %m\n 11 | 12 | # Application-specific logging 13 | log4j.logger.com.qulice.pmd=DEBUG 14 | -------------------------------------------------------------------------------- /qulice-spi/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2025 Yegor Bugayenko 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 1) Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 2) Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following 11 | disclaimer in the documentation and/or other materials provided 12 | with the distribution. 3) Neither the name of the Qulice.com nor 13 | the names of its contributors may be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 19 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 | THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 28 | OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /qulice-spi/src/main/java/com/qulice/spi/ResourceValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.spi; 6 | 7 | import java.io.File; 8 | import java.util.Collection; 9 | 10 | /** 11 | * Validator. 12 | * 13 | * @since 0.17 14 | */ 15 | public interface ResourceValidator { 16 | 17 | /** 18 | * Validate and throws exception if there are any problems. 19 | * @param files Files to validate 20 | * @return Validation results 21 | */ 22 | Collection validate(Collection files); 23 | 24 | /** 25 | * Name of this validator. 26 | * @return Name of this validator. 27 | */ 28 | String name(); 29 | } 30 | -------------------------------------------------------------------------------- /qulice-spi/src/main/java/com/qulice/spi/ValidationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.spi; 6 | 7 | /** 8 | * Exception thrown by a validator, if it fails. 9 | * 10 | * @since 0.3 11 | */ 12 | public final class ValidationException extends Exception { 13 | 14 | /** 15 | * Serialization marker. 16 | */ 17 | private static final long serialVersionUID = 0x75298A7876D21470L; 18 | 19 | /** 20 | * Public ctor. 21 | * @param text The text of the exception 22 | * @param args Optional arguments for String.format() 23 | */ 24 | public ValidationException(final String text, final Object... args) { 25 | super(String.format(text, args)); 26 | } 27 | 28 | /** 29 | * Public ctor. 30 | * @param cause The cause of exception 31 | */ 32 | public ValidationException(final Throwable cause) { 33 | super(cause); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /qulice-spi/src/main/java/com/qulice/spi/Validator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | package com.qulice.spi; 6 | 7 | /** 8 | * Validator. 9 | * 10 | * @since 0.3 11 | */ 12 | public interface Validator { 13 | 14 | /** 15 | * Validate and throws exception if there are any problems. 16 | * @param env The environment to work with 17 | * @throws ValidationException In case of any violations found 18 | */ 19 | void validate(Environment env) throws ValidationException; 20 | 21 | /** 22 | * Name of this validator. 23 | * @return Name of this validator. 24 | */ 25 | String name(); 26 | } 27 | -------------------------------------------------------------------------------- /qulice-spi/src/main/java/com/qulice/spi/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Service provider interface. 8 | * 9 | * @since 0.3 10 | */ 11 | package com.qulice.spi; 12 | -------------------------------------------------------------------------------- /qulice-spi/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /qulice-spi/src/test/java/com/qulice/spi/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: Copyright (c) 2011-2025 Yegor Bugayenko 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | 6 | /** 7 | * Service provider interface, tests. 8 | * 9 | * @since 0.3 10 | */ 11 | package com.qulice.spi; 12 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:base" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /src/site/resources/CNAME: -------------------------------------------------------------------------------- 1 | www.qulice.com 2 | -------------------------------------------------------------------------------- /src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | com.jcabi 9 | jcabi-maven-skin 10 | 1.7.1 11 | 12 | UA-1963507-25 13 | 14 | Qulice 15 | https://www.qulice.com/logo.svg 16 | https://www.qulice.com/ 17 | home page of Qulice.com 18 | 214 19 | 60 20 | 21 | 22 | 23 | <link href="https://www.qulice.com/logo.svg" rel="shortcut icon"/> 24 | <link href="https://plus.google.com/u/0/114792568016408327418?rel=author" rel="author"/> 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | --------------------------------------------------------------------------------