Skip to content

Instantly share code, notes, and snippets.

@yshrsmz
Created May 18, 2016 03:51
Show Gist options
  • Save yshrsmz/4425c03326f7f7826ac87ee76bcecd55 to your computer and use it in GitHub Desktop.
Save yshrsmz/4425c03326f7f7826ac87ee76bcecd55 to your computer and use it in GitHub Desktop.
saddler configs
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
rbenv versions
ruby -v
export GITHUB_ACCESS_TOKEN=MY_TOKEN
git remote -v
echo $ghprbActualCommit
echo $ghprbActualCommitAuthor
echo $ghprbActualCommitAuthorEmail
echo $ghprbPullDescription
echo $ghprbPullId
echo $ghprbPullLink
echo $ghprbPullTitle
echo $ghprbSourceBranch
echo $ghprbTargetBranch
echo $sha1
sh ./code_quality_tools/saddler.sh
#!/usr/bin/env bash
echo "********************"
echo "* install gems *"
echo "********************"
gem install --no-document checkstyle_filter-git saddler saddler-reporter-github findbugs_translate_checkstyle_format android_lint_translate_checkstyle_format pmd_translate_checkstyle_format
gem update checkstyle_filter-git saddler saddler-reporter-github saddler-reporter-support-git findbugs_translate_checkstyle_format android_lint_translate_checkstyle_format pmd_translate_checkstyle_format
if [ $? -ne 0 ]; then
echo 'Failed to install gems.'
exit 1
fi
echo "********************"
echo "* exec gradle *"
echo "********************"
./gradlew app:lintDevelopRelease app:checkstyle app:findbugs app:pmd app:cpd
if [ $? -ne 0 ]; then
echo 'Failed gradle check task.'
exit 1
fi
echo "********************"
echo "* save outputs *"
echo "********************"
LINT_RESULT_DIR="./.lint"
mkdir "$LINT_RESULT_DIR"
cp -v "app/build/reports/checkstyle/checkstyle.xml" "$LINT_RESULT_DIR/"
cp -v "app/build/reports/findbugs/findbugs.xml" "$LINT_RESULT_DIR/"
cp -v "app/build/reports/pmd/pmd.xml" "$LINT_RESULT_DIR/"
cp -v "app/build/reports/pmd/cpd.xml" "$LINT_RESULT_DIR/"
cp -v "app/build/outputs/lint-results.xml" "$LINT_RESULT_DIR/"
echo "********************"
echo "* select reporter *"
echo "********************"
#if [ -z "${CI_PULL_REQUEST}" ]; then
# # when not pull request
# REPORTER=Saddler::Reporter::Github::CommitReviewComment
#else
# REPORTER=Saddler::Reporter::Github::PullRequestReviewComment
#fi
REPORTER=Saddler::Reporter::Github::PullRequestReviewComment
#REPORTER=Saddler::Reporter::Github::PullRequestComment
echo "********************"
echo "* checkstyle *"
echo "********************"
cat app/build/reports/checkstyle/checkstyle.xml \
| checkstyle_filter-git diff origin/master \
| saddler report --debug --require saddler/reporter/github --reporter $REPORTER
echo "********************"
echo "* findbugs *"
echo "********************"
cat app/build/reports/findbugs/findbugs.xml \
| findbugs_translate_checkstyle_format translate \
| checkstyle_filter-git diff origin/master \
| saddler report --debug --require saddler/reporter/github --reporter $REPORTER
echo "********************"
echo "* PMD *"
echo "********************"
cat app/build/reports/pmd/pmd.xml \
| pmd_translate_checkstyle_format translate \
| checkstyle_filter-git diff origin/master \
| saddler report --debug --require saddler/reporter/github --reporter $REPORTER
echo "********************"
echo "* PMD-CPD *"
echo "********************"
cat app/build/reports/pmd/cpd.xml \
| pmd_translate_checkstyle_format translate --cpd-translate \
| checkstyle_filter-git diff origin/master \
| saddler report --debug --require saddler/reporter/github --reporter $REPORTER
echo "********************"
echo "* android lint *"
echo "********************"
cat app/build/outputs/lint-results.xml \
| android_lint_translate_checkstyle_format translate \
| checkstyle_filter-git diff origin/master \
| saddler report --debug --require saddler/reporter/github --reporter $REPORTER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment