Compare commits

...

311 Commits

Author SHA1 Message Date
Gavriil Sitnikov beac826751 ignore null annotations fix 2017-02-20 20:52:19 +03:00
Gavriil Sitnikov 3912ebd212 custom declaration check added 2017-02-20 20:32:50 +03:00
Gavriil Sitnikov 34b111caf4 Merge branch 'master' of https://github.com/checkstyle/checkstyle into hacked-lambda-indentation 2017-02-20 17:41:48 +03:00
Gavriil Sitnikov 1df76feba2 nullable annotation check added 2017-02-20 17:40:49 +03:00
Jochen Van de Velde f9a6b2ae99 Issue #2935: Correct naming in import control DTD 2017-02-19 15:20:58 -08:00
Andrei Selkin 3eaa031fb7 Issue #3843: Fix coverage problem for DesignForExtension 2017-02-19 15:09:24 -08:00
Roman Ivanov 29af968bb6 minor: swap of elements in NPATH xdoc to ease reading 2017-02-19 06:31:33 -08:00
Vladislav Lisetskii cd88872f9d Issue #3729: Reevaluate tokens in IllegalTokenText 2017-02-18 17:16:51 -05:00
rnveach e60bf1807a Issue #3748: updated reason for google's EmptyBlockCheck config 2017-02-17 16:34:14 -08:00
rnveach 6e8d1e0672 Issue #3721: enforced no abbreviations in checkstyle 2017-02-17 14:04:38 -08:00
rnveach a103ccf92b Issue #3721: expanded message and documentation AbbreviationAsWordInName 2017-02-17 14:04:38 -08:00
Roman Ivanov 1aa8bcf788 minor: NPATH: clarification for Statement and blocks, empty block is also should be counted as 1 2017-02-16 16:11:54 -08:00
Roman Ivanov 7f33056426 minor: update for NPathComplexity xdoc to qualify function term with method 2017-02-16 15:59:00 -08:00
rnveach 48d48fd097 Pull #3835: added missing leave token to AbstractTypeAwareCheck 2017-02-16 08:47:57 -08:00
rnveach 67bd379bd8 Issue #3701: changed google's message for IllegalTokenText 2017-02-16 06:18:56 -08:00
rnveach fe882ab223 Issue #3701: removed backspace from google's IllegalTokenText 2017-02-16 06:18:56 -08:00
rnveach 34ef127bdc Issue #3735: added lambdas to NeedBraces for checkstyle config 2017-02-15 20:38:34 -08:00
rnveach 2b645405ac Issue #3751: added assert literal to checkstyle illegal token 2017-02-15 20:27:53 -08:00
rnveach dcd5615e9e Issue #3803: added new case for if and or operator for IndentationCheck 2017-02-15 20:10:20 -08:00
rnveach 2e29226c84 Issue #3749: updated reason for google's OperatorWrapCheck config 2017-02-15 20:06:59 -08:00
shawn.kovalchick 4bc519ac05 Issue #3733: Modify indent check to handle multiple, stacked annotations 2017-02-15 08:02:49 -05:00
SATO Yusuke 8b367e9d35 Issue #3831: fixed funny messages in messages_ja.properties 2017-02-14 22:24:46 -08:00
Roman Ivanov dd0208b1ba minor: links to w3schools were updated to use https as linkcheck plugin detected redirect 2017-02-14 17:50:03 -08:00
Roman Ivanov 0f7c70e68f minor: change eclipse links to https to avoid linkcheck plugin violations 'SocketException : Connection reset' 2017-02-14 17:34:25 -08:00
Jochen Van de Velde e307efd92b Issue #3736: Clean up import control configuration 2017-02-12 22:37:49 -05:00
Roman Ivanov a169e60720 Issue #3818: skip travis deploy phase if changes in minor files or other ci configs 2017-02-12 18:18:13 -08:00
Roman Ivanov 88a419520b infra: refactoring for wercker config to make replace of property file 2017-02-12 07:07:27 -08:00
Roman Ivanov c1254fa86e Issue #3818: skip travis build if minor files or other CI files are changed 2017-02-12 07:04:21 -08:00
Roman Ivanov 887f5eadc9 Revert "infra: workaround for FileAlreadyExistsException: src/main/java/empty_file at launch.generateCheckstyleReport(launch.groovy:93)"
This reverts commit 32a9dc0524.
2017-02-12 05:31:32 -08:00
Roman Ivanov 32a9dc0524 infra: workaround for FileAlreadyExistsException: src/main/java/empty_file at launch.generateCheckstyleReport(launch.groovy:93) 2017-02-11 21:01:16 -08:00
Roman Ivanov c70fa5be40 infra: update circle ci to do substitution in the file 2017-02-11 20:58:53 -08:00
Roman Ivanov cbb03570a2 infra: fix typo change in circle.yml to use property file where guava is referenced 2017-02-11 20:43:00 -08:00
Jochen Van de Velde f798045b3c doc: Add notes on import control config for inner classes 2017-02-11 10:41:31 -08:00
Vladislav Lisetskii d3993feee8 Pull #3820: Rename method in CheckUtil 2017-02-11 07:34:12 -08:00
rnveach f382316e2f infra: update orekit commit 2017-02-11 07:33:52 -08:00
Robert Painsi c9fc6ba17d Issue #3718: Add varargs support for NoWhitespaceBefore 2017-02-10 21:48:30 -05:00
Roman Ivanov 90be9c61e1 config: restore default token LABELED_STAT in IllegalToken 2017-02-10 16:37:04 -08:00
Roman Ivanov 69bcd327f1 config: suppress permannent linkcheck plugin violation on correct url 2017-02-10 10:32:06 -08:00
Roman Ivanov c232625893 infra: reordering matrix items in travis to speedup build failure for most frequent items 2017-02-09 16:36:35 -08:00
Roman Ivanov d3edb92a5e Issue #3798: move some travis tasks to wercker 2017-02-09 16:30:58 -08:00
Andrei Selkin 3e541237a1 Issue #3702: Allow single character names in local variables, method and catch-blocks parameters names in accordance with Google Style Guide 2017-02-09 17:03:19 -05:00
kazachka 614b7647d8 Issue #3797: fix default and acceptable tokens for NPathComplexityCheck 2017-02-09 12:57:03 -08:00
Roman Ivanov fef078d8cd Issue #3800: Typo in website documentation for JavadocMethod 2017-02-09 12:44:26 -08:00
Roman Ivanov dab7a9af0e infra: fix for build Travis failure with invalid token 2017-02-09 08:24:45 -08:00
Roman Ivanov 837ae3bbb0 doc: Known API issues was added to reference #3810 2017-02-09 06:51:36 -08:00
rnveach 8c0e0d0035 Issue #3803: fixed catch indentation wrapping 2017-02-08 14:37:50 -08:00
Andrei Selkin a52c7a7a8a infra: fix cli arg names for launch.groovy 2017-02-05 11:03:28 -08:00
Roman Ivanov 0a1a355849 infra: switch to readonly token in travis 2017-02-05 07:12:45 -08:00
Roman Ivanov 071dc4bdcb minor: fix for incomplete previous refactoring 2017-02-05 06:36:04 -08:00
Roman Ivanov ecc429c92f minor: formatting of output for releasenotes generator 2017-02-04 08:55:51 -08:00
Roman Ivanov 9bddb63a8e config: bump checkstyle version 2017-02-04 08:40:54 -08:00
Roman Ivanov 668fd0b5ff config: update to 7.6-SNAPSHOT 2017-02-04 08:27:14 -08:00
Roman Ivanov 53df9f54f9 [maven-release-plugin] prepare for next development iteration 2017-02-04 07:37:49 -08:00
Roman Ivanov 5a6a87ac20 [maven-release-plugin] prepare release checkstyle-7.5.1 2017-02-04 07:17:42 -08:00
Roman Ivanov 112e5bc663 doc: release notes 7.5.1 2017-02-04 06:55:47 -08:00
Roman Ivanov 4321a5064b config: update to 7.5.1-SNAPSHOT 2017-02-04 06:04:11 -08:00
Roman Ivanov e5a6aad84e infra: removal of duplicate launch for NoErrorTest - Hibernate Search 2017-02-03 17:32:14 -08:00
Roman Ivanov 5842b9014e infra: cleanup in wercker.yml, to skip chekstyle build as it is already done 2017-02-03 17:29:23 -08:00
Roman Ivanov 24c62a5f38 Issue #3790: Add the Hibernate Search project to the Checkstyle CI 2017-02-03 17:21:22 -08:00
Roman Ivanov 3e0d60a921 Issue #3790: Add the Hibernate Search project to the Checkstyle CI 2017-02-03 13:45:48 -08:00
Andrei Selkin 927f65ce8e infra: fix launch.groovy script parameters 2017-02-03 13:44:49 -08:00
Roman Ivanov e6760f611a infra: fix for typo in wercker.yml for previous commit 2017-02-03 13:29:10 -08:00
Andrei Selkin 3853b9ff4f infra: Update CIs configs to use cli options names of launch.groovy 2017-02-03 13:03:42 -08:00
Roman Ivanov 246661b42a config: enforce strict version of htmlunit code to prevent build failures in our CI while htmlunit have build failures 2017-02-02 16:37:59 -08:00
Roman Ivanov d4bec82ed1 minor: update wercker.yml to do quite svn checkout to reduce log size 2017-02-01 18:40:31 -08:00
rnveach fcfacfc6ec Issue #3778: show exception when failed to instantiate class 2017-02-01 13:18:16 -08:00
rnveach 4a696a9771 config: enabled HtmlUnit no error test 2017-02-01 13:16:53 -08:00
rnveach 11e1eb3ddd Issue #3776: fixed try-resource in RightCurlyCheck 2017-02-01 13:16:53 -08:00
Roman Ivanov 78a04e2b19 Issue #3776: add htmlunit project to NoErrorTest (wercker) 2017-01-31 16:26:32 -08:00
Roman Ivanov 9fcd877478 config: skip release-dry-run on travis for release-maven-plugin commit 2017-01-29 07:21:32 -08:00
Roman Ivanov 7ef51d26e1 config: checkstyle version bump 2017-01-29 06:56:36 -08:00
Roman Ivanov eaa5d7da24 [maven-release-plugin] prepare for next development iteration 2017-01-29 06:32:44 -08:00
Roman Ivanov d415955c27 [maven-release-plugin] prepare release checkstyle-7.5 2017-01-29 06:32:39 -08:00
Roman Ivanov 6cf06edddc doc: release notes for 7.5 2017-01-28 15:43:22 -08:00
rnveach 785ed054a6 Issue #3530: allowed ant to override and swap checker 2017-01-28 14:54:14 -08:00
Roman Ivanov 2551676ccf Revert "Issue #3546: add lambda in a rightcurlycheck"
This reverts commit b0d5b01b3c.
2017-01-28 14:14:59 -08:00
MaksimP b0d5b01b3c Issue #3546: add lambda in a rightcurlycheck 2017-01-28 14:14:34 -08:00
rnveach 4cff2eb714 Issue #3771: fixed in NPE in cache for HeaderCheck 2017-01-28 11:59:25 -08:00
Roman Ivanov 861612671a config: suppress some links validation by linkcheck plugin due to SSLHandshakeException 2017-01-28 06:45:45 -08:00
Vladislav Lisetskii b280c4c5c2 minor: rename contributor in releasenotes 2017-01-28 05:11:41 -08:00
Vladislav Lisetskiy 619e3b3dce Issue #3041: RequireThisCheck doesn't see outer classes for anonymous classes 2017-01-28 05:02:27 -08:00
rnveach 4aacddab59 Issue #3753: updated reason for no NeedBracesCheck on lambda 2017-01-27 19:33:48 -08:00
rnveach 4cda256567 Issue #3764: removed garbage placed in RightCurlyCheck's rcurly 2017-01-27 12:11:37 -08:00
Roman Ivanov b4a337a599 minor: bump year in header of all java files 2017-01-27 06:31:54 -08:00
Markus Rathgeb 8e52504297 Issue #3732: fix NPE for Java 8's 'receiver parameter' 2017-01-27 06:05:56 -08:00
Andrei Selkin f91b1af3d7 Issue #3675: Replace Scope with AccessModifier in ParameterNameCheck to avoid wrong scopes comparison 2017-01-26 08:47:44 -08:00
Roman Ivanov f59e19992c config: travis.sh user argument to run a goal instead of variable to simplify usage in local by copy-paste 2017-01-26 06:53:18 -08:00
Roman Ivanov 8ecdcc6d8e config: bump maven-compiler-plugin to 3.6.1 2017-01-25 19:59:37 -08:00
Roman Ivanov 81fae5eb1e config: bump equalsverifier to 2.2 2017-01-25 19:59:22 -08:00
Roman Ivanov 8df31cac3b minor: change for google cache date 2017-01-24 15:26:23 -08:00
rnveach 4b52e5dcf9 Issue #3740: verify all tokens are used in google config 2017-01-24 08:15:01 -08:00
Andrei Selkin e3686ca404 Issue #3741: Fix false negative when import is from java.lang package 2017-01-22 18:23:20 -05:00
Jochen Van de Velde 3065df7eee config: Limit Guava import control to src/main 2017-01-22 05:01:13 -08:00
Jochen Van de Velde b57e4d3df6 Issue #3462: Implement 'path' property for ImportControlCheck 2017-01-22 05:01:13 -08:00
kazachka 0cee0939c9 Issue #3507: xdocs fix 2017-01-20 07:01:31 -08:00
rnveach 258c440a01 Issue #3720: added missing tokens to checkstyle config 2017-01-18 10:27:09 -08:00
rnveach a73d0eb6f4 Issue #3720: verify all tokens are used in checkstyle config 2017-01-18 10:27:09 -08:00
kazachka 2852e45bf6 Issue #3507: column number in first javadoc line fixed 2017-01-17 11:24:57 -05:00
Roman Ivanov 9dab0e74eb Issue #3708: exclude deprecated classes from com.puppycrawl.tools.checkstyle.checks.coding 2017-01-14 07:41:10 -08:00
Roman Ivanov 9499f887d3 Issue #3708: com.puppycrawl.tools.checkstyle.checks.metrics.AbstractComplexityCheck exluded as it is deprecated 2017-01-14 07:17:29 -08:00
rnveach 045581b52d Issue #3708: increased mutation for naming package to 100% 2017-01-14 07:11:28 -08:00
Jochen Van de Velde 31ba306454 config: Suppress MethodCount check in tests 2017-01-12 05:17:27 -08:00
Roman Ivanov 18934ddf54 config: upgrade jacoco maven plugin to 0.7.8 2017-01-11 16:05:30 -08:00
Roman Ivanov 8a6774e1ee config: update to antlr4-runtime 4.6 2017-01-11 16:05:00 -08:00
Roman Ivanov d460db93b2 config: update to org.eclipse.jgit 4.6.0.201612231935-r 2017-01-11 15:44:57 -08:00
Roman Ivanov b5074cc644 config: update ant to 1.10.0 2017-01-11 15:44:38 -08:00
Roman Ivanov b02376b11e config: update slf4j-simple to 1.7.22 2017-01-11 15:32:14 -08:00
Roman Ivanov 5a89089818 config: equalsverifier upgrade to 2.1.8 2017-01-11 15:31:54 -08:00
Jochen Van de Velde 4583fcbe0e doc: Fix typo in config_imports.xml 2017-01-11 12:33:42 -08:00
Roman Ivanov e48d90b15b minor: update in shippable.yml to make pitest profile shown in web page 2017-01-11 11:05:08 -08:00
Roman Ivanov b3caf6fe0a Issue #3271: config refactoring, usage of no-validations profile to shorten execution time 2017-01-10 17:48:39 -08:00
Roman Ivanov b3849a2049 Issue #3670: add pgjdbc project at NoErrorTest group of tests (wercker ci) 2017-01-09 18:41:09 -08:00
Roman Ivanov 7f4e1217bc minor: update for shippable ci badge to show its name on image 2017-01-09 16:31:40 -08:00
Oleg Efremenkov fde083d175 Issue #3316: use pitest tool testing of checks package in shippable CI 2017-01-09 16:15:28 -08:00
Roman Ivanov bcd5297cea config: license was changed to LGPL-2.1+ (SPDX code), as our header has words as 'either version 2.1 of the License, or (at your option) any later version.' 2017-01-08 16:32:12 -08:00
Michael Diamond e40971942a doc: fix the escaping of AvoidEscapedUnicodeCharactersCheck's javadocs 2017-01-08 15:24:45 -08:00
Roman Ivanov d60250393e minor: update for license wording from https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt 2017-01-07 10:31:28 -08:00
rnveach 0cb01724ac Issue #3064: removed waiting comment that was already implemented 2017-01-06 07:43:18 -08:00
rnveach 32285aadd7 Issue #3509: fixed try with resource on FallThroughCheck 2017-01-05 15:32:14 -08:00
Roman Ivanov 0844fffc64 Issue #3683: activation of chmod on Travis
This reverts commit 0b36159898.
2017-01-05 14:03:34 -08:00
rnveach 39cafcc5bb Issue #3582: marked enum field's final method as redundant 2017-01-05 13:34:03 -08:00
Roman Ivanov 0b36159898 Issue #3683: deactivation of chmod as Travis is failing, but works fine on local 2017-01-05 10:03:27 -08:00
rnveach 9b05fefd03 Issue #3664: verified all types of checks are on checks.xml 2017-01-05 09:01:27 -08:00
Roman Ivanov fa2f05a533 minor: fix for intelijidea violation for tabs usage 2017-01-05 06:00:52 -08:00
Charlie Pai db47f55962 doc: Fix incorrect documentation for SuppressWithNearbyCommentFilter 2017-01-05 05:57:21 -08:00
rnveach 2c81de1bb0 Issue #3681: fixed NPE in RightCurly when do has no curlies 2017-01-05 05:47:34 -08:00
Roman Ivanov 54058853b9 Issue #3683: return exit code if smth is found to fail build 2017-01-05 05:41:51 -08:00
Roman Ivanov 95e621c0e5 minor: remove execute mod from .travis.yml 2017-01-05 05:34:06 -08:00
MaksimP 0e7eaaccb3 Issue #3683: add to CI test permissions on all files 2017-01-04 17:31:19 -08:00
Roman Ivanov 16aadebeee doc: how to generate sources after import project to IntelijIdea 2017-01-03 17:24:51 -08:00
Roman Ivanov cd3a79d233 config: bump checkstyle version 2016-12-31 07:55:01 -08:00
Roman Ivanov 5c8ae2b45e [maven-release-plugin] prepare for next development iteration 2016-12-30 21:41:53 -08:00
Roman Ivanov 424ce6506e [maven-release-plugin] prepare release checkstyle-7.4 2016-12-30 21:41:48 -08:00
Roman Ivanov ee0fbe9065 doc: release notes for 7.4 2016-12-30 21:33:44 -08:00
liscju 0fdbbda102 Issue #3655: Fix NPE in NeedBraces on single line default stmt 2016-12-30 17:34:34 -08:00
kazachka 914dd9994c Issue #3551: CustomImportOrder shows violation on multiple line separation 2016-12-30 10:14:19 -08:00
Roman Ivanov c25004bd03 Issue #3678: createCheckConfig become private, all ITs a loading config from file 2016-12-30 08:05:03 -08:00
Roman Ivanov 96393a3dd9 Issue #3678: update ITs to load certain config by id if there few of them in file 2016-12-30 08:00:34 -08:00
Roman Ivanov 3f3a80714e Issue #3678: RightCurly with DO-WHILE demands WHILE to be on new line (configuration problem with RightCurly check in google_checks.xml). Update for ITs. 2016-12-30 07:59:09 -08:00
Roman Ivanov 5f1e55bf1c config: resolve pmd build warning about rule that is moved to another set 2016-12-29 17:08:17 -08:00
Roman Ivanov 92aea351ad Issue #3672: update documentation about getAcceptableTokens for javadoc Checks 2016-12-29 11:58:23 -08:00
Andrei Selkin 8e9c98f1f8 infra: Use launch.groovy for testing (Circle CI) 2016-12-27 10:09:58 -08:00
Roman Ivanov 0248bb4d2e Issue #3665: update documentation for VariableDeclarationUsageDistance with allowedDistance = 0 2016-12-24 07:19:20 -08:00
Roman Ivanov e3baa51b00 minor: fix for linkcheck plugin violation for sonarqube site 2016-12-22 12:54:29 -08:00
Roman Ivanov d9c1b95d72 minor: fix for linkcheck plugin violation for sonarqube site 2016-12-22 10:50:28 -08:00
Roman Ivanov 8cc03cbf11 minor: fix for typo in WriteTag documentation 2016-12-22 06:00:48 -08:00
Roman Ivanov b0972bab3f minor: update to mre clear documentation for WriteTag 2016-12-20 16:27:02 -08:00
Vladislav Lisetskii d24405c088 Issue #3184: Make hardcoded map with all module names that in checkstyle 2016-12-20 13:44:45 -08:00
rnveach ce54507376 Issue #3667: fixed documentation and tests for checkstyle modules 2016-12-19 16:43:51 -08:00
Roman Ivanov bbfe5a1b69 minor: update for reason in findbugs excludes 2016-12-17 18:19:37 -08:00
Roman Ivanov 1f5237f587 Issue #3662: Duplicated Checks in google_checks.xml config should have 'id' 2016-12-16 12:56:18 -08:00
Roman Ivanov 1dea8dc3bb Issue #3657: skip unnecessary exception 'Severity not set, ignoring exception' 2016-12-16 12:02:36 -08:00
Jochen Van de Velde 52d009b3f8 minor: correct Javadoc for AbstractImportRule 2016-12-16 11:58:00 -08:00
Roman Ivanov 026c01bee4 minor: refactoring to shorten code, reodering of statements to minimize declaration-usage variable distance 2016-12-15 07:12:44 -08:00
Roman Ivanov 81889c9a97 minor: fix for linkcheck plugin violation 2016-12-15 06:33:19 -08:00
Roman Ivanov 292d92baca config: bump maven-resources-plugin to 3.0.2 2016-12-13 10:04:17 -08:00
Robert Reiz 4d25a08063 Pull #3653: Using the SPDX identifier for the license name. SPDX is a standard for licenses. 2016-12-13 09:49:30 -08:00
Roman Ivanov 2197a604dd minor: fix for linkcheck plugin validation (googlewebtoolkit.blogspot.com) 2016-12-13 09:46:08 -08:00
Roman Ivanov 9321a5bec6 minor: fix for linkcheck plugin validation (viold-elements) 2016-12-12 13:38:23 -08:00
Roman Ivanov 1bf40e8418 minor: fix for linkcheck plugin validation (viold-elements) 2016-12-12 13:26:09 -08:00
rnveach 2b59f39b16 Issue #3622: expanded and fixed documentation for checker and treewalker 2016-12-12 12:49:20 -08:00
rnveach 5b73516ca1 Issue #2803: added synchronized to NoWhitespaceAfterCheck 2016-12-12 09:16:47 -08:00
kazachka 65fe91df6a Issue #3426: remove warning on PACKAGE_DEF preceded by javadoc not separated by line 2016-12-12 06:04:12 -08:00
Roman Ivanov c2bbc9753b Issue #3632: move NoExceptionTest items to travis.sh 2016-12-11 17:03:40 -08:00
Roman Ivanov fd880587e3 config: travis deploy as refactored to use '-Pno-validations' 2016-12-11 16:30:00 -08:00
Roman Ivanov f600ac2df9 config: minor formatting in travis.yml 2016-12-11 16:22:33 -08:00
Roman Ivanov 983c8b087d Issue #3632: several Travils items were moved to travis.sh 2016-12-11 16:22:33 -08:00
Roman Ivanov 90dc0666ba Issue #3590: CustomImportControl bad document examples that could lead to false positive on 'special group' 2016-12-11 15:45:13 -08:00
Roman Ivanov 83507a07ab minor: sorting skip options in profiles to ease readability 2016-12-11 15:03:43 -08:00
rnveach 01e039a0fb Issue #2809: added new checks for google style 4.6.2 2016-12-11 10:23:36 -08:00
Roman Ivanov 61684248e7 config: reduce amount of skips by profile 'no-validations' 2016-12-11 07:24:36 -08:00
Roman Ivanov 2d23e27181 config: enable MacOS verify item, default jdk became jdk8 on travis 2016-12-11 06:58:56 -08:00
Roman Ivanov bd5ea09b31 Issue #3632: pr description validation is moved to shell script 2016-12-11 06:19:07 -08:00
Roman Ivanov 4f64bd427a minor: resolve Intellij inspection 'Variable result initializer false is redundant' 2016-12-11 05:40:01 -08:00
Roman Ivanov ee758e1997 config: all-sevntu-checks: '-u' option for diff command to be more human friendly 2016-12-10 17:42:42 -08:00
rnveach e60d4545a7 minor: all style checks should be referenced in style xdoc 2016-12-10 17:30:10 -08:00
rnveach 032742cf6c minor: checks should have all their styles listed 2016-12-10 17:30:10 -08:00
Roman Ivanov dea98c8ce9 config: fix for unexpected empty line in temp file during all-sevntu-checks 2016-12-10 16:39:13 -08:00
Roman Ivanov c5bf1ac741 minor: comment about -x option for bash 2016-12-10 15:37:03 -08:00
Roman Ivanov 029ab124cf Issue #3628: all Checks are activarted, Travis valiadtion is activated 2016-12-10 15:30:21 -08:00
Roman Ivanov 32a7a33360 Issue #3628: ReturnCountExtendedCheck from sevntu is enabled, all violations are resolved 2016-12-10 15:25:13 -08:00
Roman Ivanov ace65c09fb Issue #3628: ConstructorWithoutParamsCheck from sevntu is enabled 2016-12-10 14:39:30 -08:00
Roman Ivanov 9f53d5f39f config: pitest-maven update to 1.1.11 2016-12-10 09:21:02 -08:00
Roman Ivanov 42b71efdda config: bump sevntu-checks version to 1.23.0 2016-12-10 07:10:24 -08:00
Roman Ivanov d1aa8e3b40 Issue #3628: usage of xmlstarlet instead of grep 2016-12-10 06:48:48 -08:00
Roman Ivanov ed6b9004ea Issue #3632: releasenotes generation was moved to separate shell file 2016-12-10 06:46:21 -08:00
Roman Ivanov 4a540b4aec Issue #3628: AvoidModifiersForTypesCheck is customized for accesible Logger detection 2016-12-10 06:42:04 -08:00
Roman Ivanov 82d58d5cff Issue #3628: HideUtilityClassConstructorCheck, AvoidModifiersForTypesCheck are used, other are referenced only 2016-12-10 06:30:31 -08:00
Roman Ivanov cd91999dec Issue #3628: pipefail was removed to allow avoid failues by '| cat' 2016-12-09 16:50:56 -08:00
Roman Ivanov 9d9053066e Issue #3628: create validation for missing sevntu checks 2016-12-09 16:20:17 -08:00
MaksimP 4c2649f572 Issue #3600: fix chmod 2016-12-09 16:14:39 -08:00
Oleg Efremenkov ba178a2bb1 Issue #3316: use pitest testing of checks.sizes package in shippable CI 2016-12-09 15:22:48 -08:00
Roman Ivanov ec2834e43a minor: fix for Intelij inspections (Prohibited exception 'Exception' thrown; Declaration has problems in Javadoc references ; 'assertEquals()' may be 'assertSame()' ;'assertEquals()' can be simplified to 'assertNull()') 2016-12-09 14:01:23 -08:00
Roman Ivanov 3f3dedeacc Issue #3606: additioanl UTs for coverage 100% 2016-12-09 11:42:20 -08:00
MaksimP 9ebd617439 Issue #3333: add new tokens in WhitespaceAfterCheck 2016-12-09 11:21:24 -08:00
Saideep 4ffcaad67d Issue #3606: Test coverage boost for ParseTreeTablePModel.java 2016-12-09 08:46:46 -08:00
Roman Ivanov 5d655dce40 minor: formatting fix just to trigger PR 2016-12-09 08:45:36 -08:00
Roman Ivanov 40a7f33b26 config: upgrade to latest Orekit commit 2016-12-09 08:41:52 -08:00
rnveach b61daf7f44 Issue #3611: added haltOnException to Checker 2016-12-07 15:21:03 -08:00
liscju 4d214096fc Issue #3617: make FinalLocalVariable not check multi-catch vars 2016-12-07 13:22:51 -08:00
Aurimas Liutikas 636ae05d05 Issue #3605: enable certain SAXParserFactory features 2016-12-06 14:57:49 -08:00
Roman Ivanov 62e1209c81 minor: fix for sonar links (linkcheck plugin) 2016-12-05 16:32:05 -08:00
rnveach 292ad0ebf2 Issue #3575: changed module setters for uri 2016-12-05 13:00:47 -08:00
Andrei Selkin 98a1956d12 infra: Use launch.groovy for 'NoException' testing (Travis) 2016-12-04 14:38:43 -08:00
Andrei Selkin 68864dce8d infra: Use launch.groovy for 'NoException' testing (Wercker) 2016-12-04 10:46:55 -08:00
rnveach 3ddf152905 Issue #3575: changed module setters for scope 2016-11-30 10:45:24 -08:00
Jochen Van de Velde a0b86b845b Issue #3584: Deprecate 'url' property of ImportControlCheck 2016-11-29 11:01:36 -08:00
Roman Ivanov 266b409f9c config: bump equalsverifier to 2.1.7 2016-11-29 10:49:25 -08:00
Roman Ivanov f5a211ee68 config: bump version for maven-site-plugin to 3.6 version 2016-11-28 22:28:48 -08:00
Roman Ivanov 94a7d07b64 Issue #3594: resolve Unexpected loss of coverage for PropertyCacheFile 2016-11-28 21:20:20 -08:00
linelect 1b91687d6a Issue #2143: add check extra separation in group 2016-11-28 15:55:49 -08:00
linelect 2c6fd416b7 Issue #2143: Fix extra separation in group error 2016-11-28 15:55:49 -08:00
Roman Ivanov 687ad78c81 Update ISSUE_TEMPLATE.md 2016-11-28 15:41:03 -08:00
kazachka 3a8f8d6f39 Issue #3498: ImportCheckControl refactored 2016-11-28 17:31:57 -05:00
rnveach ff83a8faec Issue #3575: changed module setters for severity level 2016-11-28 14:23:09 -08:00
Jochen Van de Velde 0cdbac0761 Issue #3450: Support loading import control configuration from URLs and classpath 2016-11-28 14:19:30 -08:00
Vladislav Lisetskii bfed57cdc8 Issue #2992: ThreadLocal usage in single-threaded checkstyle 2016-11-28 14:16:59 -08:00
rnveach 825e6a8fcd Issue #2068: updated RedundantModifier documentation for final in enums 2016-11-25 21:56:05 -08:00
Roman Ivanov 14958258fc config: http://git-scm.com was added to exclude of linkcheck to avoid SSLException 2016-11-25 07:48:45 -08:00
Roman Ivanov 323faa9b6e config: checkstyle version bump 2016-11-25 07:32:15 -08:00
Roman Ivanov 9290001af2 [maven-release-plugin] prepare for next development iteration 2016-11-25 06:46:50 -08:00
Roman Ivanov a25cfffcd0 [maven-release-plugin] prepare release checkstyle-7.3 2016-11-25 06:46:47 -08:00
Roman Ivanov 57f1c26d1c [maven-release-plugin] rollback the release of checkstyle-7.3 2016-11-25 06:45:38 -08:00
Roman Ivanov a8093f1f9f [maven-release-plugin] prepare release checkstyle-7.3 2016-11-25 06:38:41 -08:00
Roman Ivanov cda594d226 doc: releasenotes 7.3 2016-11-25 06:00:45 -08:00
Roman Ivanov 34c46f7808 minor: change git-scm url in documentation to avoid linkcheck violation - 'javax.net.ssl.SSLException : Received fatal alert: internal_error' 2016-11-25 05:50:29 -08:00
Roman Ivanov 63125517be minor: change url in documentation to avoid unstable linkcheck violation and to have better article 2016-11-25 05:47:30 -08:00
linelect d61783cb9c Issue #3577: ImportOrder checkstyle_checks.xml does not have separate "java" group 2016-11-24 21:06:34 -08:00
rnveach 38d519ce98 config: fixed issue with appveyor and corrupted maven cache 2016-11-24 12:25:47 -08:00
Ken Geis 56a33b5ee2 doc: fix broken link to file filters page 2016-11-23 13:43:05 -08:00
rnveach f84e26aa91 Issue #3567: clarified tests with expected exceptions 2016-11-21 20:59:39 -08:00
rnveach a8aece366e Issue #3567: added ForbidAnnotationElementValueCheck 2016-11-21 20:59:39 -08:00
rnveach a6e50f745e config: added notice about hardcoded cache file 2016-11-20 19:38:24 -05:00
rnveach 6f82844f83 Issue #3487: turned on checkstyle cache for developers 2016-11-20 05:16:03 -08:00
Roman Ivanov 1b7219e839 config: sevntu checkstyle verson bump 2016-11-19 16:46:55 -08:00
Roman Ivanov 82bf6a6410 Issue #3561: document isCommentNodesRequired method in xdoc 2016-11-19 14:05:55 -08:00
rnveach 0e8c819d0e Issue #3536: changed assume into if because of powermock interference 2016-11-18 16:31:20 -08:00
rnveach 19ffe1bb1b Issue #3170: delete children from javadoc TEXT 2016-11-18 16:15:45 -08:00
Michael Vorburger 84015bb21c minor: dos2unix to convert 1 file found 'with CRLF line terminators' 2016-11-18 09:32:45 -08:00
rnveach 481406f2d5 config: version bump for powermock 2016-11-18 09:31:53 -08:00
kazachka 62d4bfe0dd Issue #3432: Added DetailNode support for CodeSelector, gui code selection and tests 2016-11-16 18:29:36 -05:00
Roman Ivanov 23202260b2 config: version bump for maven-assembly-plugin 2016-11-16 14:39:25 -08:00
Roman Ivanov d49732c325 config: fix for relesenotes-builder argument githubAuthToken 2016-11-14 17:06:28 -08:00
Roman Ivanov fcf1ada75f minor: Baratali and Ruslan are marked as former developers (actually marked) 2016-11-14 14:04:44 -08:00
Roman Ivanov bc40bc5fab minor: Baratali and Ruslan are marked as former developers 2016-11-13 05:16:08 -08:00
Roman Ivanov b8c7c15d63 minor: Ilja is marked as former developer 2016-11-12 06:57:54 -08:00
Roman Ivanov 33b026ab17 minor: Michal is marked as former developer 2016-11-12 06:51:52 -08:00
alberto.cuda 548ecd7022 Issue #3381: Update coverage report for Google style 12 July 2016 2016-11-11 16:14:18 -08:00
alberto.cuda a1e1403df4 Issue #3381: Update Google style coverage to state of 12 July 2016 2016-11-11 16:14:18 -08:00
kazachka 4e684926cf Issue #3445: GUI modified to show javadoc tree as subtree of COMMENT_CONTENT token 2016-11-11 13:04:52 -08:00
rnveach 0fb94f14ef Issue #3536: added import control dtd 1.2 to loader 2016-11-10 13:07:07 -08:00
Roman Ivanov 441d2d3700 doc: note was placed to TranslationCheck that it has problems with Checker cache 2016-11-10 12:43:49 -08:00
rnveach 56cc11416e Issue #3488: save files into cache with no un-suppressed violations 2016-11-10 11:59:54 -08:00
rnveach a963f8a21b Issue #3255: removed unnecessary string fields for patterns 2016-11-10 10:34:22 -08:00
Roman Ivanov ad5edc7935 minor: place link of how to report bug on contributing page to be easily accessible 2016-11-10 09:53:37 -08:00
rnveach 8888fa5919 Issue #3255: changed module setters for pattern 2016-11-09 04:34:23 -08:00
rnveach f6261dcaa3 minor: added vm files to be checked by checkstyle 2016-11-08 21:31:31 -08:00
rnveach 8c8fee7432 Issue #3515: allowed cli to override and swap checker 2016-11-08 21:30:14 -08:00
rnveach 1a08a8f34e config: bump maven compiler version 2016-11-08 06:17:29 -08:00
Roman Ivanov 6f2b7bdce7 config: update for nondex plugin to print output 2016-11-06 06:31:21 -08:00
alberto.cuda b99c7d976c Issue #3473: ParameterNameCheck: new scope and excludeScope properties 2016-11-05 16:32:06 -07:00
Andrei Selkin 81ad4595fe Issue #941: Update import ordering in google_checks.xml according to changes in Google Style guide 2016-11-05 16:25:18 -07:00
Andrei Selkin e4996697e8 Issue #1254: Fix JavadocVariableCheck when assigning a lambda as a field 2016-11-05 16:19:07 -07:00
Roman Ivanov a0a63e313f minor: fix for linkcheck issue with old link at SuperFinalizeCheck 2016-11-02 15:40:07 -07:00
rnveach d740cd40d3 minor: added rnveach as developer 2016-11-01 15:40:26 -07:00
rnveach 62926b6106 Issue #2427: added customizable javadoc tokens 2016-11-01 13:07:04 -07:00
Roman Ivanov dda0b9e3ca config: jacoco profile was removed to avoid misunderstanding, jacoco is never used by us in build process 2016-10-31 13:34:48 -07:00
Roman Ivanov 0ac73d822e config: bump checkstyle version 2016-10-30 08:08:57 -07:00
Roman Ivanov 3ecce283b2 [maven-release-plugin] prepare for next development iteration 2016-10-30 06:32:03 -07:00
Roman Ivanov 5cb0f9d39a [maven-release-plugin] prepare release checkstyle-7.2 2016-10-30 06:32:00 -07:00
Roman Ivanov a7f35dbd03 [maven-release-plugin] rollback the release of checkstyle-7.2 2016-10-30 06:31:18 -07:00
Roman Ivanov 929d391fea [maven-release-plugin] prepare release checkstyle-7.2 2016-10-30 06:29:26 -07:00
Roman Ivanov 47e526ef0a [maven-release-plugin] rollback the release of checkstyle-7.2 2016-10-30 06:28:38 -07:00
Roman Ivanov be6f1f6f2c [maven-release-plugin] prepare release checkstyle-7.2 2016-10-30 05:59:37 -07:00
Roman Ivanov c8d61e5d32 doc: release notes 7.2 2016-10-30 05:21:59 -07:00
kazachka 263b1502d8 Issue #3431: Documentation updated, baseIdentation variable renamed to baseIndentation 2016-10-29 13:47:06 -07:00
Jochen Van de Velde 5530d4c27d Issue #3514: Rename PkgControl to ImportControl 2016-10-25 21:46:33 -07:00
Jochen Van de Velde e9b3b9cded Issue #3497: Split Guard class in two 2016-10-23 12:12:17 -07:00
Roman Ivanov 27b03291ce Issue #3033: BeforeExecutionExclusionFileFilter filter java9 modules in our cofig 2016-10-23 10:48:32 -07:00
kazachka 0e7beca9fc Issue #3431: AST printer modified to print javadoc in comment block, tests added 2016-10-22 15:59:44 -07:00
rnveach fbaabe83cf Issue #2866: added before execution and exclusion file filters 2016-10-22 15:53:10 -07:00
Andrei Selkin e163d24909 Issue #3102: Fix DesignForExtension violations on Checkstyle's source code 2016-10-22 15:36:19 -07:00
Andrei Selkin a9793a93ba Issue #3102: Change violation message for DesignForExtension 2016-10-22 15:36:19 -07:00
Andrei Selkin 06716249cf Issue #3102: DesignForExtension: consider overridable methods and javadoc 2016-10-22 15:36:19 -07:00
Baratali Izmailov 6da10046f9 minor: Link to issue which can change DetailNode tree 2016-10-20 15:34:55 -07:00
Roman Ivanov 55202bf936 config: remove java8 test sources special compilation in werker.yml 2016-10-18 19:59:47 -07:00
Roman Ivanov 74cb1b506b config: bump pmd-maven-plugin version to 3.7 2016-10-18 19:39:08 -07:00
Volker Boerchers 63e8c1dd4e Issue #2999: allow regex in subpackage and importcontrol element 2016-10-18 15:40:21 -07:00
zenigata f77a01ba36 Issue #3202: ARRAY_INIT whitespace follow check deleted, test cases added and fixed 2016-10-16 06:25:56 -07:00
Roman Ivanov 864060df97 config: sevntu.checkstyle version bump 2016-10-15 07:14:40 -07:00
rnveach c2847eae88 Issue #3489: restore config hash on property cache clear 2016-10-13 17:27:40 -07:00
Dzmitry Rusak a3e4bcc8b7 Issue #3476: Improve escaped unicode chars detection for AvoidEscapedUnicodeCharacters 2016-10-10 15:24:20 -07:00
Roman Ivanov 777e55a84d config: update in release.sh to link dtds folder to htdocs 2016-10-09 06:09:49 -07:00
alberto.cuda bd6a042192 Issue #3472: Add METHOD_REF to tokens of OperatorWrapCheck 2016-10-08 07:02:38 -07:00
Andrei Selkin 7b5f86ad99 config: exclude JUnit4TestShouldUseTestAnnotation from pmd.xml 2016-10-06 06:01:36 -07:00
Roman Ivanov e62783abc8 Issue #3316: shippable badge was added to README.md 2016-10-05 14:30:13 -07:00
Roman Ivanov a61e0a3267 Issue #3316: introduction of shippable.com CI 2016-10-05 14:19:26 -07:00
Roman Ivanov 2aaa37b76c config: bump equalsverifier version 2016-10-05 06:02:50 -07:00
Roman Ivanov d30b24d16f config: travis - move NonDex below primary tools 2016-10-02 07:55:08 -07:00
rnveach 4b7adec5ae Issue #3486: clear childCount field cache in DetailAST 2016-10-01 17:27:33 -07:00
Andrei Selkin 2577c4121c Issue #3466: Clear branchTokenTypes field cache in DetailAST before changing its structure 2016-09-30 15:13:44 -07:00
Roman Ivanov 9a3529c422 config: bump checkstyle version 2016-09-30 13:54:49 -07:00
Roman Ivanov 22c2bd7323 update to 7.2-SNAPSHOT 2016-09-30 13:15:32 -07:00
Roman Ivanov b4f6660aad [maven-release-plugin] prepare for next development iteration 2016-09-30 13:02:45 -07:00
Roman Ivanov 160f83918c [maven-release-plugin] prepare release checkstyle-7.1.2 2016-09-30 13:02:42 -07:00
Roman Ivanov 674db6733e doc: release notes for 7.1.2 2016-09-30 12:11:01 -07:00
Roman Ivanov 0e15ff7266 update to 7.1.2-SNAPSHOT 2016-09-30 11:17:17 -07:00
Roman Ivanov 2569839c27 config: suppress cobertura Exceptions in output due to cobertura java8 syntax parse problems 2016-09-30 11:16:02 -07:00
Roman Ivanov 08f8c52edd config: bump version of org.eclipse.jgit 2016-09-30 09:37:26 -07:00
Gavriil Sitnikov 7df9062262 Merge branch 'master' into hacked-lambda-indentation 2016-09-30 13:03:59 +03:00
Gavriil Sitnikov 4667eb8825 lambda indentation hacks applied 2016-02-04 16:46:39 +03:00
863 changed files with 16093 additions and 5578 deletions

7
.ci/README.md Normal file
View File

@ -0,0 +1,7 @@
ATTENTION:
All scripts in this folder expect to be launched from root folder of repository
Example of usage:
export GOAL="all-sevntu-checks" && ./.ci/travis/travis.sh
export TRAVIS_PULL_REQUEST="" && export GOAL="releasenotes-gen" && ./.ci/travis/travis.sh

15
.ci/travis/checkchmod.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
# On Travis, after cloe all files are with 644 permission, on local they are 664, so we check only executable bit
CHMOD=$(find -type f -not -path '*/\.git/*' -a -type f -not -name '*.sh' -a \( -type d -not -perm 775 -o -type f -executable \))
if [[ ! -z $CHMOD ]]; then
echo "Expected mode for non '.sh' files is 664.";
echo "Files that violates this rule:"
for NAMEFILE in $CHMOD
do
echo $NAMEFILE;
done
exit 1;
fi

179
.ci/travis/travis.sh Executable file
View File

@ -0,0 +1,179 @@
#!/bin/bash
# Attention, there is no "-x" to avoid problems on Travis
set -e
case $1 in
nondex)
# exclude ConfigurationLoaderTest till https://github.com/TestingResearchIllinois/NonDex/issues/112
mvn --fail-never clean nondex:nondex -Dtest='*,!ConfigurationLoaderTest'
cat `grep -RlE 'td class=.x' .nondex/ | cat` < /dev/null > output.txt
RESULT=$(cat output.txt | wc -c)
cat output.txt
echo 'Size of output:'$RESULT
if [[ $RESULT != 0 ]]; then false; fi
;;
assembly-run-all-jar)
mvn clean package -Passembly
CS_POM_VERSION=$(mvn -q -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
echo version:$CS_POM_VERSION
java -jar target/checkstyle-$CS_POM_VERSION-all.jar -c /google_checks.xml \
src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputNoLineWrapGood.java > output.log
if grep -vE '(Starting audit)|(warning)|(Audit done.)' output.log ; then exit 1; fi
if grep 'warning' output.log ; then exit 1; fi
;;
sonarqube)
if [[ $TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi
mvn clean package cobertura:cobertura sonar:sonar \
-Dsonar.host.url=https://sonarqube.com \
-Dsonar.login=$SONAR_TOKEN \
-Dcobertura.report.format=xml -Dmaven.test.failure.ignore=true \
-Dcheckstyle.skip=true -Dpmd.skip=true -Dcheckstyle.ant.skip=true
;;
release-dry-run)
if [ $(git log -1 | grep -E "\[maven-release-plugin\] prepare release" | cat | wc -l) -lt 1 ]; then
mvn release:prepare -DdryRun=true --batch-mode -Darguments='-DskipTests -DskipITs \
-Dcobertura.skip=true -Dpmd.skip=true -Dfindbugs.skip=true -Dxml.skip=true \
-Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dgpg.skip=true'
fi
;;
releasenotes-gen)
.ci/travis/xtr_releasenotes-gen.sh
;;
pr-description)
.ci/travis/xtr_pr-description.sh
;;
check-chmod)
.ci/travis/checkchmod.sh
;;
all-sevntu-checks)
xmlstarlet sel --net --template -m .//module -v "@name" -n config/checkstyle_sevntu_checks.xml \
| grep -vE "Checker|TreeWalker|Filter|Holder" | grep -v "^$" \
| sort | uniq | sed "s/Check$//" > file.txt
wget -q http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/allclasses-frame.html -O - | html2text \
| grep -E "Check$" | cut -d " " -f6 \
| sort | uniq | sed "s/Check$//" > web.txt
diff -u web.txt file.txt
;;
no-exception-test-checkstyle-sevntu-checkstyle)
git clone https://github.com/checkstyle/contribution
cd contribution/checkstyle-tester
sed -i.'' 's/^guava/#guava/' projects-for-travis.properties
sed -i.'' 's/#checkstyle/checkstyle/' projects-for-travis.properties
sed -i.'' 's/#sevntu-checkstyle/sevntu-checkstyle/' projects-for-travis.properties
cd ../../
mvn clean install -Pno-validations
cd contribution/checkstyle-tester
groovy ./launch.groovy --listOfProjects projects-for-travis.properties --config checks-nonjavadoc-error.xml
;;
no-exception-test-guava)
git clone https://github.com/checkstyle/contribution
cd contribution/checkstyle-tester
sed -i.'' 's/^guava/#guava/' projects-for-travis.properties
sed -i.'' 's/#guava/guava/' projects-for-travis.properties
cd ../../
mvn clean install -Pno-validations
cd contribution/checkstyle-tester
groovy ./launch.groovy --listOfProjects projects-for-travis.properties --config checks-nonjavadoc-error.xml
;;
no-exception-test-guava-with-google-checks)
git clone https://github.com/checkstyle/contribution
cd contribution/checkstyle-tester
sed -i.'' 's/^guava/#guava/' projects-for-travis.properties
sed -i.'' 's/#guava/guava/' projects-for-travis.properties
cd ../../
mvn clean install -Pno-validations
sed -i.'' 's/warning/ignore/' src/main/resources/google_checks.xml
cd contribution/checkstyle-tester
groovy ./launch.groovy --listOfProjects projects-for-travis.properties --config ../../src/main/resources/google_checks.xml
;;
no-exception-test-hibernate)
git clone https://github.com/checkstyle/contribution
cd contribution/checkstyle-tester
sed -i.'' 's/^guava/#guava/' projects-for-travis.properties
sed -i.'' 's/#hibernate-orm/hibernate-orm/' projects-for-travis.properties
cd ../../
mvn clean install -Pno-validations
cd contribution/checkstyle-tester
groovy ./launch.groovy --listOfProjects projects-for-travis.properties --config checks-nonjavadoc-error.xml
;;
no-exception-test-findbugs)
git clone https://github.com/checkstyle/contribution
cd contribution/checkstyle-tester
sed -i.'' 's/^guava/#guava/' projects-for-travis.properties
sed -i.'' 's/#findbugs/findbugs/' projects-for-travis.properties
cd ../../
mvn clean install -Pno-validations
cd contribution/checkstyle-tester
groovy ./launch.groovy --listOfProjects projects-for-travis.properties --config checks-nonjavadoc-error.xml
;;
no-exception-test-spring-framework)
git clone https://github.com/checkstyle/contribution
cd contribution/checkstyle-tester
sed -i.'' 's/^guava/#guava/' projects-for-travis.properties
sed -i.'' 's/#spring-framework/spring-framework/' projects-for-travis.properties
cd ../../
mvn clean install -Pno-validations
cd contribution/checkstyle-tester
groovy ./launch.groovy --listOfProjects projects-for-travis.properties --config checks-nonjavadoc-error.xml
;;
no-exception-test-hbase)
git clone https://github.com/checkstyle/contribution
cd contribution/checkstyle-tester
sed -i.'' 's/^guava/#guava/' projects-for-travis.properties
sed -i.'' 's/#Hbase/Hbase/' projects-for-travis.properties
cd ../../
mvn clean install -Pno-validations
cd contribution/checkstyle-tester
groovy ./launch.groovy --listOfProjects projects-for-travis.properties --config checks-nonjavadoc-error.xml
;;
no-exception-test-Pmd-elasticsearch-lombok-ast)
git clone https://github.com/checkstyle/contribution
cd contribution/checkstyle-tester
sed -i.'' 's/^guava/#guava/' projects-for-travis.properties
sed -i.'' 's/#pmd/pmd/' projects-for-travis.properties
sed -i.'' 's/#elasticsearch/elasticsearch/' projects-for-travis.properties
sed -i.'' 's/#lombok-ast/lombok-ast/' projects-for-travis.properties
cd ../../
mvn clean install -Pno-validations
cd contribution/checkstyle-tester
groovy ./launch.groovy --listOfProjects projects-for-travis.properties --config checks-nonjavadoc-error.xml
;;
no-exception-test-alot-of-project1)
git clone https://github.com/checkstyle/contribution
cd contribution/checkstyle-tester
sed -i.'' 's/^guava/#guava/' projects-for-travis.properties
sed -i.'' 's/#RxJava/RxJava/' projects-for-travis.properties
sed -i.'' 's/#java-design-patterns/java-design-patterns/' projects-for-travis.properties
sed -i.'' 's/#MaterialDesignLibrary/MaterialDesignLibrary/' projects-for-travis.properties
sed -i.'' 's/#apache-ant/apache-ant/' projects-for-travis.properties
sed -i.'' 's/#apache-jsecurity/apache-jsecurity/' projects-for-travis.properties
sed -i.'' 's/#android-launcher/android-launcher/' projects-for-travis.properties
cd ../../
mvn clean install -Pno-validations
cd contribution/checkstyle-tester
groovy ./launch.groovy --listOfProjects projects-for-travis.properties --config checks-nonjavadoc-error.xml
;;
*)
echo "Unexpected argument: $1"
exit 1
;;
esac

View File

@ -0,0 +1,29 @@
#!/bin/bash
# Attention, there is no "-x" to avoid problems on Travis
set -e
if [[ ! $TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi
LINK_COMMITS=https://api.github.com/repos/checkstyle/checkstyle/pulls/$TRAVIS_PULL_REQUEST/commits
COMMITS=$(curl -s -H "Authorization: token $READ_ONLY_TOKEN" $LINK_COMMITS | jq '.[0] | .commit.message')
echo 'Messages from github:'${COMMITS:0:60}...
ISSUE_NUMBER=$(echo $COMMITS | sed -e 's/^.*Issue //' | sed -e 's/:.*//')
echo 'Issue number:'$ISSUE_NUMBER && RESULT=0
if [[ $ISSUE_NUMBER =~ ^#[0-9]+$ ]]; then
LINK_PR=https://api.github.com/repos/checkstyle/checkstyle/pulls/$TRAVIS_PULL_REQUEST
LINK_ISSUE=https://api.github.com/repos/checkstyle/checkstyle/issues/${ISSUE_NUMBER:1}
REGEXP=($ISSUE_NUMBER\|https://github.com/checkstyle/checkstyle/issues/${ISSUE_NUMBER:1})
PR_DESC=$(curl -s -H "Authorization: token $READ_ONLY_TOKEN" $LINK_PR | jq '.body' | grep -E $REGEXP | cat )
echo 'PR Description grepped:'${PR_DESC:0:80}
if [[ -z $PR_DESC ]]; then
echo 'Please put a reference of Issue to PR description, this will bind Issue and PR in Github' && RESULT=1;
fi
LABEL_APRV=$(curl -s -H "Authorization: token $READ_ONLY_TOKEN" $LINK_ISSUE | jq '.labels [] | .name' | grep approved | cat | wc -l )
if [[ $LABEL_APRV == 0 ]]; then
echo 'You provide PR to Issue that is not approved yes, please ask admins to approve your issue first' && RESULT=1;
fi
fi
if [[ $RESULT == 0 ]]; then
echo 'PR validation succeed.';
else
echo 'PR validation failed.' && false;
fi

View File

@ -0,0 +1,50 @@
#!/bin/bash
# Attention, there is no "-x" to avoid problem on Travis
set -e
if [[ $TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi
git clone https://github.com/checkstyle/contribution
cd contribution/releasenotes-builder
mvn clean compile package
cd ../../
git clone https://github.com/checkstyle/checkstyle
cd checkstyle
LATEST_RELEASE_TAG=$(git describe $(git rev-list --tags --max-count=1))
cd ../
CS_RELEASE_VERSION=$(mvn -q -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec | sed 's/-SNAPSHOT//' )
echo LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG
echo CS_RELEASE_VERSION=$CS_RELEASE_VERSION
java -jar contribution/releasenotes-builder/target/releasenotes-builder-1.0-all.jar \
-localRepoPath checkstyle -startRef $LATEST_RELEASE_TAG -releaseNumber $CS_RELEASE_VERSION \
-githubAuthToken $READ_ONLY_TOKEN -generateAll -publishXdoc
echo ==============================================
echo
echo "xdoc segment:"
echo ==============================================
cat xdoc.xml
echo ==============================================
echo
echo "twitter post:"
echo ==============================================
cat twitter.txt
echo ==============================================
echo
echo "google plus post:"
echo ==============================================
cat gplus.txt
echo ==============================================
echo
echo "RSS post:"
echo ==============================================
cat rss.txt
echo ==============================================
echo
echo "mailing list post:"
echo ==============================================
cat mailing_list.txt
echo ==============================================
cd checkstyle/src/xdocs
echo
echo "releasenotes.xml after commit:"
head -n 100 releasenotes.xml

View File

@ -1,13 +1,17 @@
/var/tmp $ javac YOUR_FILE.java
[[PLACE YOUR OUTPUT HERE]]
/var/tmp $ cat YOUR_FILE.java
[[PLACE YOU OUTPUT HERE]]
/var/tmp $ cat config.xml
[[PLACE YOUR OUTPUT HERE]]
/var/tmp $ java -jar checkstyle-X.XX-all.jar -c config.xml YOUR_FILE.java
[[PLACE YOUR OUTPUT HERE]]
---------------

View File

@ -2,8 +2,15 @@ language: java
sudo: false
cache:
apt: true
directories:
- ~/.m2
- ~/.m2
addons:
apt:
packages:
- xsltproc
- xmlstarlet
branches:
only:
@ -15,33 +22,47 @@ install:
matrix:
fast_finish: true
include:
# testing of PR format
- env:
- DESC="test Issue ref in PR description"
- CMD="./.ci/travis/travis.sh pr-description"
# unit tests (oraclejdk8)
- jdk: oraclejdk8
env: DESC="tests and deploy" CMD="mvn clean integration-test failsafe:verify" COVERAGE_CMD="" DEPLOY="true"
# NonDex (oraclejdk8)
- jdk: oraclejdk8
env: DESC="NonDex" CMD="mvn clean nondex:nondex" COVERAGE_CMD="" DEPLOY="false"
env:
- DESC="tests and deploy"
- CMD="mvn clean integration-test failsafe:verify"
- DEPLOY="true"
# checkstyle (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="checkstyle and sevntu-checkstyle"
- CMD="mvn clean verify -DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true -Dcobertura.skip=true"
- COVERAGE_CMD=""
# cobertura and codecov (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="cobertura and codecov"
- CMD="mvn clean compile cobertura:check cobertura:cobertura"
- COVERAGE_CMD="bash <(curl -s https://codecov.io/bash)"
- CMD_AFTER_SUCCESS="bash <(curl -s https://codecov.io/bash)"
# findbugs and pmd (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="findbugs and pmd"
- CMD="mvn clean compile pmd:check findbugs:check"
- COVERAGE_CMD=""
# Releasenotes generation - validaton
- jdk: oraclejdk8
env:
- DESC="Releasenotes generation"
- CMD="./.ci/travis/travis.sh releasenotes-gen"
# NonDex (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NonDex"
- CMD="./.ci/travis/travis.sh nondex"
# site (oraclejdk8 as 'site' success is required to be sure that on release time all will be ok, admins will use oracle8 version)
# moved to https://codeship.com/projects/124310/configure_tests
@ -54,289 +75,116 @@ matrix:
# - CMD=$CMD1$CMD2$CMD3
# - COVERAGE_CMD=""
# unit tests in German locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests de"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=de -Duser.country=DE'"
# unit tests in Spanish locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests es"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=es -Duser.country=ES'"
# unit tests in Finnish locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests fi"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=fi -Duser.country=FI'"
# unit tests in French locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests fr"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=fr -Duser.country=FR'"
# unit tests in Chinese locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests zh"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=zh -Duser.country=CN'"
# unit tests in Japanese locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests ja"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=ja -Duser.country=JP'"
# unit tests in Portuguese locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests pt"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=pt -Duser.country=PT'"
# unit tests in Turkish locale (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="tests tr"
- CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=tr -Duser.country=TR'"
# assembly (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="assembly & run '-all' jar"
- CMD1="mvn clean package -Passembly"
- CMD2=" && CS_POM_VERSION=$(mvn -q -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)"
- CMD3=" && echo version:\$CS_POM_VERSION"
- CMD4=" && java -jar target/checkstyle-\$CS_POM_VERSION-all.jar -c /google_checks.xml"
- CMD5=" src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputNoLineWrapGood.java > output.log"
- CMD6=" && if grep -vE '(Starting audit)|(warning)|(Audit done.)' output.log ; then exit 1; fi "
- CMD7=" && if grep 'warning' output.log ; then exit 1; fi"
- CMD=$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7
- COVERAGE_CMD=""
# https://sonarqube.com (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="sonarqube.com"
- CMD1="if [[ $TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi "
- CMD2=" && mvn clean package cobertura:cobertura sonar:sonar "
- CMD3=" -Dsonar.host.url=https://sonarqube.com "
- CMD4=" -Dsonar.login=\$SONAR_TOKEN "
- CMD5=" -Dcobertura.report.format=xml -Dmaven.test.failure.ignore=true "
- CMD6=" -Dcheckstyle.skip=true -Dpmd.skip=true -Dcheckstyle.ant.skip=true "
- CMD=$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6
- COVERAGE_CMD=""
- CMD="./.ci/travis/travis.sh assembly-run-all-jar"
# NoExceptiontest - Checkstyle, sevntu-checkstyle (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NoExceptionTest - Checkstyle, sevntu-checkstyle"
- CMD1="git clone https://github.com/checkstyle/contribution && cd contribution/checkstyle-tester "
- CMD2=" && sed -i.'' 's/^guava/#guava/' projects-for-travis.properties "
- CMD3=" && sed -i.'' 's/#checkstyle/checkstyle/' projects-for-travis.properties "
- CMD4=" && sed -i.'' 's/#sevntu-checkstyle/sevntu-checkstyle/' projects-for-travis.properties "
- CMD5=" && sed -i.'' 's/projects-to-test-on.properties/projects-for-travis.properties/' launch.sh "
- CMD6=" && cd ../../ && mvn clean install -DskipTests -DskipITs -Dcobertura.skip=true "
- CMD7=" -Dpmd.skip=true -Dfindbugs.skip=true "
- CMD8=" -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dxml.skip=true"
- CMD9=" && cd contribution/checkstyle-tester "
- CMD10=" && ./launch.sh -Dcheckstyle.config.location=checks-nonjavadoc-error.xml"
- CMD=$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9$CMD10
- COVERAGE_CMD=""
# NoExceptiontest - Guava (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NoExceptionTest - Guava"
- CMD1="git clone https://github.com/checkstyle/contribution && cd contribution/checkstyle-tester"
- CMD2=" && sed -i.'' 's/^guava/#guava/' projects-for-travis.properties"
- CMD3=" && sed -i.'' 's/#guava/guava/' projects-for-travis.properties"
- CMD4=" && sed -i.'' 's/projects-to-test-on.properties/projects-for-travis.properties/' launch.sh"
- CMD5=" && cd ../../ && mvn clean install -DskipTests -DskipITs -Dcobertura.skip=true"
- CMD6=" -Dpmd.skip=true -Dfindbugs.skip=true "
- CMD7=" -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dxml.skip=true"
- CMD8=" && cd contribution/checkstyle-tester "
- CMD9=" && ./launch.sh -Dcheckstyle.config.location=checks-nonjavadoc-error.xml"
- CMD=$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9
- COVERAGE_CMD=""
# NoExceptiontest - Guava with google_checks (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NoExceptionTest - Guava with google_checks"
- CMD1="git clone https://github.com/checkstyle/contribution && cd contribution/checkstyle-tester"
- CMD2=" && sed -i.'' 's/^guava/#guava/' projects-for-travis.properties"
- CMD3=" && sed -i.'' 's/#guava/guava/' projects-for-travis.properties"
- CMD4=" && sed -i.'' 's/projects-to-test-on.properties/projects-for-travis.properties/' launch.sh"
- CMD5=" && cd ../../ && mvn clean install -DskipTests -DskipITs -Dcobertura.skip=true"
- CMD6=" -Dpmd.skip=true -Dfindbugs.skip=true "
- CMD7=" -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dxml.skip=true"
- CMD8=" && sed -i.'' 's/warning/ignore/' src/main/resources/google_checks.xml"
- CMD9=" && cd contribution/checkstyle-tester "
- CMD10=" && ./launch.sh -Dcheckstyle.config.location=../../src/main/resources/google_checks.xml
- CMD=$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9$CMD10
- COVERAGE_CMD=""
# NoExceptionTest - Hibernate ORM (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NoExceptionTest - Hibernate ORM"
- CMD1="git clone https://github.com/checkstyle/contribution && cd contribution/checkstyle-tester "
- CMD2="&& sed -i.'' 's/^guava/#guava/' projects-for-travis.properties "
- CMD3="&& sed -i.'' 's/#hibernate-orm/hibernate-orm/' projects-for-travis.properties "
- CMD4="&& sed -i.'' 's/projects-to-test-on.properties/projects-for-travis.properties/' launch.sh "
- CMD5="&& cd ../../ && mvn clean install -DskipTests -DskipITs -Dcobertura.skip=true "
- CMD6=" -Dpmd.skip=true -Dfindbugs.skip=true "
- CMD7=" -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dxml.skip=true"
- CMD8="&& cd contribution/checkstyle-tester "
- CMD9="&& ./launch.sh -Dcheckstyle.config.location=checks-nonjavadoc-error.xml"
- CMD=$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9
- COVERAGE_CMD=""
# NoExceptionTest - FindBugs (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NoExceptionTest - FindBugs"
- CMD1="git clone https://github.com/checkstyle/contribution && cd contribution/checkstyle-tester "
- CMD2="&& sed -i.'' 's/^guava/#guava/' projects-for-travis.properties "
- CMD3="&& sed -i.'' 's/#findbugs/findbugs/' projects-for-travis.properties "
- CMD4="&& sed -i.'' 's/projects-to-test-on.properties/projects-for-travis.properties/' launch.sh "
- CMD5="&& cd ../../ && mvn clean install -DskipTests -DskipITs -Dcobertura.skip=true "
- CMD6=" -Dpmd.skip=true -Dfindbugs.skip=true "
- CMD7=" -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dxml.skip=true"
- CMD8="&& cd contribution/checkstyle-tester "
- CMD9="&& ./launch.sh -Dcheckstyle.config.location=checks-nonjavadoc-error.xml"
- CMD=$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9
- COVERAGE_CMD=""
# NoExceptionTest - Pmd,elasticsearch,lombok-ast (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NoExceptionTest - Pmd,elasticsearch,lombok-ast"
- CMD1="git clone https://github.com/checkstyle/contribution && cd contribution/checkstyle-tester "
- CMD2="&& sed -i.'' 's/^guava/#guava/' projects-for-travis.properties "
- CMD3="&& sed -i.'' 's/#pmd/pmd/' projects-for-travis.properties "
- CMD4="&& sed -i.'' 's/#elasticsearch/elasticsearch/' projects-for-travis.properties "
- CMD5="&& sed -i.'' 's/#lombok-ast/lombok-ast/' projects-for-travis.properties "
- CMD6="&& sed -i.'' 's/projects-to-test-on.properties/projects-for-travis.properties/' launch.sh "
- CMD7="&& cd ../../ && mvn clean install -DskipTests -DskipITs -Dcobertura.skip=true "
- CMD8=" -Dpmd.skip=true -Dfindbugs.skip=true "
- CMD9=" -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dxml.skip=true"
- CMD10="&& cd contribution/checkstyle-tester "
- CMD11="&& ./launch.sh -Dcheckstyle.config.location=checks-nonjavadoc-error.xml"
- CMD=$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9$CMD10$CMD11
- COVERAGE_CMD=""
# NoExceptionTest - RxJava,java-design-patterns,MaterialDesignLibrary,apache-ant,apache-jsecurity,android-launcher (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NoExceptionTest - RxJava,java-design-patterns,MaterialDesignLibrary,apache-ant,apache-jsecurity,android-launcher"
- CMD01="git clone https://github.com/checkstyle/contribution && cd contribution/checkstyle-tester "
- CMD02="&& sed -i.'' 's/^guava/#guava/' projects-for-travis.properties "
- CMD03="&& sed -i.'' 's/#RxJava/RxJava/' projects-for-travis.properties "
- CMD04="&& sed -i.'' 's/#java-design-patterns/java-design-patterns/' projects-for-travis.properties "
- CMD05="&& sed -i.'' 's/#MaterialDesignLibrary/MaterialDesignLibrary/' projects-for-travis.properties "
- CMD06="&& sed -i.'' 's/#apache-ant/apache-ant/' projects-for-travis.properties "
- CMD07="&& sed -i.'' 's/#apache-jsecurity/apache-jsecurity/' projects-for-travis.properties "
- CMD08="&& sed -i.'' 's/#android-launcher/android-launcher/' projects-for-travis.properties "
- CMD09="&& sed -i.'' 's/projects-to-test-on.properties/projects-for-travis.properties/' launch.sh "
- CMD10="&& cd ../../ && mvn clean install -DskipTests -DskipITs -Dcobertura.skip=true "
- CMD11=" -Dpmd.skip=true -Dfindbugs.skip=true "
- CMD12=" -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dxml.skip=true"
- CMD13="&& cd contribution/checkstyle-tester "
- CMD14="&& ./launch.sh -Dcheckstyle.config.location=checks-nonjavadoc-error.xml"
- CMD=$CMD01$CMD02$CMD03$CMD04$CMD05$CMD06$CMD07$CMD08$CMD09$CMD10$CMD11$CMD12$CMD13$CMD14
- COVERAGE_CMD=""
# NoExceptionTest - Spring (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NoExceptionTest - Spring"
- CMD1="git clone https://github.com/checkstyle/contribution && cd contribution/checkstyle-tester"
- CMD2=" && sed -i.'' 's/^guava/#guava/' projects-for-travis.properties "
- CMD3=" && sed -i.'' 's/#spring-framework/spring-framework/' projects-for-travis.properties "
- CMD4=" && sed -i.'' 's/projects-to-test-on.properties/projects-for-travis.properties/' launch.sh "
- CMD5=" && cd ../../ && mvn clean install -DskipTests -DskipITs -Dcobertura.skip=true "
- CMD6=" -Dpmd.skip=true -Dfindbugs.skip=true "
- CMD7=" -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dxml.skip=true"
- CMD8=" && cd contribution/checkstyle-tester "
- CMD9=" && ./launch.sh -Dcheckstyle.config.location=checks-nonjavadoc-error.xml"
- CMD=$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9
- COVERAGE_CMD=""
# NoExceptionTest - Hbase (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="NoExceptionTest - Hbase"
- CMD1="git clone https://github.com/checkstyle/contribution && cd contribution/checkstyle-tester "
- CMD2="&& sed -i.'' 's/^guava/#guava/' projects-for-travis.properties "
- CMD3="&& sed -i.'' 's/#Hbase/Hbase/' projects-for-travis.properties "
- CMD4="&& sed -i.'' 's/projects-to-test-on.properties/projects-for-travis.properties/' launch.sh "
- CMD5="&& cd ../../ && mvn clean install -DskipTests -DskipITs -Dcobertura.skip=true "
- CMD6=" -Dpmd.skip=true -Dfindbugs.skip=true "
- CMD7=" -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dxml.skip=true"
- CMD8="&& cd contribution/checkstyle-tester "
- CMD9="&& ./launch.sh -Dcheckstyle.config.location=checks-nonjavadoc-error.xml"
- CMD=$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9
- COVERAGE_CMD=""
- CMD="./.ci/travis/travis.sh no-exception-test-guava-with-google-checks"
# release dry run (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="release dry run"
- CMD1="mvn release:prepare -DdryRun=true --batch-mode -Darguments='-DskipTests -DskipITs "
- CMD2=" -Dcobertura.skip=true -Dpmd.skip=true -Dfindbugs.skip=true -Dxml.skip=true"
- CMD3=" -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dgpg.skip=true'"
- CMD=$CMD1$CMD2$CMD3
- COVERAGE_CMD=""
- CMD="./.ci/travis/travis.sh release-dry-run"
# unit tests in German locale (oraclejdk8)
- jdk: oraclejdk8
env: DESC="tests de" CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=de -Duser.country=DE'" COVERAGE_CMD=""
# unit tests in Spanish locale (oraclejdk8)
- jdk: oraclejdk8
env: DESC="tests es" CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=es -Duser.country=ES'" COVERAGE_CMD=""
# unit tests in Finnish locale (oraclejdk8)
- jdk: oraclejdk8
env: DESC="tests fi" CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=fi -Duser.country=FI'" COVERAGE_CMD=""
# unit tests in French locale (oraclejdk8)
- jdk: oraclejdk8
env: DESC="tests fr" CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=fr -Duser.country=FR'" COVERAGE_CMD=""
# unit tests in Chinese locale (oraclejdk8)
- jdk: oraclejdk8
env: DESC="tests zh" CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=zh -Duser.country=CN'" COVERAGE_CMD=""
# unit tests in Japanese locale (oraclejdk8)
- jdk: oraclejdk8
env: DESC="tests ja" CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=ja -Duser.country=JP'" COVERAGE_CMD=""
# unit tests in Portuguese locale (oraclejdk8)
- jdk: oraclejdk8
env: DESC="tests pt" CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=pt -Duser.country=PT'" COVERAGE_CMD=""
# unit tests in Turkish locale (oraclejdk8)
- jdk: oraclejdk8
env: DESC="tests tr" CMD="mvn clean integration-test failsafe:verify -DargLine='-Duser.language=tr -Duser.country=TR'" COVERAGE_CMD=""
# Check the chmod on files.
- env:
- DESC="check permissions on all files"
- CMD="./.ci/travis/travis.sh check-chmod"
# No java8 support on Travis for MacOS
# Config is disabled till https://github.com/travis-ci/travis-ci/issues/2317
# MacOS verify (till cache is not working, we can not do verify)
#- os: osx
# env:
# - DESC="MacOS verify, site, assembly"
# - CMD="export JAVA_HOME=$(/usr/libexec/java_home) && mvn package -Dlinkcheck.skip=true && mvn package -Passembly "
# - COVERAGE_CMD=""
# Releasenotes generation - validaton
# Ensure that all Sevntu check are kused
- jdk: oraclejdk8
env:
- DESC="Releasenotes generation"
- CMD0="if [[ $TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi "
- CMD1=" && git clone https://github.com/checkstyle/contribution && cd contribution/releasenotes-builder "
- CMD2=" && mvn clean compile package "
- CMD3=" && cd ../../ && git clone https://github.com/checkstyle/checkstyle && cd checkstyle "
- CMD4=" && LATEST_RELEASE_TAG=\$(git describe \$(git rev-list --tags --max-count=1)) && cd ../"
- CMD5=" && CS_RELEASE_VERSION=$(mvn -q -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec | sed 's/-SNAPSHOT//' ) "
- CMD6=" && echo LATEST_RELEASE_TAG=\$LATEST_RELEASE_TAG && echo CS_RELEASE_VERSION=\$CS_RELEASE_VERSION "
- CMD7=" && java -jar contribution/releasenotes-builder/target/releasenotes-builder-1.0-all.jar "
- CMD8=" -localRepoPath checkstyle -startRef \$LATEST_RELEASE_TAG -releaseNumber \$CS_RELEASE_VERSION -authToken $GITHUB_AUTH_TOKEN -generateAll -publishXdoc"
- CMD9=" && echo && echo =============================================="
- CMD10=" && echo xdoc && echo && cat xdoc.xml"
- CMD11=" && echo twitter post && echo && cat twitter.txt"
- CMD12=" && echo google plus post && echo && cat gplus.txt"
- CMD13=" && echo RSS post && echo && cat rss.txt"
- CMD14=" && echo mailing list post && echo && cat mailing_list.txt"
- CMD15=" && cd checkstyle/src/xdocs && echo releasenotes.xml after commit && echo && head -n 100 releasenotes.xml"
- CMD=$CMD0$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9$CMD10$CMD9$CMD11$CMD9$CMD12$CMD9$CMD13$CMD9$CMD14$CMD9$CMD15
- COVERAGE_CMD=""
- DESC="All sevntu checks should be used"
- CMD="./.ci/travis/travis.sh all-sevntu-checks"
# testing of PR format
- env:
- DESC="test Issue ref in PR description"
- CMD_="set -e"
- CMD0=" && if [[ ! $TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then exit 0; fi "
- CMD1=" && LINK_COMMITS=https://api.github.com/repos/checkstyle/checkstyle/pulls/$TRAVIS_PULL_REQUEST/commits "
- CMD2=" && COMMITS=\$(curl -s -H 'Authorization: token $GITHUB_AUTH_TOKEN' \$LINK_COMMITS | jq '.[0] | .commit.message') "
- CMD3=" && echo 'Messages from github:'\${COMMITS:0:60}... "
- CMD4=" && ISSUE_NUMBER=\$( echo \$COMMITS | sed -e 's/^.*Issue //' | sed -e 's/:.*//') "
- CMD5=" && echo 'Issue number:'\$ISSUE_NUMBER && RESULT=0"
- CMD6=" && if [[ \$ISSUE_NUMBER =~ ^#[0-9]+$ ]]; then "
- CMD7=" LINK_PR=https://api.github.com/repos/checkstyle/checkstyle/pulls/$TRAVIS_PULL_REQUEST "
- CMD8=" && LINK_ISSUE=https://api.github.com/repos/checkstyle/checkstyle/issues/\${ISSUE_NUMBER:1} "
- CMD9=" && REGEXP=(\$ISSUE_NUMBER\|https://github.com/checkstyle/checkstyle/issues/\${ISSUE_NUMBER:1})"
- CMD10=" && PR_DESC=\$(curl -s -H 'Authorization: token $GITHUB_AUTH_TOKEN' \$LINK_PR | jq '.body' | grep -E \$REGEXP | cat ) "
- CMD11=" && echo 'PR Description grepped:'\${PR_DESC:0:80} "
- CMD12=" && if [[ -z \$PR_DESC ]]; then "
- CMD13=" echo 'Please put a reference of Issue to PR description, this will bind Issue and PR in Github' && RESULT=1; "
- CMD14=" fi "
- CMD15=" && LABEL_APRV=\$(curl -s -H 'Authorization: token $GITHUB_AUTH_TOKEN' \$LINK_ISSUE | jq '.labels [] | .name' | grep approved | cat | wc -l ) "
- CMD16=" && if [[ \$LABEL_APRV == 0 ]]; then "
- CMD17=" echo 'You provide PR to Issue that is not approved yes, please ask admins to approve your issue first' && RESULT=1; "
- CMD18=" fi "
- CMD19=" fi "
- CMD20=" && if [[ \$RESULT == 0 ]]; then "
- CMD21=" echo 'PR validation succeed.'; "
- CMD22=" else "
- CMD23=" echo 'PR validation failed.' && false; "
- CMD24=" fi "
- CMD=$CMD_$CMD0$CMD1$CMD2$CMD3$CMD4$CMD5$CMD6$CMD7$CMD8$CMD9$CMD10$CMD11$CMD12$CMD13$CMD14$CMD15
- CMD=$CMD$CMD16$CMD17$CMD18$CMD19$CMD20$CMD21$CMD22$CMD23$CMD24
- COVERAGE_CMD=""
# MacOS verify (till cache is not working, we can not do verify)
- os: osx
env:
- DESC="MacOS verify, site, assembly"
- CMD="export JAVA_HOME=$(/usr/libexec/java_home) && mvn package -Dlinkcheck.skip=true && mvn package -Passembly "
# https://sonarqube.com (oraclejdk8)
- jdk: oraclejdk8
env:
- DESC="sonarqube.com"
- CMD="./.ci/travis/travis.sh sonarqube"
script: eval $CMD
script:
- SKIP_FILES=".github|appveyor.yml|circle.yml|distelli-manifest.yml|fast-forward-merge.sh|LICENSE|LICENSE.apache20|README.md|release.sh|RIGHTS.antlr|shippable.yml|wercker.yml"
- SKIP_CI=$(if [[ $(git diff --name-only HEAD HEAD~1 | grep -vE "$SKIP_FILES" | cat | wc -c) > 0 ]]; then echo false; else echo true; fi;)
- echo "SKIP_CI="$SKIP_CI
- >-
if [[ $SKIP_CI == 'false' ]];
then
eval $CMD;
echo "CMD is finished";
fi
after_success:
- eval $COVERAGE_CMD
- >-
if [[ -n $CMD_AFTER_SUCCESS
&& $SKIP_CI == 'false'
]];
then
eval $CMD_AFTER_SUCCESS;
echo "CMD_AFTER_SUCCESS is finished";
fi
- >-
if [[ $TRAVIS_REPO_SLUG == 'checkstyle/checkstyle'
&& $TRAVIS_BRANCH == 'master'
&& $TRAVIS_PULL_REQUEST == 'false'
&& $DEPLOY == 'true'
&& $SKIP_CI == 'false'
]];
then
mvn -s config/deploy-settings.xml deploy \
-DskipTests -DskipITs -Dpmd.skip=true -Dfindbugs.skip=true \
-Dcobertura.skip=true -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dxml.skip=true ;
mvn -s config/deploy-settings.xml -Pno-validations deploy;
echo "deploy to maven snapshot repository is finished";
fi

38
LICENSE
View File

@ -2,13 +2,13 @@
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
(This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
the version number 2.1.)
Preamble
@ -55,7 +55,7 @@ modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
@ -111,7 +111,7 @@ modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
@ -158,7 +158,7 @@ Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
@ -267,7 +267,7 @@ Library will still fall under Section 6.)
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
@ -329,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
@ -422,7 +422,7 @@ conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
@ -456,7 +456,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
@ -470,8 +470,8 @@ safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
{description}
Copyright (C) {year} {fullname}
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -485,7 +485,8 @@ convey the exclusion of warranty; and each file should have at least the
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
Also add information on how to contact you by electronic and paper mail.
@ -494,9 +495,10 @@ school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
library `Frob' (a library for tweaking knobs) written by James Random
Hacker.
<signature of Ty Coon>, 1 April 1990
{signature of Ty Coon}, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -4,6 +4,7 @@
[![][codeship img]][codeship]
[![][circleci img]][circleci]
[![][wercker img]][wercker]
[![][shippable img]][shippable]
[![][coverage img]][coverage]
[![][mavenbadge img]][mavenbadge]
@ -111,3 +112,7 @@ directory.
[wercker]: https://app.wercker.com/project/bykey/cd383127330ff96f89f1a78e8fd1a557
[wercker img]: https://app.wercker.com/status/cd383127330ff96f89f1a78e8fd1a557/s/master
[shippable]: https://app.shippable.com/projects/577032be3be4f4faa56adb38
[shippable img]: https://img.shields.io/shippable/577032be3be4f4faa56adb38/master.svg?label=shippable

View File

@ -12,7 +12,7 @@ init:
install:
- ps: |
Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\maven" )) {
if (!(Test-Path -Path "C:\maven\apache-maven-3.2.5" )) {
(new-object System.Net.WebClient).DownloadFile(
'http://www.us.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip',
'C:\maven-bin.zip'
@ -27,7 +27,7 @@ install:
- cmd: '%CYG_BIN% -qnNdO -R %CYG_ROOT% -s %CYG_MIRROR% -l %CYG_CACHE% -P hg'
cache:
- C:\maven\
- C:\maven\apache-maven-3.2.5
- C:\Users\appveyor\.m2
- C:\cygwin\var\cache\setup
@ -64,7 +64,7 @@ environment:
# site, without verify
- JAVA_HOME: C:\Program Files\Java\jdk1.8.0
DESC: "site, without verify"
CMD1: "mvn -e -Psite-only site"
CMD1: "mvn -e -Pno-validations site"
build_script:
- ps: >

View File

@ -2,45 +2,49 @@ checkout:
post:
- git clone https://github.com/checkstyle/contribution
dependencies:
cache_directories:
- groovy-2.4.7
pre:
- if [ ! -d groovy-2.4.7 ]; then wget https://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.7.zip && unzip apache-groovy-binary-2.4.7.zip; fi
# we to override as 'mvn dependecy:go-ofline' does not download all dependencies
override:
- mvn install -Passembly
- mvn install -Pno-validations
- eval $TESTER_DEPENDENCIES
machine:
java:
version: oraclejdk8
environment:
CMD1: "cd contribution/checkstyle-tester"
DEP1: " && sed -i.'' 's/^guava/#guava/' projects-to-test-on.properties"
DEP1: " && sed -i'' 's/^guava/#guava/' projects-to-test-on.properties"
# we need this to let pass 'mvn site' on no-projects mode to download all dependecies
DEP2: " && echo 'class ClassEmpty{}' > src/main/java/EmptyClass.java"
DEP3: " && ./launch.sh -Dcheckstyle.config.location=my_check.xml"
DEP3: " && /home/ubuntu/checkstyle/groovy-2.4.7/bin/groovy launch.groovy --listOfProjects projects-to-test-on.properties --config my_check.xml"
TESTER_DEPENDENCIES: $CMD1$DEP1$DEP2$DEP3
CMD2: " && sed -i.'' 's/^openjdk/#openjdk/' projects-for-circle.properties"
CMD3: " && sed -i.'' s/projects-to-test-on.properties/projects-for-circle.properties/ launch.sh"
CMD4: " && ./launch.sh -Dcheckstyle.config.location=checks-nonjavadoc-error.xml"
OPENJDK7: " && sed -i.'' 's/#openjdk7/openjdk7/' projects-for-circle.properties"
OPENJDK8: " && sed -i.'' 's/#openjdk8/openjdk8/' projects-for-circle.properties"
OPENJDK9: " && sed -i.'' 's/#openjdk9/openjdk9/' projects-for-circle.properties"
INFINISPAN: " && sed -i.'' 's/#infinispan/infinispan/' projects-for-circle.properties"
PROTONPACK: " && sed -i.'' 's/#protonpack/protonpack/' projects-for-circle.properties"
JOOL: " && sed -i.'' 's/#jOOL/jOOL/' projects-for-circle.properties"
TAPESTRY: " && sed -i.'' 's/#tapestry5/tapestry5/' projects-for-circle.properties"
COMMONS: " && sed -i.'' 's/#apache-commons/apache-commons/' projects-for-circle.properties"
LUCENE: " && sed -i.'' 's/#lucene-solr/lucene-solr/' projects-for-circle.properties"
STORM: " && sed -i.'' 's/#storm/storm/' projects-for-circle.properties"
HADOOP: " && sed -i.'' 's/#hadoop/hadoop/' projects-for-circle.properties"
CASSANDRA: " && sed -i.'' 's/#cassandra/cassandra/' projects-for-circle.properties"
SCOUTER: " && sed -i.'' 's/#scouter/scouter/' projects-for-circle.properties"
GROOVY: " && sed -i.'' 's/#groovy/groovy/' projects-for-circle.properties"
CMD2: " && sed -i'' 's/^openjdk/#openjdk/' projects-for-circle.properties"
CMD3: " && /home/ubuntu/checkstyle/groovy-2.4.7/bin/groovy launch.groovy --listOfProjects projects-for-circle.properties --config checks-nonjavadoc-error.xml"
OPENJDK7: " && sed -i'' 's/#openjdk7/openjdk7/' projects-for-circle.properties"
OPENJDK8: " && sed -i'' 's/#openjdk8/openjdk8/' projects-for-circle.properties"
OPENJDK9: " && sed -i'' 's/#openjdk9/openjdk9/' projects-for-circle.properties"
INFINISPAN: " && sed -i'' 's/#infinispan/infinispan/' projects-for-circle.properties"
PROTONPACK: " && sed -i'' 's/#protonpack/protonpack/' projects-for-circle.properties"
JOOL: " && sed -i'' 's/#jOOL/jOOL/' projects-for-circle.properties"
TAPESTRY: " && sed -i'' 's/#tapestry5/tapestry5/' projects-for-circle.properties"
COMMONS: " && sed -i'' 's/#apache-commons/apache-commons/' projects-for-circle.properties"
LUCENE: " && sed -i'' 's/#lucene-solr/lucene-solr/' projects-for-circle.properties"
STORM: " && sed -i'' 's/#storm/storm/' projects-for-circle.properties"
HADOOP: " && sed -i'' 's/#hadoop/hadoop/' projects-for-circle.properties"
CASSANDRA: " && sed -i'' 's/#cassandra/cassandra/' projects-for-circle.properties"
SCOUTER: " && sed -i'' 's/#scouter/scouter/' projects-for-circle.properties"
GROOVY: " && sed -i'' 's/#groovy/groovy/' projects-for-circle.properties"
# Test over openjdk7,8
TEST_1: $CMD1$CMD2$OPENJDK7$OPENJDK8$CMD3$CMD4
TEST_1: $CMD1$CMD2$OPENJDK7$OPENJDK8$CMD3
# Test over infinispan, protonpack, jOOL, lucene-solr, openjdk9
TEST_2: $CMD1$CMD2$INFINISPAN$PROTONPACK$JOOL$LUCENE$OPENJDK9$CMD3$CMD4
TEST_2: $CMD1$CMD2$INFINISPAN$PROTONPACK$JOOL$LUCENE$OPENJDK9$CMD3
# Test over tapestry5, storm, cassandra
TEST_3: $CMD1$CMD2$TAPESTRY$STORM$CASSANDRA$CMD3$CMD4
TEST_3: $CMD1$CMD2$TAPESTRY$STORM$CASSANDRA$CMD3
# Test over apache-commons, hadoop, scouter, groovy
TEST_4: $CMD1$CMD2$COMMONS$HADOOP$SCOUTER$GROOVY$CMD3$CMD4
TEST_4: $CMD1$CMD2$COMMONS$HADOOP$SCOUTER$GROOVY$CMD3
test:
override:
- case $CIRCLE_NODE_INDEX in 0) eval $TEST_1 ;; 1) eval $TEST_2 ;; 2) eval $TEST_3 ;; 3) eval $TEST_4 ;; esac:

View File

@ -12,8 +12,6 @@
classpath="${mvn.runtime_classpath}"
/>
<delete file="${mvn.project.build.directory}/cachefile" />
<property name="checkstyle.pattern.todo" value="NOTHingWillMatCH_-"/>
<property name="check.config" location="config/checkstyle_checks.xml"/>

View File

@ -20,7 +20,6 @@
classname="com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask">
<classpath refid="run.classpath"/>
</taskdef>
<delete file="${target.dir}/cachefile" />
<property name="checkstyle.pattern.todo" value="NOTHingWillMatCH_-"/>
<property name="check.config" location="config/checkstyle_checks.xml"/>

View File

@ -14,9 +14,16 @@
<metadata name="com.atlas-sw.eclipse" value="I like Sydney"/>
<property name="cacheFile" value="${checkstyle.cache.file}"/>
<property name="severity" value="error"/>
<property name="fileExtensions" value="java, properties, xml, g, g4"/>
<property name="fileExtensions" value="java, properties, xml, vm, g, g4"/>
<!-- BeforeExecutionFileFilters is required for sources that are based on java9 -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$" />
</module>
<!-- Filters -->
<module name="SeverityMatchFilter">
@ -128,8 +135,14 @@
<!-- Annotations -->
<module name="AnnotationLocation">
<property name="tokens" value="ANNOTATION_DEF"/>
<property name="tokens" value="ANNOTATION_FIELD_DEF"/>
<property name="allowSamelineSingleParameterlessAnnotation" value="false"/>
</module>
<module name="AnnotationLocation">
<property name="tokens" value="PARAMETER_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="AnnotationUseStyle"/>
<module name="MissingDeprecated"/>
<module name="MissingOverride">
@ -144,6 +157,10 @@
<property name="allowInSwitchCase" value="true"/>
</module>
<module name="EmptyBlock">
<property name="tokens" value="LITERAL_CATCH"/>
<property name="tokens" value="ARRAY_INIT"/>
<property name="tokens" value="LITERAL_DEFAULT"/>
<property name="tokens" value="LITERAL_CASE"/>
<property name="option" value="text"/>
</module>
<module name="EmptyCatchBlock"/>
@ -151,17 +168,28 @@
<property name="maxLineLength" value="100"/>
</module>
<module name="NeedBraces"/>
<module name="NeedBraces">
<property name="tokens" value="LAMBDA"/>
<property name="allowSingleLineStatement" value="true"/>
</module>
<module name="RightCurly">
<property name="tokens" value="METHOD_DEF"/>
<property name="tokens" value="CTOR_DEF"/>
<property name="tokens" value="CLASS_DEF"/>
<property name="tokens" value="INSTANCE_INIT"/>
<property name="tokens" value="LITERAL_FOR"/>
<property name="tokens" value="STATIC_INIT"/>
<property name="tokens" value="LITERAL_WHILE"/>
<property name="option" value="alone"/>
</module>
<module name="RightCurly">
<property name="tokens" value="LITERAL_DO"/>
<property name="option" value="same"/>
</module>
<!-- Class Design -->
<module name="DesignForExtension">
<!--
We should postpone DesignForExtension Check enforcement till next major release
as it will seriously brake backward compatibility with existing usage of our library
-->
<property name="severity" value="ignore"/>
<property name="ignoredAnnotations" value="Override, Test, Before, After, BeforeClass, AfterClass"/>
</module>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
@ -196,7 +224,12 @@
</module>
<module name="IllegalInstantiation"/>
<module name="IllegalThrows"/>
<module name="IllegalToken"/>
<module name="IllegalToken">
<property name="tokens" value="LABELED_STAT"/>
<property name="tokens" value="LITERAL_NATIVE"/>
<property name="tokens" value="LITERAL_VOLATILE"/>
<property name="tokens" value="LITERAL_ASSERT"/>
</module>
<module name="IllegalTokenText"/>
<module name="IllegalType"/>
<module name="InnerAssignment"/>
@ -242,16 +275,17 @@
<module name="AvoidStaticImport"/>
<module name="CustomImportOrder">
<property name="customImportOrderRules" value="STATIC###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS"/>
<property name="specialImportsRegExp" value="org"/>
<property name="specialImportsRegExp" value="^org\."/>
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
</module>
<module name="IllegalImport"/>
<module name="ImportControl">
<property name="file" value="${checkstyle.importcontrol.file}"/>
<property name="path" value="^.*[\\/]src[\\/]main[\\/].*$"/>
</module>
<module name="ImportOrder">
<property name="groups" value="/^javax?\./,org"/>
<property name="groups" value="/^java\./,javax,org"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="option" value="top"/>
@ -342,7 +376,7 @@
<!-- Naming Conventions -->
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
<property name="allowedAbbreviationLength" value="0"/>
<property name="allowedAbbreviations" value="AST"/>
</module>
<module name="AbstractClassName"/>
@ -422,7 +456,33 @@
<property name="tokens" value="DOT"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="OperatorWrap"/>
<module name="OperatorWrap">
<property name="tokens" value="QUESTION"/>
<property name="tokens" value="COLON"/>
<property name="tokens" value="EQUAL"/>
<property name="tokens" value="NOT_EQUAL"/>
<property name="tokens" value="DIV"/>
<property name="tokens" value="PLUS"/>
<property name="tokens" value="MINUS"/>
<property name="tokens" value="STAR"/>
<property name="tokens" value="MOD"/>
<property name="tokens" value="SR"/>
<property name="tokens" value="BSR"/>
<property name="tokens" value="GE"/>
<property name="tokens" value="GT"/>
<property name="tokens" value="SL"/>
<property name="tokens" value="LE"/>
<property name="tokens" value="LT"/>
<property name="tokens" value="BXOR"/>
<property name="tokens" value="BOR"/>
<property name="tokens" value="LOR"/>
<property name="tokens" value="BAND"/>
<property name="tokens" value="LAND"/>
<property name="tokens" value="TYPE_EXTENSION_AND"/>
<property name="tokens" value="LITERAL_INSTANCEOF"/>
<property name="tokens" value="METHOD_REF"/>
<property name="option" value="nl"/>
</module>
<module name="OperatorWrap">
<property name="tokens" value="ASSIGN"/>
<property name="tokens" value="DIV_ASSIGN"/>
@ -441,10 +501,15 @@
<module name="ParenPad"/>
<module name="SeparatorWrap">
<property name="tokens" value="DOT"/>
<property name="tokens" value="AT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="tokens" value="COMMA"/>
<property name="tokens" value="RBRACK"/>
<property name="tokens" value="ARRAY_DECLARATOR"/>
<property name="tokens" value="ELLIPSIS"/>
<property name="tokens" value="SEMI"/>
<property name="option" value="EOL"/>
</module>
<module name="SingleSpaceSeparator">

View File

@ -7,6 +7,9 @@
<module name="Checker">
<!-- All checks are from https://github.com/sevntu-checkstyle/sevntu.checkstyle project -->
<!-- Hard coded until https://issues.apache.org/jira/browse/MCHECKSTYLE-332 is released. -->
<property name="cacheFile" value="target/cachefile-sevntu"/>
<!-- Filters -->
<module name="SuppressionFilter">
<property name="file" value="${project.basedir}/config/sevntu_suppressions.xml"/>
@ -92,8 +95,6 @@
<property name="checkReadObjectMethod" value="true"/>
<property name="matchMethodsByArgCount" value="true"/>
</module>
<!--commented till https://github.com/sevntu-checkstyle/sevntu.checkstyle/issues/410-->
<!--<module name="AvoidModifiersForTypes"/>-->
<module name="ForbidAnnotation">
<property name="annotationNames" value="Ignore, VisibleForTesting"/>
<property name="annotationTargets" value="METHOD_DEF"/>
@ -120,7 +121,10 @@
<module name="ForbidCertainImports">
<property name="packageNameRegexp" value=".+\.checkstyle\.api.*|.+\.checkstyle\.utils.*"/>
<property name="forbiddenImportsRegexp" value=".+\.checks\..+"/>
<property name="forbiddenImportsExcludesRegexp" value=""/>
<!-- AccessModifier is in util package (should be moved to api package) to disallow
its usage by API clients till https://github.com/checkstyle/checkstyle/issues/3511-->
<property name="forbiddenImportsExcludesRegexp"
value="^com.puppycrawl.tools.checkstyle.checks.naming.AccessModifier$"/>
</module>
<module name="LineLengthExtended">
<property name="max" value="100"/>
@ -174,5 +178,17 @@
<module name="SingleBreakOrContinueCheck"/>
<module name="NumericLiteralNeedsUnderscoreCheck"/>
<module name="UniformEnumConstantNameCheck" />
<module name="ForbidAnnotationElementValueCheck" />
<module name="HideUtilityClassConstructorCheck" />
<module name="AvoidModifiersForTypesCheck">
<property name="forbiddenClassesRegexpProtected" value="Logger"/>
<property name="forbiddenClassesRegexpPublic" value="Logger"/>
<property name="forbiddenClassesRegexpPackagePrivate" value="Logger"/>
</module>
<module name="ConstructorWithoutParamsCheck">
<property name="classNameFormat" value=".*Exception$"/>
<property name="ignoredClassNameFormat" value="UnsupportedOperationException"/>
</module>
<module name="ReturnCountExtendedCheck" />
</module>
</module>

View File

@ -66,7 +66,7 @@
</Or>
</Match>
<Match>
<!-- till SonarQube update Checkstyle version. Support both getFileName() and getFilename() -->
<!-- till https://github.com/checkstyle/checkstyle/issues/3666 -->
<and>
<Class name="com.puppycrawl.tools.checkstyle.api.FileContents" />
<Method name="~setFile[nN]ame" />
@ -108,8 +108,14 @@
<Match>
<!-- Temporary disabled. Have to deal with Javadoc nodes as well
See https://github.com/checkstyle/checkstyle/issues/3432-->
<Class name="com.puppycrawl.tools.checkstyle.gui.JTreeTable" />
<Class name="com.puppycrawl.tools.checkstyle.gui.TreeTable" />
<Method name="makeCodeSelection"/>
<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
</Match>
<Match>
<!-- Until https://github.com/checkstyle/checkstyle/issues/3573 -->
<Class name="com.puppycrawl.tools.checkstyle.checks.FileContentsHolder" />
<Method name="beginTree"/>
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
</Match>
</FindBugsFilter>

View File

@ -1,29 +1,35 @@
<?xml version="1.0"?>
<!DOCTYPE import-control PUBLIC
"-//Puppy Crawl//DTD Import Control 1.1//EN"
"http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
"-//Puppy Crawl//DTD Import Control 1.2//EN"
"http://checkstyle.sourceforge.net/dtds/import_control_1_2.dtd">
<import-control pkg="com.puppycrawl.tools.checkstyle">
<allow pkg="antlr"/>
<allow pkg="org.antlr.v4.runtime"/>
<allow pkg="com.puppycrawl.tools.checkstyle.api"/>
<allow pkg="com.puppycrawl.tools.checkstyle.checks"/>
<allow pkg="java.io"/>
<allow pkg="java.net"/>
<allow pkg="java.nio"/>
<allow pkg="java.util"/>
<allow pkg="javax.xml.parsers"/>
<allow pkg="org.apache.commons.beanutils"/>
<allow pkg="org.apache.commons.logging"/>
<allow pkg="org.xml.sax"/>
<allow pkg="com.puppycrawl.tools.checkstyle"/>
<allow pkg="java.lang.reflect"/>
<!-- The local ones -->
<allow pkg="java.lang.reflect" local-only="true" />
<allow pkg="java.nio" local-only="true" />
<allow class="java.security.MessageDigest" local-only="true"/>
<allow class="java.security.NoSuchAlgorithmException" local-only="true"/>
<allow class="javax.xml.bind.DatatypeConverter" local-only="true"/>
<allow pkg="com.puppycrawl.tools.checkstyle.utils" local-only="true"/>
<allow pkg="com.puppycrawl.tools.checkstyle.grammars" local-only="true"/>
<allow pkg="org.apache.commons.cli" local-only="true"/>
<allow pkg="org.antlr.v4.runtime" local-only="true"/>
<allow class="com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.+"
local-only="true" regex="true"/>
<!-- allowed till https://github.com/checkstyle/checkstyle/issues/3455 -->
<allow class="com.google.common.base.CaseFormat" local-only="true"/>
<allow class="com.google.common.io.Closeables" local-only="true"/>
<allow class="com.google.common.io.Flushables" local-only="true"/>
@ -31,107 +37,110 @@
<allow class="com.google.common.collect.ImmutableCollection" local-only="true"/>
<allow class="com.google.common.collect.ImmutableList" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMap" local-only="true"/>
<allow class="com.google.common.collect.MapDifference" local-only="true"/>
<allow class="com.google.common.collect.Maps" local-only="true"/>
<allow class="com.google.common.collect.Multimap" local-only="true"/>
<allow pkg="com.puppycrawl.tools.checkstyle.grammars" local-only="true"/>
<allow pkg="org.apache.commons.cli" local-only="true"/>
<allow class="com.google.common.io.ByteStreams" local-only="true"/>
<subpackage name="utils">
<allow pkg="java.lang.reflect" local-only="true" />
<allow pkg="java.nio" local-only="true" />
<!-- allowed till https://github.com/checkstyle/checkstyle/issues/3455 -->
<allow class="com.google.common.base.CharMatcher" local-only="true"/>
<allow class="com.google.common.collect.ImmutableCollection" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMap" local-only="true"/>
</subpackage>
<subpackage name="ant">
<allow class="com.google.common.io.Closeables" local-only="true"/>
<allow pkg="org.apache.tools.ant" local-only="true"/>
<allow pkg="com.puppycrawl.tools.checkstyle"/>
<disallow pkg="com.puppycrawl.tools.checkstyle.checks"/>
<disallow pkg="com.puppycrawl.tools.checkstyle.filters"/>
<disallow pkg="com.puppycrawl.tools.checkstyle.doclets"/>
<disallow pkg="com.puppycrawl.tools.checkstyle.gui"/>
<!-- allowed till https://github.com/checkstyle/checkstyle/issues/3455 -->
<allow class="com.google.common.io.Closeables" local-only="true"/>
</subpackage>
<subpackage name="api">
<allow pkg="com.puppycrawl.tools.checkstyle.grammars"/>
<allow pkg="java.beans"/>
<allow pkg="java.text"/>
<allow pkg="java.lang.reflect" local-only="true"/>
<allow pkg="java.nio.charset" local-only="true"/>
<allow class="java.beans.PropertyDescriptor" local-only="true"/>
<allow class="java.text.MessageFormat" local-only="true"/>
<allow class="com.puppycrawl.tools.checkstyle.grammars.CommentListener"
local-only="true"/>
<allow class="com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaTokenTypes"
local-only="true"/>
<allow class="com.puppycrawl.tools.checkstyle.Utils"
<!-- AccessModifier is in util package (should be moved to api package) to disallow
its usage by API clients till https://github.com/checkstyle/checkstyle/issues/3511-->
<allow class="com.puppycrawl.tools.checkstyle.checks.naming.AccessModifier"
local-only="true"/>
<allow pkg="org.antlr.v4.runtime" local-only="true"/>
<!-- allowed till https://github.com/checkstyle/checkstyle/issues/3455 -->
<allow class="com.google.common.io.Closeables" local-only="true"/>
<allow class="com.google.common.collect.ImmutableCollection" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMap" local-only="true"/>
<allow class="com.puppycrawl.tools.checkstyle.Checker" local-only="true"/>
<!-- allowed till https://github.com/checkstyle/checkstyle/issues/3817 -->
<allow pkg="com.puppycrawl.tools.checkstyle.utils"/>
</subpackage>
<subpackage name="checks">
<allow pkg="com.puppycrawl.tools.checkstyle.checks"/>
<allow class="com.puppycrawl.tools.checkstyle.Definitions"/>
<allow pkg="java.math"/>
<allow pkg="com.puppycrawl.tools.checkstyle.utils"/>
<allow class="java.nio.charset.StandardCharsets" local-only="true"/>
<allow class="com.puppycrawl.tools.checkstyle.Definitions" local-only="true"/>
<!-- allowed till https://github.com/checkstyle/checkstyle/issues/3455 -->
<allow class="com.google.common.io.Closeables" local-only="true"/>
<allow class="com.google.common.collect.HashMultiset" local-only="true"/>
<allow class="com.google.common.collect.HashMultimap" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMap" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMultiset" local-only="true"/>
<allow class="com.google.common.collect.Multimap" local-only="true"/>
<allow class="com.google.common.collect.Multiset" local-only="true"/>
<allow class="com.google.common.collect.Multiset.Entry" local-only="true"/>
<allow class="com.google.common.collect.SetMultimap" local-only="true"/>
<allow pkg="java.math"/>
<subpackage name="indentation">
<allow pkg="java.lang.reflect"/>
<allow class="com.google.common.collect.Range" local-only="true"/>
<allow class="com.google.common.collect.RangeMap" local-only="true"/>
</subpackage>
<subpackage name="header">
<allow class="java.nio.charset.Charset" local-only="true"/>
<!-- allowed till https://github.com/checkstyle/checkstyle/issues/3455 -->
<allow class="com.google.common.io.Closeables" local-only="true"/>
</subpackage>
<subpackage name="javadoc">
<allow pkg="com.puppycrawl.tools.checkstyle.grammars.javadoc"/>
<allow pkg="java.lang.reflect"/>
<allow class="com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser"
local-only="true"/>
<allow class="com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.+"
regex="true" local-only="true"/>
<!-- allowed till https://github.com/checkstyle/checkstyle/issues/3455 -->
<allow class="com.google.common.base.CharMatcher" local-only="true"/>
<allow class="com.google.common.collect.Multiset" local-only="true"/>
</subpackage>
<subpackage name="design">
<allow class="com.google.common.annotations.VisibleForTesting" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMap" local-only="true"/>
</subpackage>
<subpackage name="imports">
<allow class="com.google.common.collect.HashMultimap" local-only="true"/>
</subpackage>
<subpackage name="coding">
<allow class="com.google.common.collect.ImmutableCollection" local-only="true"/>
</subpackage>
</subpackage>
<subpackage name="doclets">
<allow class="java.nio.charset.StandardCharsets" local-only="true"/>
<allow pkg="com.sun.javadoc"/>
<disallow pkg="com.puppycrawl.tools.checkstyle.(checks|ant|filters|gui)" regex="true"/>
<disallow pkg="com\.puppycrawl\.tools\.checkstyle\.(checks|ant|filters|gui)" regex="true"/>
</subpackage>
<subpackage name="filters">
<allow pkg="java.lang.ref"/>
<allow class="com.google.common.io.Closeables" local-only="true"/>
<allow class="com.google.common.base.CaseFormat" local-only="true"/>
<allow class="com.google.common.collect.ImmutableCollection" local-only="true"/>
<allow class="com.google.common.collect.ImmutableMap" local-only="true"/>
<!-- is not possible till pkg is not a regexp -->
<!-- <disallow pkg="com.puppycrawl.tools.checkstyle.checks.*"/> -->
<disallow pkg="com.puppycrawl.tools.checkstyle.(ant|doclets|gui)" regex="true"/>
<allow class="java.lang.ref.WeakReference" local-only="true"/>
<disallow pkg="com\.puppycrawl\.tools\.checkstyle\.checks\.[^.]+" regex="true"/>
<allow pkg="com.puppycrawl.tools.checkstyle.utils"/>
</subpackage>
<subpackage name="gui">
<allow pkg="java.awt"/>
<allow pkg="javax.swing"/>
<disallow pkg="com.puppycrawl.tools.checkstyle.(checks|ant|doclets|filters)" regex="true"/>
</subpackage>
<subpackage name="internal">
<allow class="com.google.common.reflect.ClassPath" local-only="true"/>
<allow class="com.google.common.collect.FluentIterable" local-only="true"/>
<allow pkg="com.puppycrawl.tools.checkstyle.utils" local-only="true"/>
<allow class="com.puppycrawl.tools.checkstyle.TreeWalker" local-only="true"/>
<allow class="com.puppycrawl.tools.checkstyle.gui.MainFrameModel.ParseMode"
local-only="true"/>
<allow class="com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser" local-only="true"/>
</subpackage>
</import-control>

View File

@ -344,7 +344,7 @@
<inspection_tool class="CloneableImplementsClone" enabled="false" level="ERROR" enabled_by_default="false">
<option name="m_ignoreCloneableDueToInheritance" value="false" />
</inspection_tool>
<inspection_tool class="CodeBlock2Expr" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="CodeBlock2Expr" enabled="false" level="ERROR" enabled_by_default="true" />
<inspection_tool class="CoffeeScriptArgumentsOutsideFunction" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="CoffeeScriptFunctionSignatures" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="CoffeeScriptInfiniteLoop" enabled="true" level="ERROR" enabled_by_default="true" />
@ -1985,6 +1985,10 @@
<option value="MismatchedQueryAndUpdateOfCollection" />
<!-- Till https://github.com/checkstyle/checkstyle/issues/3066 -->
<option value="ProhibitedExceptionCaught" />
<!-- No way to split apart huge if/else branches in test. -->
<option value="IfStatementWithTooManyBranches" />
<!-- we have to catch Exception in Checker and rethrow it -->
<option value="ProhibitedExceptionThrown" />
</list>
</option>
</inspection_tool>

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -43,11 +43,18 @@
<property name="violationSuppressXPath" value="//MethodDeclaration[@Name='isNotRelevantSituation' and ../../..[@Image='WhitespaceAroundCheck']] | //MethodDeclaration[@Name='validateCli' and ../../..[@Image='Main']] | //ClassOrInterfaceDeclaration[@Image='JavadocMethodCheck' or @Image='JavadocStyleCheck']"/>
</properties>
</rule>
<rule ref="rulesets/java/codesize.xml/TooManyFields">
<properties>
<!-- Unable to split fields out of class. -->
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='Checker']"/>
</properties>
</rule>
<rule ref="rulesets/java/codesize.xml/TooManyMethods">
<properties>
<property name="maxmethods" value="20"/>
<!-- Reducing the number of methods requires making excess hierarchy or duplicating code, or making existing methods too complex. -->
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='RequireThisCheck']"/>
<!-- Reducing the number of methods in RequireThisCheck requires making excess hierarchy or duplicating code, or making existing methods too complex. -->
<!-- PackageObjectFactory has many boilerplate methods. -->
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='RequireThisCheck' or @Image='PackageObjectFactory']"/>
</properties>
</rule>
<rule ref="rulesets/java/codesize.xml/ExcessiveClassLength">
@ -93,8 +100,6 @@
<exclude name="OnlyOneReturn"/>
<!-- opposite to UnnecessaryConstructor -->
<exclude name="AtLeastOneConstructor"/>
<!-- deprecated by PMD -->
<exclude name="BooleanInversion"/>
<!-- that rule is too buggy, too much false positives-->
<exclude name="DataflowAnomalyAnalysis"/>
<!-- turning local variables to fields create design problems and extend scope of variable -->
@ -122,7 +127,7 @@
<properties>
<!-- TreeWalker integrates Checkstyle and antlr and CheckstyleAntTask integrates Checkstyle
with Ant. Checker collects external resource locations and setup configuration. -->
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='TreeWalker' or @Image='CheckstyleAntTask' or @Image='Checker']"/>
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='TreeWalker' or @Image='CheckstyleAntTask' or @Image='Checker' or @Image='Main']"/>
</properties>
</rule>
<rule ref="rulesets/java/coupling.xml/CouplingBetweenObjects">
@ -148,7 +153,7 @@
<rule ref="rulesets/java/design.xml/ConfusingTernary">
<properties>
<!-- false positives on IF_ELSE-IF-ELSE-IF -->
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='XMLLogger']//MethodDeclarator[@Image='isReference'] | //ClassOrInterfaceDeclaration[@Image='DetailAST']//MethodDeclarator[@Image='addPreviousSibling'] | //ClassOrInterfaceDeclaration[@Image='AnnotationLocationCheck']//MethodDeclarator[@Image='checkAnnotations'] | //ClassOrInterfaceDeclaration[@Image='PkgControl']//MethodDeclarator[@Image='checkAccess'] | //ClassOrInterfaceDeclaration[@Image='HandlerFactory']//MethodDeclarator[@Image='getHandler']"/>
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='XMLLogger']//MethodDeclarator[@Image='isReference'] | //ClassOrInterfaceDeclaration[@Image='DetailAST']//MethodDeclarator[@Image='addPreviousSibling'] | //ClassOrInterfaceDeclaration[@Image='AnnotationLocationCheck']//MethodDeclarator[@Image='checkAnnotations'] | //ClassOrInterfaceDeclaration[@Image='ImportControl']//MethodDeclarator[@Image='checkAccess'] | //ClassOrInterfaceDeclaration[@Image='HandlerFactory']//MethodDeclarator[@Image='getHandler']"/>
</properties>
</rule>
<rule ref="rulesets/java/design.xml/AccessorClassGeneration">
@ -182,10 +187,17 @@
<properties>
<!-- default is 3 but we try to use single point of exit from method and that require extra IFs -->
<property name="problemDepth" value="4"/>
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='ClassResolver']//MethodDeclarator[@Image='resolve']"/>
</properties>
</rule>
<rule ref="rulesets/java/empty.xml"/>
<rule ref="rulesets/java/empty.xml/EmptyCatchBlock">
<properties>
<property name="allowCommentedBlocks" value="true"/>
</properties>
</rule>
<rule ref="rulesets/java/finalizers.xml"/>
<rule ref="rulesets/java/imports.xml"/>
<rule ref="rulesets/java/javabeans.xml">
@ -210,12 +222,6 @@
</rule>
<rule ref="rulesets/java/migrating.xml"/>
<rule ref="rulesets/java/migrating.xml/JUnit4TestShouldUseTestAnnotation">
<properties>
<!-- False positive of PMD. Non-test methods can be named as 'test' -->
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='PackageObjectFactory']"/>
</properties>
</rule>
<rule ref="rulesets/java/naming.xml">
<!-- we use CheckstyleCustomShortVariable, to control lenght (will be fixed in PMD 5.4) and skip Override methods -->
@ -247,7 +253,7 @@
<rule ref="rulesets/java/naming.xml/AbstractNaming">
<properties>
<!-- We can not brake compatibility with previous versions -->
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='Check']"/>
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='Check' or @Image='AbstractClassNameCheck']"/>
</properties>
</rule>
<rule ref="rulesets/java/naming.xml/LongVariable">
@ -289,6 +295,13 @@
</rule>
<rule ref="rulesets/java/strings.xml"/>
<rule ref="rulesets/java/strings.xml/AvoidDuplicateLiterals">
<properties>
<!-- Annotations like '@SuppressWarnings' don't need to be checked, it is better to keep their strings
connected to the annotation instead of separating. -->
<property name="skipAnnotations" value="true"/>
</properties>
</rule>
<rule ref="rulesets/java/sunsecure.xml/MethodReturnsInternalArray">
<properties>
<!--It's not important when array is empty-->

View File

@ -28,24 +28,21 @@
files="AbstractCheckTest.java|AbstractClassNameCheckTest.java|AbstractTypeAwareCheckTest.java|AbstractJavadocCheckTest.java|AbstractViolationReporterTest.java"/>
<!-- Tone down the checking for test code -->
<suppress checks="CyclomaticComplexity" files="[\\/]XDocsPagesTest\.java"/>
<suppress checks="CyclomaticComplexity" files="[\\/]XdocsPagesTest\.java"/>
<suppress checks="IllegalCatch" files="[\\/]internal[\\/]\w+Util\.java"/>
<suppress checks="EmptyBlock" files=".*[\\/]src[\\/]test[\\/]"/>
<suppress checks="ImportControl" files=".*[\\/]src[\\/](test|it)[\\/]"/>
<suppress checks="Javadoc" files=".*[\\/]src[\\/](test|it)[\\/]"/>
<suppress checks="MagicNumber" files=".*[\\/]src[\\/](test|it)[\\/]"/>
<suppress checks="AvoidStaticImport" files=".*[\\/]src[\\/](test|it)[\\/]"/>
<suppress checks="MethodCount" files="[\\/]ImportOrderCheckTest.java$"/>
<suppress checks="MethodCount" files="[\\/]IndentationCheckTest.java$"/>
<suppress checks="ClassDataAbstractionCoupling" files="[\\/]IndentationCheckTest.java$"/>
<suppress checks="MethodCount" files="[\\/]JavadocMethodCheckTest.java$"/>
<suppress checks="MethodCount" files="[\\/]MainTest.java$"/>
<suppress checks="EqualsAvoidNull" files="[\\/]Int.*FilterTest.java$"/>
<suppress checks="VisibilityModifier" files="[\\/]BaseCheckTestSupport.java$"/>
<suppress checks="WriteTag" files=".*[\\/]src[\\/](test|it)[\\/]"/>
<suppress checks="MethodCount" files=".*[\\/]src[\\/](test|it)[\\/]"/>
<!--The Check generates too many violations, fixing them will make code unmanageable.-->
<suppress checks="MagicNumber" files="(ParseTreeTablePModel|MainFrame)\.java"/>
<suppress checks="MagicNumber" files="(ParseTreeTablePresentation|MainFrame)\.java"/>
<!-- Methods that build fake AST are very long-->
<suppress checks="MethodLength" files="src[\\/]test[\\/]java[\\/]com[\\/]puppycrawl[\\/]tools[\\/]checkstyle[\\/]grammars[\\/]comments[\\/]CommentsTest\.java"/>
@ -71,15 +68,18 @@
<suppress checks="MethodCount" files="[\\/]CommentsIndentationCheck.java$"/>
<!--VisibilityModifierCheck has 7 options which require 7 additional methods (setters)-->
<suppress checks="MethodCount" files="[\\/]VisibilityModifierCheck.java$"/>
<!--RequireThisCheck has a hierarchy of nested classes which contains a lot of methods. -->
<suppress checks="MethodCount" files="[\\/]RequireThisCheck.java$"/>
<!-- we need that set of converters -->
<suppress checks="ClassDataAbstractionCoupling" files="AutomaticBean\.java"/>
<!-- they are aggregators of logic, usage a several of classes are ok -->
<suppress checks="ClassDataAbstractionCoupling" files="(Checker|TreeWalker|Main|CheckstyleAntTask|JavadocDetailNodeParser)\.java"/>
<suppress checks="ClassDataAbstractionCoupling" files="(CheckerTest|TreeWalkerTest|BaseCheckTestSupport|XDocsPagesTest|CheckstyleAntTaskTest)\.java"/>
<suppress checks="ClassDataAbstractionCoupling" files="(CheckerTest|TreeWalkerTest|BaseCheckTestSupport|XdocsPagesTest|CheckstyleAntTaskTest)\.java"/>
<suppress checks="ClassDataAbstractionCoupling" files="PropertyCacheFile\.java"/>
<suppress checks="ClassFanOutComplexity" files="[\\/]Main\.java"/>
<!-- a lot of GUI elements is OK -->
<suppress checks="ClassDataAbstractionCoupling" files="(JTreeTable|MainFrame)\.java"/>
<suppress checks="ClassDataAbstractionCoupling" files="(TreeTable|MainFrame)\.java"/>
<!-- Should be fixed after moving https://github.com/sevntu-checkstyle/sevntu.checkstyle/blob/master/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java into the main repo -->
<suppress checks="ReturnCount" files="(ClassResolver|ConfigurationLoader|IndentationCheckTest)\.java"/>

View File

@ -6,7 +6,7 @@ checkstyle/checkstyle:
- sed -i.'' 's/^guava/#guava/' projects-for-travis.properties
- sed -i.'' 's/#spring-framework/spring-framework/' projects-for-travis.properties
- sed -i.'' 's/projects-to-test-on.properties/projects-for-travis.properties/' launch.sh
- cd ../../ && mvn clean install -DskipTests -DskipITs -Dcobertura.skip=true -Dpmd.skip=true -Dfindbugs.skip=true -Dcheckstyle.ant.skip=true -Dcheckstyle.skip=true -Dxml.skip=true
- cd ../../ && mvn clean install -Pno-validations
- cd contribution/checkstyle-tester
- ./launch.sh -Dcheckstyle.config.location=checks-only-javadoc-error.xml
- if grep "Got an exception" target/site/checkstyle.html; then

909
pom.xml

File diff suppressed because it is too large Load Diff

View File

@ -41,6 +41,7 @@ mv htdocs/new-site/ .
mv htdocs htdocs-$PREV_RELEASE
mv new-site htdocs
ln -s /home/project-web/checkstyle/reports htdocs/reports
ln -s /home/project-web/checkstyle/dtds htdocs/dtds
#Archiving
tar cfz htdocs-$PREV_RELEASE.tar.gz htdocs-$PREV_RELEASE/

34
shippable.yml Normal file
View File

@ -0,0 +1,34 @@
language: java
jdk:
- oraclejdk8
env:
matrix:
- PROFILE="-Ppitest-checks-blocks,no-validations"
- PROFILE="-Ppitest-checks-coding,no-validations"
- PROFILE="-Ppitest-checks-design,no-validations"
- PROFILE="-Ppitest-checks-header,no-validations"
- PROFILE="-Ppitest-checks-imports,no-validations"
- PROFILE="-Ppitest-checks-indentation,no-validations"
- PROFILE="-Ppitest-checks-javadoc,no-validations"
- PROFILE="-Ppitest-checks-metrics,no-validations"
- PROFILE="-Ppitest-checks-modifier,no-validations"
- PROFILE="-Ppitest-checks-naming,no-validations"
- PROFILE="-Ppitest-checks-regexp,no-validations"
- PROFILE="-Ppitest-checks-sizes,no-validations"
- PROFILE="-Ppitest-checks-whitespace,no-validations"
build:
cache: true
cache_dir_list:
- /root/.m2
ci:
# we skip PRs and commits that are not for Issues, as pitest is too time consuming
- >-
if [ $(git log -1 | grep -E "Issue \#[0-9]+\:" | cat | wc -l) -gt 0 ];
then
mvn $PROFILE clean verify org.pitest:pitest-maven:mutationCoverage;
fi

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -61,6 +61,13 @@ public class BaseCheckTestSupport {
protected final ByteArrayOutputStream stream = new ByteArrayOutputStream();
/**
* Returns {@link Configuration} based on Google's checks xml-configuration (google_checks.xml).
* This implementation uses {@link ConfigurationLoader} in order to load configuration
* from xml-file.
* @return {@link Configuration} based on Google's checks xml-configuration (google_checks.xml).
* @throws CheckstyleException if exception occurs during configuration loading.
*/
protected static Configuration getConfiguration() throws CheckstyleException {
if (configuration == null) {
configuration = ConfigurationLoader.loadConfiguration(XML_NAME, new PropertiesExpander(
@ -70,10 +77,21 @@ public class BaseCheckTestSupport {
return configuration;
}
protected static DefaultConfiguration createCheckConfig(Class<?> clazz) {
/**
* Creates {@link DefaultConfiguration} instance for the given check class.
* @param clazz check class.
* @return {@link DefaultConfiguration} instance.
*/
private static DefaultConfiguration createCheckConfig(Class<?> clazz) {
return new DefaultConfiguration(clazz.getName());
}
/**
* Creates {@link Checker} instance based on specified {@link Configuration}.
* @param checkConfig {@link Configuration} instance.
* @return {@link Checker} instance.
* @throws CheckstyleException if an exception occurs during checker configuration.
*/
protected Checker createChecker(Configuration checkConfig)
throws Exception {
final DefaultConfiguration dc = createCheckerConfig(checkConfig);
@ -89,6 +107,12 @@ public class BaseCheckTestSupport {
return checker;
}
/**
* Creates {@link DefaultConfiguration} or the {@link Checker}.
* based on the given {@link Configuration}.
* @param config {@link Configuration} instance.
* @return {@link DefaultConfiguration} for the {@link Checker}.
*/
protected DefaultConfiguration createCheckerConfig(Configuration config) {
final DefaultConfiguration dc =
new DefaultConfiguration("configuration");
@ -100,11 +124,32 @@ public class BaseCheckTestSupport {
return dc;
}
/**
* Returns canonical path for the file with the given file name.
* The path is formed based on the specific root location.
* This implementation uses 'src/it/resources/com/google/checkstyle/test/' as a root location.
* @param fileName file name.
* @return canonical path for the the file with the given file name.
* @throws IOException if I/O exception occurs while forming the path.
*/
protected String getPath(String fileName) throws IOException {
return new File("src/it/resources/com/google/checkstyle/test/" + fileName)
.getCanonicalPath();
}
/**
* Performs verification of the file with given file name. Uses specified configuration.
* Expected messages are represented by the array of strings, warning line numbers are
* represented by the array of integers.
* This implementation uses overloaded
* {@link BaseCheckTestSupport#verify(Checker, File[], String, String[], Integer...)} method
* inside.
* @param config configuration.
* @param fileName file name to verify.
* @param expected an array of expected messages.
* @param warnsExpected an array of expected warning numbers.
* @throws Exception if exception occurs during verification process.
*/
protected void verify(Configuration config, String fileName, String[] expected,
Integer... warnsExpected) throws Exception {
verify(createChecker(config),
@ -112,6 +157,15 @@ public class BaseCheckTestSupport {
fileName, expected, warnsExpected);
}
/**
* Performs verification of files. Uses provided {@link Checker} instance.
* @param checker {@link Checker} instance.
* @param processedFiles files to process.
* @param messageFileName message file name.
* @param expected an array of expected messages.
* @param warnsExpected an array of expected warning line numbers.
* @throws Exception if exception occurs during verification process.
*/
protected void verify(Checker checker,
File[] processedFiles,
String messageFileName,
@ -192,20 +246,73 @@ public class BaseCheckTestSupport {
return null;
}
/**
* Returns {@link Configuration} instance for the given check name.
* This implementation uses {@link BaseCheckTestSupport#getConfiguration()} method inside.
* @param checkName check name.
* @return {@link Configuration} instance for the given check name.
* @throws CheckstyleException if exception occurs during configuration loading.
*/
protected static Configuration getCheckConfig(String checkName) throws CheckstyleException {
Configuration result = null;
final Configuration result;
final List<Configuration> configs = getCheckConfigs(checkName);
if (configs.size() == 1) {
result = configs.get(0);
}
else {
throw new IllegalStateException("multiple instances of the same Check are detected");
}
return result;
}
/**
* Returns {@link Configuration} instance for the given check name.
* This implementation uses {@link BaseCheckTestSupport#getConfiguration()} method inside.
* @param checkName check name.
* @return {@link Configuration} instance for the given check name.
* @throws CheckstyleException if exception occurs during configuration loading.
*/
protected static Configuration getCheckConfig(String checkName, String checkId)
throws CheckstyleException {
final Configuration result;
final List<Configuration> configs = getCheckConfigs(checkName);
if (configs.size() == 1) {
result = configs.get(0);
}
else {
result = configs.stream().filter(conf -> {
try {
return conf.getAttribute("id").equals(checkId);
}
catch (CheckstyleException ex) {
throw new IllegalStateException("problem to get ID attribute from " + conf, ex);
}
})
.findFirst().orElseGet(null);
}
return result;
}
/**
* Returns a list of all {@link Configuration} instances for the given check name.
* This implementation uses {@link BaseCheckTestSupport#getConfiguration()} method inside.
* @param checkName check name.
* @return {@link Configuration} instance for the given check name.
* @throws CheckstyleException if exception occurs during configuration loading.
*/
protected static List<Configuration> getCheckConfigs(String checkName)
throws CheckstyleException {
final List<Configuration> result = new ArrayList<>();
for (Configuration currentConfig : getConfiguration().getChildren()) {
if ("TreeWalker".equals(currentConfig.getName())) {
for (Configuration checkConfig : currentConfig.getChildren()) {
if (checkName.equals(checkConfig.getName())) {
result = checkConfig;
break;
result.add(checkConfig);
}
}
}
else if (checkName.equals(currentConfig.getName())) {
result = currentConfig;
break;
result.add(currentConfig);
}
}
return result;
@ -219,6 +326,13 @@ public class BaseCheckTestSupport {
return path;
}
/**
* Returns an array of integers which represents the warning line numbers in the file
* with the given file name.
* @param fileName file name.
* @return an array of integers which represents the warning line numbers.
* @throws IOException if I/O exception occurs while reading the file.
*/
protected Integer[] getLinesWithWarn(String fileName) throws IOException {
final List<Integer> result = new ArrayList<>();
try (BufferedReader br = new BufferedReader(new InputStreamReader(

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -48,7 +48,6 @@ public class FileTabCharacterTest extends BaseCheckTestSupport {
@Test
public void fileTabTest() throws Exception {
final DefaultConfiguration checkConfig = createConfig(true);
final String[] expected = {
"8:25: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"),
"51:5: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"),
@ -61,18 +60,10 @@ public class FileTabCharacterTest extends BaseCheckTestSupport {
"134:3: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"),
};
final Configuration checkConfig = getCheckConfig("FileTabCharacter");
final String filePath = getPath("InputFileTabCharacter.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
/**
* Creates a configuration that is functionally close to that in the docs.
*/
private static DefaultConfiguration createConfig(boolean verbose) {
final DefaultConfiguration checkConfig =
createCheckConfig(FileTabCharacterCheck.class);
checkConfig.addAttribute("eachLine", Boolean.toString(verbose));
return checkConfig;
}
}

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -37,74 +37,70 @@ public class IllegalTokenTextTest extends BaseCheckTestSupport {
@Test
public void illegalTokensTest() throws Exception {
final String message = "Consider using special escape sequence instead of octal value or "
+ "Unicode escaped value.";
final String[] expected = {
"17:27: Avoid using corresponding octal or Unicode escape.",
"18:27: Avoid using corresponding octal or Unicode escape.",
"19:27: Avoid using corresponding octal or Unicode escape.",
"22:25: Avoid using corresponding octal or Unicode escape.",
"23:25: Avoid using corresponding octal or Unicode escape.",
"25:16: Avoid using corresponding octal or Unicode escape.",
"42:21: Avoid using corresponding octal or Unicode escape.",
"43:21: Avoid using corresponding octal or Unicode escape.",
"44:21: Avoid using corresponding octal or Unicode escape.",
"45:21: Avoid using corresponding octal or Unicode escape.",
"46:21: Avoid using corresponding octal or Unicode escape.",
"47:21: Avoid using corresponding octal or Unicode escape.",
"48:21: Avoid using corresponding octal or Unicode escape.",
"49:21: Avoid using corresponding octal or Unicode escape.",
"54:21: Avoid using corresponding octal or Unicode escape.",
"55:21: Avoid using corresponding octal or Unicode escape.",
"56:21: Avoid using corresponding octal or Unicode escape.",
"57:21: Avoid using corresponding octal or Unicode escape.",
"58:21: Avoid using corresponding octal or Unicode escape.",
"59:21: Avoid using corresponding octal or Unicode escape.",
"60:21: Avoid using corresponding octal or Unicode escape.",
"61:21: Avoid using corresponding octal or Unicode escape.",
"68:31: Avoid using corresponding octal or Unicode escape.",
"69:31: Avoid using corresponding octal or Unicode escape.",
"70:31: Avoid using corresponding octal or Unicode escape.",
"73:29: Avoid using corresponding octal or Unicode escape.",
"74:29: Avoid using corresponding octal or Unicode escape.",
"76:20: Avoid using corresponding octal or Unicode escape.",
"93:25: Avoid using corresponding octal or Unicode escape.",
"94:25: Avoid using corresponding octal or Unicode escape.",
"95:25: Avoid using corresponding octal or Unicode escape.",
"96:25: Avoid using corresponding octal or Unicode escape.",
"97:25: Avoid using corresponding octal or Unicode escape.",
"98:25: Avoid using corresponding octal or Unicode escape.",
"99:25: Avoid using corresponding octal or Unicode escape.",
"100:25: Avoid using corresponding octal or Unicode escape.",
"105:25: Avoid using corresponding octal or Unicode escape.",
"106:25: Avoid using corresponding octal or Unicode escape.",
"107:25: Avoid using corresponding octal or Unicode escape.",
"108:25: Avoid using corresponding octal or Unicode escape.",
"109:25: Avoid using corresponding octal or Unicode escape.",
"110:25: Avoid using corresponding octal or Unicode escape.",
"111:25: Avoid using corresponding octal or Unicode escape.",
"112:25: Avoid using corresponding octal or Unicode escape.",
"118:35: Avoid using corresponding octal or Unicode escape.",
"119:35: Avoid using corresponding octal or Unicode escape.",
"120:35: Avoid using corresponding octal or Unicode escape.",
"123:33: Avoid using corresponding octal or Unicode escape.",
"124:33: Avoid using corresponding octal or Unicode escape.",
"126:24: Avoid using corresponding octal or Unicode escape.",
"143:29: Avoid using corresponding octal or Unicode escape.",
"144:29: Avoid using corresponding octal or Unicode escape.",
"145:29: Avoid using corresponding octal or Unicode escape.",
"146:29: Avoid using corresponding octal or Unicode escape.",
"147:29: Avoid using corresponding octal or Unicode escape.",
"148:29: Avoid using corresponding octal or Unicode escape.",
"149:29: Avoid using corresponding octal or Unicode escape.",
"150:29: Avoid using corresponding octal or Unicode escape.",
"155:29: Avoid using corresponding octal or Unicode escape.",
"156:29: Avoid using corresponding octal or Unicode escape.",
"157:29: Avoid using corresponding octal or Unicode escape.",
"158:29: Avoid using corresponding octal or Unicode escape.",
"159:29: Avoid using corresponding octal or Unicode escape.",
"160:29: Avoid using corresponding octal or Unicode escape.",
"161:29: Avoid using corresponding octal or Unicode escape.",
"162:29: Avoid using corresponding octal or Unicode escape.",
"18:27: " + message,
"19:27: " + message,
"22:25: " + message,
"23:25: " + message,
"25:16: " + message,
"43:21: " + message,
"44:21: " + message,
"45:21: " + message,
"46:21: " + message,
"47:21: " + message,
"48:21: " + message,
"49:21: " + message,
"54:21: " + message,
"55:21: " + message,
"56:21: " + message,
"57:21: " + message,
"58:21: " + message,
"59:21: " + message,
"60:21: " + message,
"61:21: " + message,
"69:31: " + message,
"70:31: " + message,
"73:29: " + message,
"74:29: " + message,
"76:20: " + message,
"94:25: " + message,
"95:25: " + message,
"96:25: " + message,
"97:25: " + message,
"98:25: " + message,
"99:25: " + message,
"100:25: " + message,
"105:25: " + message,
"106:25: " + message,
"107:25: " + message,
"108:25: " + message,
"109:25: " + message,
"110:25: " + message,
"111:25: " + message,
"112:25: " + message,
"119:35: " + message,
"120:35: " + message,
"123:33: " + message,
"124:33: " + message,
"126:24: " + message,
"144:29: " + message,
"145:29: " + message,
"146:29: " + message,
"147:29: " + message,
"148:29: " + message,
"149:29: " + message,
"150:29: " + message,
"155:29: " + message,
"156:29: " + message,
"157:29: " + message,
"158:29: " + message,
"159:29: " + message,
"160:29: " + message,
"161:29: " + message,
"162:29: " + message,
};
final Configuration checkConfig = getCheckConfig("IllegalTokenText");

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -31,13 +31,13 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
public class CustomImportOrderTest extends BaseCheckTestSupport {
private static final String MSG_SEPARATOR = "custom.import.order.line.separator";
private static final String MSG_LEX = "custom.import.order.lex";
private static final String MSG_ORDER = "custom.import.order";
/** Shortcuts to make code more compact. */
private static final String STD = CustomImportOrderCheck.STANDARD_JAVA_PACKAGE_RULE_GROUP;
private static final String SPECIAL = CustomImportOrderCheck.SPECIAL_IMPORTS_RULE_GROUP;
private static final String MSG_LINE_SEPARATOR = CustomImportOrderCheck.MSG_LINE_SEPARATOR;
private static final String MSG_LEX = CustomImportOrderCheck.MSG_LEX;
private static final String MSG_NONGROUP_EXPECTED =
CustomImportOrderCheck.MSG_NONGROUP_EXPECTED;
private static final String STATIC = CustomImportOrderCheck.STATIC_RULE_GROUP;
private final Class<CustomImportOrderCheck> clazz = CustomImportOrderCheck.class;
@ -53,16 +53,14 @@ public class CustomImportOrderTest extends BaseCheckTestSupport {
final String[] expected = {
"4: " + getCheckMessage(clazz, MSG_LEX, "java.awt.Button.ABORT",
"java.io.File.createTempFile"),
"7: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.awt.Button"),
"8: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.awt.Frame"),
"9: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.awt.Dialog"),
"10: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.awt.event.ActionEvent"),
"11: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "javax.swing.JComponent"),
"12: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "javax.swing.JTable"),
"13: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.io.File"),
"14: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.io.IOException"),
"15: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.io.InputStream"),
"16: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.io.Reader"),
"6: " + getCheckMessage(clazz, MSG_LINE_SEPARATOR, "java.awt.Button"),
"8: " + getCheckMessage(clazz, MSG_LEX, "java.awt.Dialog", "java.awt.Frame"),
"12: " + getCheckMessage(clazz, MSG_LEX, "java.io.File", "javax.swing.JTable"),
"13: " + getCheckMessage(clazz, MSG_LEX, "java.io.IOException", "javax.swing.JTable"),
"14: " + getCheckMessage(clazz, MSG_LEX, "java.io.InputStream", "javax.swing.JTable"),
"15: " + getCheckMessage(clazz, MSG_LEX, "java.io.Reader", "javax.swing.JTable"),
"17: " + getCheckMessage(clazz, MSG_LEX, "com.google.common.base.Ascii",
"javax.swing.JTable"),
};
final Configuration checkConfig = getCheckConfig("CustomImportOrder");
@ -78,16 +76,16 @@ public class CustomImportOrderTest extends BaseCheckTestSupport {
final String[] expected = {
"4: " + getCheckMessage(clazz, MSG_LEX, "java.awt.Button.ABORT",
"java.io.File.createTempFile"),
"7: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.util.List"),
"8: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.util.StringTokenizer"),
"9: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.util.*"),
"10: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL,
"9: " + getCheckMessage(clazz, MSG_LEX, "java.util.*", "java.util.StringTokenizer"),
"11: " + getCheckMessage(clazz, MSG_LEX, "java.util.concurrent.*",
"java.util.concurrent.AbstractExecutorService"),
"13: " + getCheckMessage(clazz, MSG_LEX,
"com.google.checkstyle.test.chapter2filebasic.rule21filename.*",
"java.util.concurrent.AbstractExecutorService"),
"14: " + getCheckMessage(clazz, MSG_LEX, "com.sun.xml.internal.xsom.impl.scd.Iterators",
"java.util.concurrent.AbstractExecutorService"),
"16: " + getCheckMessage(clazz, MSG_LEX, "com.google.common.reflect.*",
"java.util.concurrent.AbstractExecutorService"),
"11: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.util.concurrent.*"),
"14: " + getCheckMessage(clazz, MSG_SEPARATOR,
"com.sun.xml.internal.xsom.impl.scd.Iterators"),
"16: " + getCheckMessage(clazz, MSG_ORDER, SPECIAL, STD,
"com.google.common.reflect.*"),
};
final Configuration checkConfig = getCheckConfig("CustomImportOrder");
@ -101,17 +99,20 @@ public class CustomImportOrderTest extends BaseCheckTestSupport {
public void customImportTest3() throws Exception {
final String[] expected = {
"4: " + getCheckMessage(clazz, MSG_LEX, "java.awt.Button.ABORT",
"4: " + getCheckMessage(clazz, MSG_LINE_SEPARATOR, "java.awt.Dialog"),
"5: " + getCheckMessage(clazz, MSG_NONGROUP_EXPECTED, STATIC,
"javax.swing.WindowConstants.*"),
"7: " + getCheckMessage(clazz, MSG_LEX,
"com.google.checkstyle.test.chapter2filebasic.rule21filename.*", "java.awt.Dialog"),
"8: " + getCheckMessage(clazz, MSG_LEX, "com.google.common.reflect.*",
"java.awt.Dialog"),
"9: " + getCheckMessage(clazz, MSG_LEX, "com.sun.xml.internal.xsom.impl.scd.Iterators",
"java.awt.Dialog"),
"11: " + getCheckMessage(clazz, MSG_NONGROUP_EXPECTED, STATIC,
"java.io.File.createTempFile"),
"8: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.util.StringTokenizer"),
"9: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.util.*"),
"10: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL,
"13: " + getCheckMessage(clazz, MSG_LEX, "java.util.*", "java.util.StringTokenizer"),
"15: " + getCheckMessage(clazz, MSG_LEX, "java.util.concurrent.*",
"java.util.concurrent.AbstractExecutorService"),
"11: " + getCheckMessage(clazz, MSG_ORDER, STD, SPECIAL, "java.util.concurrent.*"),
"14: " + getCheckMessage(clazz, MSG_SEPARATOR,
"com.sun.xml.internal.xsom.impl.scd.Iterators"),
"16: " + getCheckMessage(clazz, MSG_ORDER, SPECIAL, STD,
"com.google.common.reflect.*"),
};
final Configuration checkConfig = getCheckConfig("CustomImportOrder");
@ -132,4 +133,15 @@ public class CustomImportOrderTest extends BaseCheckTestSupport {
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
@Test
public void validGoogleStyleOrderOfImportsTest() throws Exception {
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
final Configuration checkConfig = getCheckConfig("CustomImportOrder");
final String filePath = getPath("InputCustomImportOrderNoImports.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
}

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -20,6 +20,7 @@
package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks;
import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_ALONE;
import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_BREAK_BEFORE;
import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_NEW;
import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_SAME;
@ -29,9 +30,8 @@ import java.io.IOException;
import org.junit.Test;
import com.google.checkstyle.test.base.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.Configuration;
import com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck;
import com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyOption;
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
public class RightCurlyTest extends BaseCheckTestSupport {
@ -44,10 +44,47 @@ public class RightCurlyTest extends BaseCheckTestSupport {
@Test
public void rightCurlyTestAlone() throws Exception {
final DefaultConfiguration newCheckConfig = createCheckConfig(RightCurlyCheck.class);
newCheckConfig.addAttribute("option", RightCurlyOption.ALONE.toString());
newCheckConfig.addAttribute("tokens", "CLASS_DEF, METHOD_DEF, CTOR_DEF");
final String[] expected = {
"20:17: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 17),
"32:13: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 13),
"79:27: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_BREAK_BEFORE, "}", 27),
};
final Configuration checkConfig = getCheckConfig("RightCurly", "RightCurlySame");
final String filePath = getPath("InputRightCurlyOther.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
@Test
public void rightCurlyTestSame() throws Exception {
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
final Configuration checkConfig = getCheckConfig("RightCurly", "RightCurlySame");
final String filePath = getPath("InputRightCurlySame.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
@Test
public void testRightCurlySameAndLiteralDoDefault() throws Exception {
final String[] expected = {
"62:9: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 9),
"67:13: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 13),
"83:9: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 9),
};
final Configuration checkConfig = getCheckConfig("RightCurly", "RightCurlySame");
final String filePath = getPath("InputRightCurlyDoWhile.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
@Test
public void testRightCurlyAloneOther() throws Exception {
final String[] expected = {
"97:5: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_ALONE, "}", 5),
"97:6: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_NEW, "}", 6),
@ -56,34 +93,31 @@ public class RightCurlyTest extends BaseCheckTestSupport {
"122:6: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_NEW, "}", 6),
};
final String filePath = getPath("InputRightCurlyOther.java");
final Configuration checkConfig = getCheckConfig("RightCurly", "RightCurlyAlone");
final String filePath = getPath("InputRightCurlyOtherAlone.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(newCheckConfig, filePath, expected, warnList);
verify(checkConfig, filePath, expected, warnList);
}
@Test
public void rightCurlyTestSame() throws Exception {
final DefaultConfiguration newCheckConfig = createCheckConfig(RightCurlyCheck.class);
newCheckConfig.addAttribute("option", RightCurlyOption.SAME.toString());
public void rightCurlyAloneTestSame() throws Exception {
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
final Configuration checkConfig = getCheckConfig("RightCurly", "RightCurlyAlone");
final String filePath = getPath("InputRightCurlySame.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(newCheckConfig, filePath, expected, warnList);
verify(checkConfig, filePath, expected, warnList);
}
@Test
public void testRightCurlySameAndLiteralDo() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(RightCurlyCheck.class);
checkConfig.addAttribute("option", RightCurlyOption.SAME.toString());
checkConfig.addAttribute("tokens", "LITERAL_DO");
final String[] expected = {
"62:9: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 9),
"67:13: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 13),
"83:9: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 9),
};
final String filePath = getPath("InputRightCurlyDoWhile.java");
public void testRightCurlyAloneSameAndLiteralDo() throws Exception {
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
final Configuration checkConfig = getCheckConfig("RightCurly", "RightCurlyAlone");
final String filePath = getPath("InputRightCurlyDoWhileAlone.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -25,10 +25,8 @@ import java.io.IOException;
import org.junit.Test;
import com.google.checkstyle.test.base.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.Configuration;
import com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck;
import com.puppycrawl.tools.checkstyle.checks.whitespace.WrapOption;
public class OperatorWrapTest extends BaseCheckTestSupport {
@ -45,25 +43,25 @@ public class OperatorWrapTest extends BaseCheckTestSupport {
final String messageKey = "line.new";
final String[] expected = {
"10:27: " + getCheckMessage(clazz, messageKey, "+"),
"11:28: " + getCheckMessage(clazz, messageKey, "-"),
"19:27: " + getCheckMessage(clazz, messageKey, "&&"),
"53:42: " + getCheckMessage(clazz, messageKey, "?"),
"57:27: " + getCheckMessage(clazz, messageKey, "!="),
"63:30: " + getCheckMessage(clazz, messageKey, "=="),
"69:27: " + getCheckMessage(clazz, messageKey, ">"),
"75:35: " + getCheckMessage(clazz, messageKey, "||"),
"98:46: " + getCheckMessage(clazz, messageKey, "?"),
"102:31: " + getCheckMessage(clazz, messageKey, "!="),
"108:34: " + getCheckMessage(clazz, messageKey, "=="),
"114:31: " + getCheckMessage(clazz, messageKey, ">"),
"120:39: " + getCheckMessage(clazz, messageKey, "||"),
"144:46: " + getCheckMessage(clazz, messageKey, "?"),
"148:31: " + getCheckMessage(clazz, messageKey, "!="),
"154:34: " + getCheckMessage(clazz, messageKey, "=="),
"160:31: " + getCheckMessage(clazz, messageKey, ">"),
"166:39: " + getCheckMessage(clazz, messageKey, "||"),
"185:38: " + getCheckMessage(clazz, messageKey, "?"),
"11:27: " + getCheckMessage(clazz, messageKey, "+"),
"12:28: " + getCheckMessage(clazz, messageKey, "-"),
"20:27: " + getCheckMessage(clazz, messageKey, "&&"),
"62:42: " + getCheckMessage(clazz, messageKey, "?"),
"66:27: " + getCheckMessage(clazz, messageKey, "!="),
"72:30: " + getCheckMessage(clazz, messageKey, "=="),
"78:27: " + getCheckMessage(clazz, messageKey, ">"),
"84:35: " + getCheckMessage(clazz, messageKey, "||"),
"107:46: " + getCheckMessage(clazz, messageKey, "?"),
"111:31: " + getCheckMessage(clazz, messageKey, "!="),
"117:34: " + getCheckMessage(clazz, messageKey, "=="),
"123:31: " + getCheckMessage(clazz, messageKey, ">"),
"129:39: " + getCheckMessage(clazz, messageKey, "||"),
"153:46: " + getCheckMessage(clazz, messageKey, "?"),
"157:31: " + getCheckMessage(clazz, messageKey, "!="),
"163:34: " + getCheckMessage(clazz, messageKey, "=="),
"169:31: " + getCheckMessage(clazz, messageKey, ">"),
"175:39: " + getCheckMessage(clazz, messageKey, "||"),
"194:38: " + getCheckMessage(clazz, messageKey, "?"),
};
final Configuration checkConfig = getCheckConfig("OperatorWrap");
@ -73,56 +71,4 @@ public class OperatorWrapTest extends BaseCheckTestSupport {
verify(checkConfig, filePath, expected, warnList);
}
@Test
public void operatorWrapTestAssign() throws Exception {
final DefaultConfiguration newCheckConfig = createCheckConfig(OperatorWrapCheck.class);
newCheckConfig.addAttribute("option", WrapOption.EOL.toString());
newCheckConfig.addAttribute("tokens", "ASSIGN, DIV_ASSIGN, PLUS_ASSIGN, MINUS_ASSIGN,"
+ "STAR_ASSIGN, MOD_ASSIGN, SR_ASSIGN, BSR_ASSIGN, SL_ASSIGN, BXOR_ASSIGN,"
+ "BOR_ASSIGN, BAND_ASSIGN");
final String messageKey = "line.previous";
final Class<OperatorWrapCheck> clazz = OperatorWrapCheck.class;
final String[] expected = {
"28:13: " + getCheckMessage(clazz, messageKey, "="),
"177:9: " + getCheckMessage(clazz, messageKey, "="),
"207:14: " + getCheckMessage(clazz, messageKey, "+="),
"211:14: " + getCheckMessage(clazz, messageKey, "-="),
"215:14: " + getCheckMessage(clazz, messageKey, "/="),
"219:14: " + getCheckMessage(clazz, messageKey, "*="),
"223:14: " + getCheckMessage(clazz, messageKey, "%="),
"227:14: " + getCheckMessage(clazz, messageKey, "^="),
"231:14: " + getCheckMessage(clazz, messageKey, "|="),
"235:14: " + getCheckMessage(clazz, messageKey, "&="),
"239:13: " + getCheckMessage(clazz, messageKey, ">>="),
"243:13: " + getCheckMessage(clazz, messageKey, ">>>="),
"247:13: " + getCheckMessage(clazz, messageKey, "<<="),
"257:18: " + getCheckMessage(clazz, messageKey, "+="),
"261:18: " + getCheckMessage(clazz, messageKey, "-="),
"265:18: " + getCheckMessage(clazz, messageKey, "/="),
"269:18: " + getCheckMessage(clazz, messageKey, "*="),
"273:18: " + getCheckMessage(clazz, messageKey, "%="),
"277:18: " + getCheckMessage(clazz, messageKey, "^="),
"281:18: " + getCheckMessage(clazz, messageKey, "|="),
"285:18: " + getCheckMessage(clazz, messageKey, "&="),
"289:17: " + getCheckMessage(clazz, messageKey, ">>="),
"293:17: " + getCheckMessage(clazz, messageKey, ">>>="),
"297:17: " + getCheckMessage(clazz, messageKey, "<<="),
"308:18: " + getCheckMessage(clazz, messageKey, "+="),
"312:18: " + getCheckMessage(clazz, messageKey, "-="),
"316:18: " + getCheckMessage(clazz, messageKey, "/="),
"320:18: " + getCheckMessage(clazz, messageKey, "*="),
"324:18: " + getCheckMessage(clazz, messageKey, "%="),
"328:18: " + getCheckMessage(clazz, messageKey, "^="),
"332:18: " + getCheckMessage(clazz, messageKey, "|="),
"336:18: " + getCheckMessage(clazz, messageKey, "&="),
"340:17: " + getCheckMessage(clazz, messageKey, ">>="),
"344:17: " + getCheckMessage(clazz, messageKey, ">>>="),
"348:17: " + getCheckMessage(clazz, messageKey, "<<="),
};
final String filePath = getPath("InputOperatorWrapAssign.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(newCheckConfig, filePath, expected, warnList);
}
}

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -37,16 +37,30 @@ public class SeparatorWrapTest extends BaseCheckTestSupport {
}
@Test
public void separatorWrapTest() throws Exception {
public void separatorWrapDotTest() throws Exception {
final String[] expected = {
"28:30: " + getCheckMessage(SeparatorWrapCheck.class, "line.new", "."),
};
final Configuration checkConfig = getCheckConfig("SeparatorWrap");
final Configuration checkConfig = getCheckConfig("SeparatorWrap", "SeparatorWrapDot");
final String filePath = getPath("InputSeparatorWrap.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
@Test
public void separatorWrapCommaTest() throws Exception {
final String[] expected = {
"31:17: " + getCheckMessage(SeparatorWrapCheck.class, "line.previous", ","),
};
final Configuration checkConfig = getCheckConfig("SeparatorWrap", "SeparatorWrapComma");
final String filePath = getPath("InputSeparatorWrapComma.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
}

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -0,0 +1,61 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace;
import java.io.File;
import java.io.IOException;
import org.junit.Test;
import com.google.checkstyle.test.base.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.api.Configuration;
import com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck;
public class MethodParamPadTest extends BaseCheckTestSupport {
@Override
protected String getPath(String fileName) throws IOException {
return super.getPath("chapter4formatting" + File.separator + "rule462horizontalwhitespace"
+ File.separator + fileName);
}
@Test
public void operatorWrapTest() throws Exception {
final Class<MethodParamPadCheck> clazz = MethodParamPadCheck.class;
final String messageKeyPreceded = "ws.preceded";
final String[] expected = {
"11:32: " + getCheckMessage(clazz, messageKeyPreceded, "("),
"13:15: " + getCheckMessage(clazz, messageKeyPreceded, "("),
"20:24: " + getCheckMessage(clazz, messageKeyPreceded, "("),
"29:39: " + getCheckMessage(clazz, messageKeyPreceded, "("),
"35:16: " + getCheckMessage(clazz, messageKeyPreceded, "("),
"41:21: " + getCheckMessage(clazz, messageKeyPreceded, "("),
"47:18: " + getCheckMessage(clazz, messageKeyPreceded, "("),
"52:36: " + getCheckMessage(clazz, messageKeyPreceded, "("),
};
final Configuration checkConfig = getCheckConfig("MethodParamPad");
final String filePath = getPath("InputMethodParamPad.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
}

View File

@ -0,0 +1,118 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace;
import java.io.File;
import java.io.IOException;
import org.junit.Test;
import com.google.checkstyle.test.base.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.api.Configuration;
import com.puppycrawl.tools.checkstyle.checks.whitespace.ParenPadCheck;
public class ParenPadTest extends BaseCheckTestSupport {
@Override
protected String getPath(String fileName) throws IOException {
return super.getPath("chapter4formatting" + File.separator + "rule462horizontalwhitespace"
+ File.separator + fileName);
}
@Test
public void methodParenTest() throws Exception {
final Class<ParenPadCheck> clazz = ParenPadCheck.class;
final String messageKeyPreceded = "ws.preceded";
final String messageKeyFollowed = "ws.followed";
final String[] expected = {
"44:27: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"44:27: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"45:18: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"48:27: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"49:19: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"49:19: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"52:27: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"53:21: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"54:18: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"54:52: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"54:52: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"57:26: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"58:22: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"59:24: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"60:26: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"60:51: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"60:57: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"61:29: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"62:43: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"63:41: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"65:43: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"78:28: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"78:28: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"79:19: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"82:33: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"83:19: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"83:19: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"86:29: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"87:35: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"88:51: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"88:51: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"88:53: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"90:38: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"91:32: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"92:35: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"93:30: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"94:60: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"94:62: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"94:69: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"95:34: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"96:47: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"97:42: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"99:44: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"112:17: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"113:23: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"113:25: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"113:31: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"114:26: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"114:28: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"114:34: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"114:50: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"115:26: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"115:28: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"115:35: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"115:53: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"115:55: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"119:17: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"119:22: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"123:30: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"123:44: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"126:22: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"126:22: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
"130:19: " + getCheckMessage(clazz, messageKeyFollowed, "("),
"130:19: " + getCheckMessage(clazz, messageKeyPreceded, ")"),
};
final Configuration checkConfig = getCheckConfig("ParenPad");
final String filePath = getPath("InputParenPad.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
}

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -64,6 +64,9 @@ public class WhitespaceAroundTest extends BaseCheckTestSupport {
"118:20: " + getCheckMessage(checkConfig.getMessages(), msgFollowed, "/"),
"147:15: " + getCheckMessage(checkConfig.getMessages(), msgFollowed, "assert"),
"150:20: " + getCheckMessage(checkConfig.getMessages(), msgPreceded, ":"),
"249:14: " + getCheckMessage(checkConfig.getMessages(), msgPreceded, "->"),
"250:17: " + getCheckMessage(checkConfig.getMessages(), msgFollowed, "->"),
"250:17: " + getCheckMessage(checkConfig.getMessages(), msgPreceded, "{"),
};
final String filePath = getPath("InputWhitespaceAroundBasic.java");

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -41,7 +41,8 @@ public class AnnotationLocationTest extends BaseCheckTestSupport {
final Class<AnnotationLocationCheck> clazz = AnnotationLocationCheck.class;
getCheckMessage(clazz, "annotation.location.alone");
final Configuration checkConfig = getCheckConfig("AnnotationLocation");
final Configuration checkConfig = getCheckConfig("AnnotationLocation",
"AnnotationLocationMostCases");
final String msgLocationAlone = "annotation.location.alone";
final String msgLocation = "annotation.location";
@ -64,4 +65,23 @@ public class AnnotationLocationTest extends BaseCheckTestSupport {
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
@Test
public void annotationTestVariables() throws Exception {
final Class<AnnotationLocationCheck> clazz = AnnotationLocationCheck.class;
getCheckMessage(clazz, "annotation.location.alone");
final Configuration checkConfig = getCheckConfig("AnnotationLocation",
"AnnotationLocationVariables");
final String msgLocation = "annotation.location";
final String[] expected = {
"63: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "7", "4"),
};
final String filePath = getPath("InputAnnotationLocationVariables.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
}

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -22,29 +22,40 @@ package com.google.checkstyle.test.chapter5naming.rule51identifiernames;
import java.io.File;
import java.io.IOException;
import org.junit.BeforeClass;
import org.junit.Test;
import com.google.checkstyle.test.base.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import com.puppycrawl.tools.checkstyle.api.Configuration;
public class CatchParameterNameTest extends BaseCheckTestSupport {
private static Configuration checkConfig;
private static String format;
@Override
protected String getPath(String fileName) throws IOException {
return super.getPath("chapter5naming" + File.separator + "rule51identifiernames"
+ File.separator + fileName);
}
@BeforeClass
public static void setConfigurationBuilder() throws CheckstyleException {
checkConfig = getCheckConfig("CatchParameterName");
format = checkConfig.getAttribute("format");
}
@Test
public void catchParameterNameTest() throws Exception {
final Configuration checkConfig = getCheckConfig("CatchParameterName");
final String msgKey = "name.invalidPattern";
final String format = "^[a-z][a-z0-9][a-zA-Z0-9]*$";
final String[] expected = {
"6:28: " + getCheckMessage(checkConfig.getMessages(), msgKey, "e", format),
"24:28: " + getCheckMessage(checkConfig.getMessages(), msgKey, "t", format),
"47:28: " + getCheckMessage(checkConfig.getMessages(), msgKey, "iException", format),
"50:28: " + getCheckMessage(checkConfig.getMessages(), msgKey, "x", format),
"50:28: " + getCheckMessage(checkConfig.getMessages(), msgKey, "ex_1", format),
"53:28: " + getCheckMessage(checkConfig.getMessages(), msgKey, "eX", format),
"56:28: " + getCheckMessage(checkConfig.getMessages(), msgKey, "eXX", format),
"59:28: " + getCheckMessage(checkConfig.getMessages(), msgKey, "x_y_z", format),
"62:28: " + getCheckMessage(checkConfig.getMessages(), msgKey, "Ex", format),
};
final String filePath = getPath("InputCatchParameterName.java");

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -36,7 +36,7 @@ public class PackageNameTest extends BaseCheckTestSupport {
private static Configuration checkConfig;
private static String format;
protected String getPath(String packageName, String fileName) throws IOException {
private String getPath(String packageName, String fileName) throws IOException {
return getPath("chapter5naming" + File.separator + "rule521" + packageName
+ File.separator + fileName);
}

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -21,7 +21,9 @@ package com.google.checkstyle.test.chapter5naming.rule526parameternames;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@ -33,7 +35,7 @@ public class ParameterNameTest extends BaseCheckTestSupport {
private static final String MSG_KEY = "name.invalidPattern";
private static String format;
private static Configuration checkConfig;
private static Configuration config;
@Override
protected String getPath(String fileName) throws IOException {
@ -43,31 +45,36 @@ public class ParameterNameTest extends BaseCheckTestSupport {
@BeforeClass
public static void setConfigurationBuilder() throws CheckstyleException {
checkConfig = getCheckConfig("ParameterName");
format = checkConfig.getAttribute("format");
final List<Configuration> configs = getCheckConfigs("ParameterName");
Assert.assertEquals(configs.size(), 1);
config = configs.get(0);
format = config.getAttribute("format");
}
@Test
public void parameterNameTest() throws Exception {
public void generalParameterNameTest() throws Exception {
final String[] expected = {
"8:21: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "$arg1", format),
"9:21: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "ar$g2", format),
"10:21: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "arg3$", format),
"11:21: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "a_rg4", format),
"12:21: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "_arg5", format),
"13:21: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "arg6_", format),
"14:21: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "aArg7", format),
"15:21: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "aArg8", format),
"16:21: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "aar_g", format),
"26:21: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "bB", format),
"49:22: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "llll_llll", format),
"50:21: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "bB", format),
"10:21: " + getCheckMessage(config.getMessages(), MSG_KEY, "bB", format),
"33:22: " + getCheckMessage(config.getMessages(), MSG_KEY, "llll_llll", format),
"34:21: " + getCheckMessage(config.getMessages(), MSG_KEY, "bB", format),
"64:13: " + getCheckMessage(config.getMessages(), MSG_KEY, "$arg1", format),
"65:13: " + getCheckMessage(config.getMessages(), MSG_KEY, "ar$g2", format),
"66:13: " + getCheckMessage(config.getMessages(), MSG_KEY, "arg3$", format),
"67:13: " + getCheckMessage(config.getMessages(), MSG_KEY, "a_rg4", format),
"68:13: " + getCheckMessage(config.getMessages(), MSG_KEY, "_arg5", format),
"69:13: " + getCheckMessage(config.getMessages(), MSG_KEY, "arg6_", format),
"70:13: " + getCheckMessage(config.getMessages(), MSG_KEY, "aArg7", format),
"71:13: " + getCheckMessage(config.getMessages(), MSG_KEY, "aArg8", format),
"72:13: " + getCheckMessage(config.getMessages(), MSG_KEY, "aar_g", format),
};
final String filePath = getPath("InputParameterNameSimple.java");
final String filePath = getPath("InputParameterName.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
verify(config, filePath, expected, warnList);
}
}

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -51,7 +51,6 @@ public class LocalVariableNameTest extends BaseCheckTestSupport {
public void localVariableNameTest() throws Exception {
final String[] expected = {
"26:13: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "a", format),
"27:13: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "aA", format),
"28:13: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "a1_a", format),
"29:13: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "A_A", format),
@ -74,7 +73,6 @@ public class LocalVariableNameTest extends BaseCheckTestSupport {
public void oneCharTest() throws Exception {
final String[] expected = {
"15:13: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "i", format),
"21:17: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "I_ndex", format),
"45:17: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "i_ndex", format),
"49:17: " + getCheckMessage(checkConfig.getMessages(), MSG_KEY, "ii_i1", format),

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -42,7 +42,7 @@ public class AbbreviationAsWordInNameTest extends BaseCheckTestSupport {
@Test
public void abbreviationAsWordInNameTest() throws Exception {
final int maxCapitalCount = 1;
final int maxCapitalCount = 2;
final String[] expected = {
"50: " + getWarningMessage("newCustomerID", maxCapitalCount),

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -25,7 +25,6 @@ import java.io.IOException;
import org.junit.Test;
import com.google.checkstyle.test.base.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.api.Configuration;
import com.puppycrawl.tools.checkstyle.checks.javadoc.SingleLineJavadocCheck;
@ -52,26 +51,10 @@ public class SingleLineJavadocTest extends BaseCheckTestSupport {
"41: " + msg,
};
final DefaultConfiguration checkConfig = createCheckConfig(SingleLineJavadocCheck.class);
checkConfig.addAttribute("ignoreInlineTags", "false");
final Configuration checkConfig = getCheckConfig("SingleLineJavadoc");
final String filePath = getPath("InputSingleLineJavadocCheck.java");
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
@Test(expected = Exception.class)
public void customInlineTagTest() throws Exception {
final String msg = getCheckMessage(SingleLineJavadocCheck.class, "singleline.javadoc");
final Configuration checkConfig = getCheckConfig("SingleLineJavadocCheck");
final String filePath = getPath("InputSingleLineJavadocCheckError.java");
final String[] expected = {
"4: " + msg,
};
final Integer[] warnList = getLinesWithWarn(filePath);
verify(checkConfig, filePath, expected, warnList);
}
}

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2016 the original author or authors.
// Copyright (C) 2001-2017 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public

View File

@ -14,7 +14,7 @@ public class InputIllegalTokenText
public String wrongEscapeSequences()
{
final String r1 = "\u0008"; //warn
final String r1 = "\u0008"; //ok
final String r2 = "\u0009"; //warn
final String r3 = "\u000csssdfsd"; //warn
final String r4 = "\u1111sdfsd\444"; // ok
@ -39,7 +39,7 @@ public class InputIllegalTokenText
public void specialCharsWithWarn()
{
String r1 = "\\u0008"; // warn
String r1 = "\\u0008"; //ok
String r2 = "\\u0009"; // warn
String r3 = "\\u000a"; // warn
String r4 = "\\u000c"; // warn
@ -65,7 +65,7 @@ public class InputIllegalTokenText
{
public String wrongEscapeSequences()
{
final String r1 = "\u0008"; //warn
final String r1 = "\u0008"; //ok
final String r2 = "\u0009"; //warn
final String r3 = "\u000csssdfsd"; //warn
final String r4 = "\u1111sdfsd\444"; //ok
@ -90,7 +90,7 @@ public class InputIllegalTokenText
public void specialCharsWithWarn()
{
String r1 = "\\u0008"; // warn
String r1 = "\\u0008"; //ok
String r2 = "\\u0009"; // warn
String r3 = "\\u000a"; // warn
String r4 = "\\u000c"; // warn
@ -115,7 +115,7 @@ public class InputIllegalTokenText
Inner anoInner = new Inner(){
public String wrongEscapeSequences()
{
final String r1 = "\u0008"; //warn
final String r1 = "\u0008"; //ok
final String r2 = "\u0009"; //warn
final String r3 = "\u000csssdfsd"; //warn
final String r4 = "\u1111sdfsd\444"; //ok
@ -140,7 +140,7 @@ public class InputIllegalTokenText
public void specialCharsWithWarn()
{
String r1 = "\\u0008"; // warn
String r1 = "\\u0008"; //ok
String r2 = "\\u0009"; // warn
String r3 = "\\u000a"; // warn
String r4 = "\\u000c"; // warn

View File

@ -3,20 +3,17 @@ package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspaci
import static java.io.File.createTempFile;
import static java.awt.Button.ABORT; //warn
import static javax.swing.WindowConstants.*;
import java.awt.Button; //warn
import java.awt.Frame; //warn
import java.awt.Frame;
import java.awt.Dialog; //warn
import java.awt.event.ActionEvent; //warn
import javax.swing.JComponent; //warn
import javax.swing.JTable; //warn
import java.awt.event.ActionEvent;
import javax.swing.JComponent;
import javax.swing.JTable;
import java.io.File; //warn
import java.io.IOException; //warn
import java.io.InputStream; //warn
import java.io.Reader; //warn
import com.google.common.base.Ascii;
import com.google.common.base.Ascii; //warn
public class InputCustomImportOrder1 {}

View File

@ -4,13 +4,13 @@ import static java.io.File.createTempFile;
import static java.awt.Button.ABORT; //warn
import static javax.swing.WindowConstants.*;
import java.util.List; //warn
import java.util.StringTokenizer; //warn
import java.util.List;
import java.util.StringTokenizer;
import java.util.*; //warn
import java.util.concurrent.AbstractExecutorService; //warn
import java.util.concurrent.AbstractExecutorService;
import java.util.concurrent.*; //warn
import com.google.checkstyle.test.chapter2filebasic.rule21filename.*;
import com.google.checkstyle.test.chapter2filebasic.rule21filename.*; //warn
import com.sun.xml.internal.xsom.impl.scd.Iterators; //warn
import com.google.common.reflect.*; //warn

View File

@ -1,19 +1,18 @@
package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing;
import static java.io.File.createTempFile;
import static java.awt.Button.ABORT; //warn
import static javax.swing.WindowConstants.*;
import java.util.StringTokenizer; //warn
import java.util.*; //warn
import java.util.concurrent.AbstractExecutorService; //warn
import java.util.concurrent.*; //warn
import com.google.checkstyle.test.chapter2filebasic.rule21filename.*;
import com.sun.xml.internal.xsom.impl.scd.Iterators; //warn
import static java.awt.Button.ABORT;
import java.awt.Dialog; //warn
import static javax.swing.WindowConstants.*; //warn
import com.google.checkstyle.test.chapter2filebasic.rule21filename.*; //warn
import com.google.common.reflect.*; //warn
import com.sun.xml.internal.xsom.impl.scd.Iterators; //warn
import java.io.File;
import static java.io.File.createTempFile; //warn
import java.util.StringTokenizer;
import java.util.*; //warn
import java.util.concurrent.AbstractExecutorService;
import java.util.concurrent.*; //warn
public class InputCustomImportOrder3 {
}

View File

@ -0,0 +1,4 @@
package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing;
public class InputCustomImportOrderNoImports {
}

View File

@ -6,16 +6,14 @@ import static com.puppycrawl.tools.checkstyle.utils.AnnotationUtility.getAnnotat
import com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck;
import com.puppycrawl.tools.checkstyle.checks.design.ThrowsCountCheck;
import com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck;
import com.sun.accessibility.internal.resources.*;
import org.apache.commons.beanutils.converters.ArrayConverter;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import javax.accessibility.Accessible;
import org.apache.commons.beanutils.converters.ArrayConverter;
public class InputCustomImportOrderValid {
}

View File

@ -0,0 +1,93 @@
package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks;
import java.util.Scanner;
/**
* Test input for GitHub issue #3090.
* https://github.com/checkstyle/checkstyle/issues/3090
*/
public class InputRightCurlyDoWhileAlone {
public void foo1() {
do {
} while (true);
}
public void foo2() {
int i = 1;
while (i < 5) {
String.CASE_INSENSITIVE_ORDER.equals(i + " ");
i++;
}
}
public void foo3() {
int i = 1;
do {
i++;
String.CASE_INSENSITIVE_ORDER.equals(i + " ");
} while (i < 5);
}
public void foo4() {
int prog, user;
prog = (int)(Math.random() * 10) + 1;
Scanner input = new Scanner(System.in, "utf-8");
if( input.hasNextInt() ) {
do {
user = input.nextInt();
if(user == prog) {
String.CASE_INSENSITIVE_ORDER.equals("Good!");
} else {
if (user > 0 && user <= 10) {
String.CASE_INSENSITIVE_ORDER.equals("Bad! ");
if( prog < user ) {
String.CASE_INSENSITIVE_ORDER.equals("My number is less than yours.");
} else {
String.CASE_INSENSITIVE_ORDER.equals("My number is greater than yours.");
}
} else {
String.CASE_INSENSITIVE_ORDER.equals("Error!");
}
}
} while( user != prog );
} else {
String.CASE_INSENSITIVE_ORDER.equals("Error!");
}
String.CASE_INSENSITIVE_ORDER.equals("Goodbye!");
}
public void foo5() {
do {
} // ok - for alone
while (true);
}
public void foo6() {
do {} // ok - for alone
while (true);
}
public void foo7() {
do
{
} while (true);
}
public void foo8() {
do
{
} // ok - for alone
while
(true);
}
public void foo9() {
do {} while (true);
}
}

View File

@ -17,7 +17,7 @@ class InputRightCurlyOther
} else if (x < 0) { //ok
;
}
} //warn
else
{
break;
@ -29,7 +29,7 @@ class InputRightCurlyOther
default:
break;
} //ok
}
} //warn
catch (Exception e)
{
break;
@ -76,7 +76,7 @@ class InputRightCurlyOther
boolean flag = true;
if (flag) {
System.identityHashCode("heh");
flag = !flag; } System.
flag = !flag; } System. //warn
identityHashCode("Xe-xe");
@ -94,7 +94,7 @@ class FooCtor
public FooCtor()
{
i = 1;
}} //warn
}} //ok
/**
* Test input for closing brace if that brace terminates
@ -105,7 +105,7 @@ class FooMethod
public void fooMethod()
{
int i = 1;
}} //warn
}} //ok
/**
* Test input for closing brace if that brace terminates
@ -119,7 +119,7 @@ class FooInner
{
}
}} //warn
}} //ok
class EnumContainer {
private enum Suit { CLUBS, HEARTS, SPADES, DIAMONDS } // ok

View File

@ -0,0 +1,145 @@
package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks;
class InputRightCurlyOtherAlone
{
/** @see test method **/
int foo() throws InterruptedException
{
int x = 1;
int a = 2;
while (true)
{
try
{
if (x > 0)
{
break;
} else if (x < 0) { //ok
;
} //ok - for alone config
else
{
break;
}//ok
switch (a)
{
case 0:
break;
default:
break;
} //ok
} //ok - for alone config
catch (Exception e)
{
break;
}//ok
}//ok
synchronized (this)
{
do
{
x = 2;
} while (x == 2); //ok
}//ok
this.wait(666
); // Bizarre, but legal
for (int k = 0; k < 1; k++)
{
String innerBlockVariable = "";
}//ok
if (System.currentTimeMillis() > 1000)
return 1;
else
return 2;
}//ok
static
{
int x = 1;
}//ok
public enum GreetingsEnum
{
HELLO,
GOODBYE
}; //ok
void method2()
{
boolean flag = true;
if (flag) {
System.identityHashCode("heh");
flag = !flag; } System. //ok for alone config
identityHashCode("Xe-xe");
if (flag) { System.identityHashCode("some foo"); }
} //ok
} //ok
/**
* Test input for closing brace if that brace terminates
* a statement or the body of a constructor.
*/
class FooCtorAlone
{
int i;
public FooCtorAlone()
{
i = 1;
}} //warn
/**
* Test input for closing brace if that brace terminates
* a statement or the body of a method.
*/
class FooMethodAlone
{
public void fooMethod()
{
int i = 1;
}} //warn
/**
* Test input for closing brace if that brace terminates
* a statement or the body of a named class.
*/
class FooInnerAlone
{
class InnerFoo
{
public void fooInnerMethod ()
{
}
}} //warn
class EnumContainerAlone {
private enum Suit { CLUBS, HEARTS, SPADES, DIAMONDS } // ok
}
class WithArraysAlone {
String[] s = {""}; // ok
String[] empty = {}; // ok
String[] s1 = {
"foo", "foo",
}; // ok
String[] s2 =
{
"foo", "foo",
}; // ok
String[] s3 =
{
"foo",
"foo",
}; // ok
String[] s4 =
{"foo", "foo"}; // ok
}

View File

@ -1,5 +1,6 @@
package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@ -20,6 +21,14 @@ class InputOperatorWrap
false;
y = false
&& true;
/* Note: The three tests below will be used when issue #3381 is closed */
Arrays.sort(null, String
::
compareToIgnoreCase);
Arrays.sort(null, String:: /*(warn)*/
compareToIgnoreCase);
Arrays.sort(null, String
::compareToIgnoreCase);
}
void testAssignment()

View File

@ -1,351 +0,0 @@
package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak;
import java.util.HashMap;
import java.util.Map;
class InputOperatorWrapAssign
{
void test()
{
int x = 1 +
2 -
3
-
4;
x = x + 2;
boolean y = true
&&
false;
y = true &&
false;
y = false
&& true;
}
void testAssignment()
{
int x
= 0; //warn
int y =
0;
}
<
T extends Comparable &
java.io.Serializable
>
void testGenerics1()
{
Comparable
<
String
>
c = new String();
Map<String, String> map = new HashMap<String, String>();
boolean flag = false;
int init = 9;
for (Map.Entry<String, String> entry :
map.entrySet())
{
int i = flag == true ?
1 : 2;
}
if (init !=
9)
{
}
while (init ==
10)
{
}
if (init >
10)
{
} else {}
while (init < 10 ||
!flag) {
}
}
class Inner {
void testGenerics1
()
{
Comparable
<
String
>
c = new String();
Map<String, String> map = new HashMap<String, String>();
boolean flag = false;
int init = 9;
/*ok*/ for (Map.Entry<String, String> entry :
map.entrySet())
{
int i = flag == true ?
1 : 2;
}
if (init !=
9)
{
}
while (init ==
10)
{
}
if (init >
10)
{
} else {}
while (init < 10 ||
!flag) {
}
}
}
Inner anon = new Inner
(){
void testGenerics1
()
{
Comparable
<
String
>
c = new String();
Map<String, String> map = new HashMap<String, String>();
boolean flag = false;
int init = 9;
/*ok*/ for (Map.Entry<String, String> entry :
map.entrySet())
{
int i = flag == true ?
1 : 2;
}
if (init !=
9)
{
}
while (init ==
10)
{
}
if (init >
10)
{
} else {}
while (init < 10 ||
!flag) {
}
}
};
}
class AsInput3 {
int abc = 0;
String string
= "string"; // warn
double PI = // ok
3.1415;
}
class Ternary4 {
void foo() {
boolean flag = true;
int i = flag == true ?
1 :
2;
int i2 = flag == true
?
1
:
2;
int i3 = flag == true
? 1
: 2;
}
}
class AssignClass5 {
void foo() {
int i = 0;
int j = 0;
i +=
1;
j
+= 2; //warn
i -=
1;
j
-= 2; //warn
i /=
1;
j
/= 2; //warn
i *=
1;
j
*= 2; //warn
i %=
1;
j
%= 2; //warn
i ^=
1;
j
^= 2; //warn
i |=
1;
j
|= 2; //warn
i &=
1;
j
&= 2; //warn
i >>=
1;
j
>>= 2; //warn
i >>>=
1;
j
>>>= 2; //warn
i <<=
1;
j
<<= 2; //warn
}
class InnerClass {
void foo() {
int i = 0;
int j = 0;
i +=
1;
j
+= 2; //warn
i -=
1;
j
-= 2; //warn
i /=
1;
j
/= 2; //warn
i *=
1;
j
*= 2; //warn
i %=
1;
j
%= 2; //warn
i ^=
1;
j
^= 2; //warn
i |=
1;
j
|= 2; //warn
i &=
1;
j
&= 2; //warn
i >>=
1;
j
>>= 2; //warn
i >>>=
1;
j
>>>= 2; //warn
i <<=
1;
j
<<= 2; //warn
}
}
InnerClass anon = new InnerClass() {
void foo() {
int i = 0;
int j = 0;
i +=
1;
j
+= 2; //warn
i -=
1;
j
-= 2; //warn
i /=
1;
j
/= 2; //warn
i *=
1;
j
*= 2; //warn
i %=
1;
j
%= 2; //warn
i ^=
1;
j
^= 2; //warn
i |=
1;
j
|= 2; //warn
i &=
1;
j
&= 2; //warn
i >>=
1;
j
>>= 2; //warn
i >>>=
1;
j
>>>= 2; //warn
i <<=
1;
j
<<= 2; //warn
}
};
}

View File

@ -0,0 +1,45 @@
package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak;
public class InputSeparatorWrapComma {
public void goodCase()
{
int i = 0;
String s = "ffffooooString";
s
.isEmpty(); //ok
s.isEmpty();
foo(i,
s); //ok
}
public static void foo(int i, String s)
{
}
}
class badCaseComma {
public void goodCase(int... aFoo)
{
int i = 0;
String s = "ffffooooString";
boolean b = s.
isEmpty();
foo(i
,s); //warn
int[] j;
}
public static String foo(int i, String s)
{
String maxLength = "123";
int truncationLength = 1;
CharSequence seq = null;
Object truncationIndicator = null;
return new StringBuilder(maxLength )
.append(seq, 0, truncationLength )
.append(truncationIndicator)
.toString();
}
}

View File

@ -0,0 +1,63 @@
package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace;
import java.util.Vector;
/** Test input for MethodDefPadCheck */
public class InputMethodParamPad
{
public InputMethodParamPad()
{
super();
}
public InputMethodParamPad (int aParam) // warn
{
super (); // warn
}
public void method()
{
}
public void method (int aParam) // warn
{
}
public void
method(double aParam)
{
// invoke constructor
InputMethodParamPad pad = new InputMethodParamPad();
pad = new InputMethodParamPad (); // warn
pad = new
InputMethodParamPad();
// call method
method();
method (); // warn
}
public void dottedCalls()
{
this.method();
this.method (); // warn
this.
method();
InputMethodParamPad p = new InputMethodParamPad();
p.method();
p.method (); // warn
p.
method();
java.lang.Integer.parseInt("0");
java.lang.Integer.parseInt ("0"); // warn
java.lang.Integer.
parseInt("0");
}
public void newArray()
{
int[] a = new int[]{0, 1};
java.util.Vector<String> v = new java.util.Vector<String>();
java.util.Vector<String> v1 = new Vector<String>();
}
}

View File

@ -0,0 +1,134 @@
package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
public class InputParenPad
{
class ParenPadNoSpace {
ParenPadNoSpace() {
this(0);
}
ParenPadNoSpace(int i) {
super();
}
@SuppressWarnings("")
void method(boolean status) {
try (Writer writer = new StringWriter()) {
do {
writer.append("a");
} while (status);
} catch (IOException e) {
while (status) {
for (int i = 0; i < (long) (2 * (4 / 2)); i++) {
if (i > 2) {
synchronized (this) {
switch (i) {
case 3:
case (4):
case 5:
break;
}
}
}
}
}
}
}
}
class ParenPadSpaceLeft {
ParenPadSpaceLeft( ) { // warning
this( 0); // warning
}
ParenPadSpaceLeft( int i) { // warning
super( ); // warning
}
@SuppressWarnings( "") // warning
void method( boolean status) { // warning
try ( Writer writer = new StringWriter( )) { // warning
do {
writer.append("a");
} while ( status); // warning
} catch ( IOException e) { // warning
while ( status) { // warning
for ( int i = 0; i < ( long) ( 2 * ( 4 / 2)); i++) { // warning
if ( i > 2) { // warning
synchronized ( this) { // warning
switch ( i) { // warning
case 3:
case ( 4): // warning
case 5:
break;
}
}
}
}
}
}
}
}
class ParenPadSpaceRight {
ParenPadSpaceRight( ) { // warning
this(0 ); // warning
}
ParenPadSpaceRight(int i ) { // warning
super( ); // warning
}
@SuppressWarnings("" ) // warning
void method(boolean status ) { // warning
try (Writer writer = new StringWriter( ) ) { // warning
do {
writer.append("a" ); // warning
} while (status ); // warning
} catch (IOException e ) { // warning
while (status ) { // warning
for (int i = 0; i < (long ) (2 * (4 / 2 ) ); i++ ) { // warning
if (i > 2 ) { // warning
synchronized (this ) { // warning
switch (i ) { // warning
case 3:
case (4 ): // warning
case 5:
break;
}
}
}
}
}
}
}
}
String foo() {
return ( (Object // warning
) bar( ( 1 > 2 ) ? // warning
( ( 3 < 4 )? false : true ) : // warning
( ( 1 == 1 ) ? false : true) ) ).toString(); // warning
}
@MyAnnotation
public boolean bar(boolean a) {
assert ( true ); // warning
return true;
}
boolean fooo = this.bar(( true && false ) && true); // warning
}
@interface MyAnnotation {
String someField( ) default "Hello world"; // warning
}
enum MyEnum {
SOME_CONSTANT( ) { // warning
int i = (int) (2 * (4 / 2)
);
};
}

View File

@ -236,3 +236,24 @@ class SpecialCasesInForLoop
return null;
}
}
/**
* Operators mentioned in Google Coding Standards 2016-07-12
*/
class NewGoogleOperators
{
NewGoogleOperators()
{
Runnable l;
l = ()-> { }; //warn
l = () ->{ }; //warn
l = () -> { };
java.util.Arrays.sort(null, String :: compareToIgnoreCase);
java.util.Arrays.sort(null, String::compareToIgnoreCase);
new Object().toString();
new Object() . toString();
}
}

View File

@ -8,7 +8,7 @@ class myFoo
private void foo()
{
int i = 0;
String[][] x = {{"foo"}};
String[][] x = { {"foo"} };
for (int first = 0; first < 5; first++) {} //ok
int j = 0;
while (j == 1) {} //ok

View File

@ -1,7 +1,7 @@
package com.google.checkstyle.test.chapter4formatting.rule485annotations;
@MyAnnotation2 @MyAnnotation1 //warn
class InputCorrectAnnotationIndentation
class InputAnnotationLocation
{
@MyAnnotation2 @MyAnnotation1
@ -18,7 +18,7 @@ class InputCorrectAnnotationIndentation
@MyAnnotation2
@MyAnnotation1 //warn
public InputCorrectAnnotationIndentation() {}
public InputAnnotationLocation() {}
@MyAnnotationWithParam("foo")
@MyAnnotation2 void foo1() {}

Some files were not shown because too many files have changed in this diff Show More