Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #4682: add scripts for checking idea inspections
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
@echo off | ||
|
||
::---------------------------------------------------------------------- | ||
:: IntelliJ IDEA inspections for checkstyle. | ||
:: | ||
:: Example: | ||
:: SET IDEA_PATH=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2.1\bin\idea.bat | ||
:: .ci\idea_inspection.bat | ||
::---------------------------------------------------------------------- | ||
|
||
SET PROJECT_DIR=%CD%\ | ||
SET INSPECTIONS_PATH=%CD%\config\intellij-idea-inspections.xml | ||
SET RESULTS_DIR=%CD%\target\inspection-results | ||
SET NOISE_LVL=v1 | ||
SET IDEA_LOCATION= | ||
SET IDEA_PROPERTIES=%CD%\config\idea.properties | ||
|
||
::Check IDEA_PATH env variable | ||
IF EXIST %IDEA_PATH% SET ( | ||
SET IDEA_LOCATION=%IDEA_PATH% | ||
goto run | ||
) ELSE ( | ||
echo IDEA_PATH variable not found. | ||
) | ||
|
||
::Try to search in path | ||
FOR /f "delims=" %%i IN ('"where idea.bat"') DO SET IDEA_LOCATION="%%i" | ||
if [%IDEA_LOCATION%] NEQ [] ( | ||
goto run | ||
) ELSE ( | ||
echo IntelliJ IDEA was not found in path. | ||
exit /b | ||
) | ||
|
||
:run | ||
mkdir .idea\scopes | ||
copy config\intellij-idea-inspection-scope.xml .idea\scopes | ||
|
||
"%IDEA_LOCATION%" inspect %PROJECT_DIR% %INSPECTIONS_PATH% %RESULTS_DIR% -%NOISE_LVL% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash -e | ||
|
||
################################################# | ||
# IntelliJ IDEA inspections for checkstyle. | ||
# | ||
# Example Mac OS: | ||
# export IDEA_PATH="/Applications/IntelliJ IDEA.app/Contents/MacOS/idea" | ||
# bash ./.ci/idea_inspection.sh | ||
# | ||
# Example Linux: | ||
# export IDEA_PATH=/opt/idea-IC-171.4694.70/bin/idea.sh | ||
# export IDEA_PROPERTIES=$PWD/config/idea.properties | ||
# ./.ci/idea_inspection.sh | ||
################################################# | ||
|
||
PROJECT_DIR=$PWD/ | ||
INSPECTIONS_PATH=$PWD/config/intellij-idea-inspections.xml | ||
RESULTS_DIR=$PWD/target/inspection-results | ||
NOISE_LVL=v1 | ||
IDEA_LOCATION= | ||
export IDEA_PROPERTIES=$PWD/config/idea.properties | ||
|
||
# Check IDEA_PATH env variable | ||
|
||
if [[ ! -z $IDEA_PATH ]]; then | ||
IDEA_LOCATION=$IDEA_PATH | ||
else | ||
echo "IDEA_PATH variable not found." | ||
# Try to search in path | ||
IDEA_LOCATION="$(which idea)" | ||
if [ -z $IDEA_LOCATION ]; then | ||
echo "IntelliJ IDEA was not found in path." | ||
exit -1 | ||
fi | ||
fi | ||
|
||
mkdir -p $RESULTS_DIR | ||
rm -rf $RESULTS_DIR/* | ||
mkdir -p $PWD/.idea/scopes | ||
cp $PWD/config/intellij-idea-inspection-scope.xml $PWD/.idea/scopes | ||
|
||
echo "Validation is about to start ... progress output will be flushed at end. Validation is in progress ..." | ||
IDEA_OUTPUT=`exec "$IDEA_LOCATION" inspect $PROJECT_DIR $INSPECTIONS_PATH $RESULTS_DIR -$NOISE_LVL` | ||
echo $IDEA_OUTPUT | ||
|
||
echo "Checking results ..." | ||
if [[ $(grep "problems" $RESULTS_DIR/* --exclude="UnusedProperty.xml" --exclude="RedundantSuppression.xml" | cat | wc -l ) > 0 ]]; then | ||
echo "There are inspection problems. Review results at $RESULTS_DIR folder. Files:" | ||
grep -l "problems" $RESULTS_DIR/* --exclude="UnusedProperty.xml" --exclude="RedundantSuppression.xml" | ||
exit 1; | ||
else | ||
echo "Inpection did not found any problems" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
idea.exclude.patterns=src/test/resources/**;src/site/resources/js/google-analytics.js;src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/ParseTreeBuilder.java;src/test/java/com/puppycrawl/tools/checkstyle/grammars/javadoc/ParseTreeBuilder.java; |