Compare commits
311 Commits
master
...
hacked-lam
| Author | SHA1 | Date |
|---|---|---|
|
|
beac826751 | |
|
|
3912ebd212 | |
|
|
34b111caf4 | |
|
|
1df76feba2 | |
|
|
f9a6b2ae99 | |
|
|
3eaa031fb7 | |
|
|
29af968bb6 | |
|
|
cd88872f9d | |
|
|
e60bf1807a | |
|
|
6e8d1e0672 | |
|
|
a103ccf92b | |
|
|
1aa8bcf788 | |
|
|
7f33056426 | |
|
|
48d48fd097 | |
|
|
67bd379bd8 | |
|
|
fe882ab223 | |
|
|
34ef127bdc | |
|
|
2b645405ac | |
|
|
dcd5615e9e | |
|
|
2e29226c84 | |
|
|
4bc519ac05 | |
|
|
8b367e9d35 | |
|
|
dd0208b1ba | |
|
|
0f7c70e68f | |
|
|
e307efd92b | |
|
|
a169e60720 | |
|
|
88a419520b | |
|
|
c1254fa86e | |
|
|
887f5eadc9 | |
|
|
32a9dc0524 | |
|
|
c70fa5be40 | |
|
|
cbb03570a2 | |
|
|
f798045b3c | |
|
|
d3993feee8 | |
|
|
f382316e2f | |
|
|
c9fc6ba17d | |
|
|
90be9c61e1 | |
|
|
69bcd327f1 | |
|
|
c232625893 | |
|
|
d3edb92a5e | |
|
|
3e541237a1 | |
|
|
614b7647d8 | |
|
|
fef078d8cd | |
|
|
dab7a9af0e | |
|
|
837ae3bbb0 | |
|
|
8c0e0d0035 | |
|
|
a52c7a7a8a | |
|
|
0a1a355849 | |
|
|
071dc4bdcb | |
|
|
ecc429c92f | |
|
|
9bddb63a8e | |
|
|
668fd0b5ff | |
|
|
53df9f54f9 | |
|
|
5a6a87ac20 | |
|
|
112e5bc663 | |
|
|
4321a5064b | |
|
|
e5a6aad84e | |
|
|
5842b9014e | |
|
|
24c62a5f38 | |
|
|
3e0d60a921 | |
|
|
927f65ce8e | |
|
|
e6760f611a | |
|
|
3853b9ff4f | |
|
|
246661b42a | |
|
|
d4bec82ed1 | |
|
|
fcfacfc6ec | |
|
|
4a696a9771 | |
|
|
11e1eb3ddd | |
|
|
78a04e2b19 | |
|
|
9fcd877478 | |
|
|
7ef51d26e1 | |
|
|
eaa5d7da24 | |
|
|
d415955c27 | |
|
|
6cf06edddc | |
|
|
785ed054a6 | |
|
|
2551676ccf | |
|
|
b0d5b01b3c | |
|
|
4cff2eb714 | |
|
|
861612671a | |
|
|
b280c4c5c2 | |
|
|
619e3b3dce | |
|
|
4aacddab59 | |
|
|
4cda256567 | |
|
|
b4a337a599 | |
|
|
8e52504297 | |
|
|
f91b1af3d7 | |
|
|
f59e19992c | |
|
|
8ecdcc6d8e | |
|
|
81fae5eb1e | |
|
|
8df31cac3b | |
|
|
4b52e5dcf9 | |
|
|
e3686ca404 | |
|
|
3065df7eee | |
|
|
b57e4d3df6 | |
|
|
0cee0939c9 | |
|
|
258c440a01 | |
|
|
a73d0eb6f4 | |
|
|
2852e45bf6 | |
|
|
9dab0e74eb | |
|
|
9499f887d3 | |
|
|
045581b52d | |
|
|
31ba306454 | |
|
|
18934ddf54 | |
|
|
8a6774e1ee | |
|
|
d460db93b2 | |
|
|
b5074cc644 | |
|
|
b02376b11e | |
|
|
5a89089818 | |
|
|
4583fcbe0e | |
|
|
e48d90b15b | |
|
|
b3caf6fe0a | |
|
|
b3849a2049 | |
|
|
7f4e1217bc | |
|
|
fde083d175 | |
|
|
bcd5297cea | |
|
|
e40971942a | |
|
|
d60250393e | |
|
|
0cb01724ac | |
|
|
32285aadd7 | |
|
|
0844fffc64 | |
|
|
39cafcc5bb | |
|
|
0b36159898 | |
|
|
9b05fefd03 | |
|
|
fa2f05a533 | |
|
|
db47f55962 | |
|
|
2c81de1bb0 | |
|
|
54058853b9 | |
|
|
95e621c0e5 | |
|
|
0e7eaaccb3 | |
|
|
16aadebeee | |
|
|
cd3a79d233 | |
|
|
5c8ae2b45e | |
|
|
424ce6506e | |
|
|
ee0fbe9065 | |
|
|
0fdbbda102 | |
|
|
914dd9994c | |
|
|
c25004bd03 | |
|
|
96393a3dd9 | |
|
|
3f3a80714e | |
|
|
5f1e55bf1c | |
|
|
92aea351ad | |
|
|
8e9c98f1f8 | |
|
|
0248bb4d2e | |
|
|
e3baa51b00 | |
|
|
d9c1b95d72 | |
|
|
8cc03cbf11 | |
|
|
b0972bab3f | |
|
|
d24405c088 | |
|
|
ce54507376 | |
|
|
bbfe5a1b69 | |
|
|
1f5237f587 | |
|
|
1dea8dc3bb | |
|
|
52d009b3f8 | |
|
|
026c01bee4 | |
|
|
81889c9a97 | |
|
|
292d92baca | |
|
|
4d25a08063 | |
|
|
2197a604dd | |
|
|
9321a5bec6 | |
|
|
1bf40e8418 | |
|
|
2b59f39b16 | |
|
|
5b73516ca1 | |
|
|
65fe91df6a | |
|
|
c2bbc9753b | |
|
|
fd880587e3 | |
|
|
f600ac2df9 | |
|
|
983c8b087d | |
|
|
90dc0666ba | |
|
|
83507a07ab | |
|
|
01e039a0fb | |
|
|
61684248e7 | |
|
|
2d23e27181 | |
|
|
bd5ea09b31 | |
|
|
4f64bd427a | |
|
|
ee758e1997 | |
|
|
e60d4545a7 | |
|
|
032742cf6c | |
|
|
dea98c8ce9 | |
|
|
c5bf1ac741 | |
|
|
029ab124cf | |
|
|
32a7a33360 | |
|
|
ace65c09fb | |
|
|
9f53d5f39f | |
|
|
42b71efdda | |
|
|
d1aa8e3b40 | |
|
|
ed6b9004ea | |
|
|
4a540b4aec | |
|
|
82d58d5cff | |
|
|
cd91999dec | |
|
|
9d9053066e | |
|
|
4c2649f572 | |
|
|
ba178a2bb1 | |
|
|
ec2834e43a | |
|
|
3f3dedeacc | |
|
|
9ebd617439 | |
|
|
4ffcaad67d | |
|
|
5d655dce40 | |
|
|
40a7f33b26 | |
|
|
b61daf7f44 | |
|
|
4d214096fc | |
|
|
636ae05d05 | |
|
|
62e1209c81 | |
|
|
292ad0ebf2 | |
|
|
98a1956d12 | |
|
|
68864dce8d | |
|
|
3ddf152905 | |
|
|
a0b86b845b | |
|
|
266b409f9c | |
|
|
f5a211ee68 | |
|
|
94a7d07b64 | |
|
|
1b91687d6a | |
|
|
2c6fd416b7 | |
|
|
687ad78c81 | |
|
|
3a8f8d6f39 | |
|
|
ff83a8faec | |
|
|
0cdbac0761 | |
|
|
bfed57cdc8 | |
|
|
825e6a8fcd | |
|
|
14958258fc | |
|
|
323faa9b6e | |
|
|
9290001af2 | |
|
|
a25cfffcd0 | |
|
|
57f1c26d1c | |
|
|
a8093f1f9f | |
|
|
cda594d226 | |
|
|
34c46f7808 | |
|
|
63125517be | |
|
|
d61783cb9c | |
|
|
38d519ce98 | |
|
|
56a33b5ee2 | |
|
|
f84e26aa91 | |
|
|
a8aece366e | |
|
|
a6e50f745e | |
|
|
6f82844f83 | |
|
|
1b7219e839 | |
|
|
82bf6a6410 | |
|
|
0e8c819d0e | |
|
|
19ffe1bb1b | |
|
|
84015bb21c | |
|
|
481406f2d5 | |
|
|
62d4bfe0dd | |
|
|
23202260b2 | |
|
|
d49732c325 | |
|
|
fcf1ada75f | |
|
|
bc40bc5fab | |
|
|
b8c7c15d63 | |
|
|
33b026ab17 | |
|
|
548ecd7022 | |
|
|
a1e1403df4 | |
|
|
4e684926cf | |
|
|
0fb94f14ef | |
|
|
441d2d3700 | |
|
|
56cc11416e | |
|
|
a963f8a21b | |
|
|
ad5edc7935 | |
|
|
8888fa5919 | |
|
|
f6261dcaa3 | |
|
|
8c8fee7432 | |
|
|
1a08a8f34e | |
|
|
6f2b7bdce7 | |
|
|
b99c7d976c | |
|
|
81ad4595fe | |
|
|
e4996697e8 | |
|
|
a0a63e313f | |
|
|
d740cd40d3 | |
|
|
62926b6106 | |
|
|
dda0b9e3ca | |
|
|
0ac73d822e | |
|
|
3ecce283b2 | |
|
|
5cb0f9d39a | |
|
|
a7f35dbd03 | |
|
|
929d391fea | |
|
|
47e526ef0a | |
|
|
be6f1f6f2c | |
|
|
c8d61e5d32 | |
|
|
263b1502d8 | |
|
|
5530d4c27d | |
|
|
e9b3b9cded | |
|
|
27b03291ce | |
|
|
0e7beca9fc | |
|
|
fbaabe83cf | |
|
|
e163d24909 | |
|
|
a9793a93ba | |
|
|
06716249cf | |
|
|
6da10046f9 | |
|
|
55202bf936 | |
|
|
74cb1b506b | |
|
|
63e8c1dd4e | |
|
|
f77a01ba36 | |
|
|
864060df97 | |
|
|
c2847eae88 | |
|
|
a3e4bcc8b7 | |
|
|
777e55a84d | |
|
|
bd6a042192 | |
|
|
7b5f86ad99 | |
|
|
e62783abc8 | |
|
|
a61e0a3267 | |
|
|
2aaa37b76c | |
|
|
d30b24d16f | |
|
|
4b7adec5ae | |
|
|
2577c4121c | |
|
|
9a3529c422 | |
|
|
22c2bd7323 | |
|
|
b4f6660aad | |
|
|
160f83918c | |
|
|
674db6733e | |
|
|
0e15ff7266 | |
|
|
2569839c27 | |
|
|
08f8c52edd | |
|
|
7df9062262 | |
|
|
4667eb8825 |
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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]]
|
||||
|
||||
---------------
|
||||
|
|
|
|||
378
.travis.yml
378
.travis.yml
|
|
@ -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
38
LICENSE
|
|
@ -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!
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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: >
|
||||
|
|
|
|||
52
circle.yml
52
circle.yml
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -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"/>
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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-->
|
||||
|
|
|
|||
|
|
@ -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"/>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing;
|
||||
|
||||
public class InputCustomImportOrderNoImports {
|
||||
}
|
||||
|
|
@ -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 {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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>();
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
Loading…
Reference in New Issue