Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #13 from saily/upstream_compat
Browse files Browse the repository at this point in the history
Use generic code-analysis template for jshint
  • Loading branch information
tisto committed May 16, 2014
2 parents ec3aa43 + 86c80fe commit e1f4d35
Showing 1 changed file with 19 additions and 39 deletions.
58 changes: 19 additions & 39 deletions jenkins-code-analysis.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ignore-pep8 =

# A comma-seperated list of CSSLint rules to check (+) or ignore (-)
# Learn more about rules: https://github.com/stubbornella/csslint/wiki
csslint-rules = -ids
csslint-ignore = adjoining-classes,floats,font-faces,font-sizes,ids,qualified-headings,unique-headings

# -----------------------------------------------------------------------------
# PEP 8 CODE ANALYSIS
Expand Down Expand Up @@ -307,7 +307,7 @@ mode = 755
recipe = collective.recipe.template
url = https://raw.github.com/plone/buildout.jenkins/master/templates/code-analysis.sh
title = JSLint
bin = /usr/local/bin/jslint
bin = jslint
log = jslint.log
before = $(command -v jslint >/dev/null 2>&1 || { echo >&2 "JSLint not found!"; echo "Skip JSLint code analysis. Please make sure JSLint is installed on your machine."; exit 1; })
analyse = $(find -L $pkg -regex ".*\.[cz]?js" | xargs -r jslint --jslint-reporter >> ${buildout:jenkins-directory}/jslint.log)
Expand All @@ -332,40 +332,20 @@ mode = 755

[jenkins-jshint]
recipe = collective.recipe.template
input = inline:
#!/bin/bash
command -v jshint >/dev/null 2>&1 || {
echo >&2 "jshint not found!";
echo "Skip jshint code analysis. Please make sure jshint is installed on your machine.";
exit 1;
}
if [ -e ${buildout:jenkins-directory}/jshint.log ]; then
echo "Old jshint.log file removed"
rm ${buildout:jenkins-directory}/jshint.log
fi
report=${buildout:jenkins-directory}/xml-jshint
if [ -d $report ]; then
echo "Old jshint xml reports removed"
rm -rf $report
fi

echo "Start jshint code analysis:"
PACKAGES="${buildout:jenkins-test-directories}"
for pkg in $PACKAGES
do
echo "Analyse $pkg"
mkdir -p $report/$pkg
for jsfile in `find -L $pkg -regex ".*\.js" | xargs -r `; do
jshint $jsfile >> ${buildout:jenkins-directory}/jshint.log
# XXX: dollar{jsfile##*/} does not work in template recipe
jsfilename=`echo $jsfile | awk -F\/ '{ print $NF }'`
jshint --jslint-reporter $jsfile > $report/$pkg/$jsfilename.xml
done
done

echo "Write log to ${buildout:jenkins-directory}/jshint.log"
echo "Finished."
echo ""
url = https://raw.github.com/plone/buildout.jenkins/master/templates/code-analysis.sh
title = JSHint
log = xml-jshint
bin = jshint
before =
analyse = $(\
report=${buildout:jenkins-directory}/xml-jshint; \
mkdir -p $report/$pkg; \
for jsfile in `find -L $pkg -regex ".*\.js" | xargs -r `; do \
jshint $jsfile >> ${buildout:jenkins-directory}/jshint.log; \
jsfilename=`echo $jsfile | awk -F\/ '{ print $NF }'`; \
jshint --reporter jslint $jsfile > $report/$pkg/$jsfilename.xml; \
done)
after =
output = ${buildout:directory}/bin/jenkins-code-analysis-jshint
mode = 755

Expand Down Expand Up @@ -439,15 +419,15 @@ recipe = collective.recipe.template
url = https://raw.github.com/plone/buildout.jenkins/master/templates/code-analysis.sh
title = CSSLint
log = xml-csslint
bin = /usr/local/bin/csslint
bin = csslint
before =
analyse = $(\
report=${buildout:jenkins-directory}/xml-csslint; \
mkdir -p $report/$pkg; \
for cssfile in `find -L $pkg -regex ".*\.css" | xargs -r `; do \
csslint --rules=${buildout:csslint-rules} $cssfile >> ${buildout:jenkins-directory}/csslint.log; \
csslint --ignore=${buildout:csslint-ignore} $cssfile >> ${buildout:jenkins-directory}/csslint.log; \
cssfilename=`echo $cssfile | awk -F\/ '{ print $NF }'`; \
csslint --format=lint-xml --rules=${buildout:csslint-rules} $cssfile > $report/$pkg/$cssfilename.xml; \
csslint --format=lint-xml --ignore=${buildout:csslint-ignore} $cssfile > $report/$pkg/$cssfilename.xml; \
done)
after =
output = ${buildout:directory}/bin/jenkins-code-analysis-csslint
Expand Down

0 comments on commit e1f4d35

Please sign in to comment.