Main /
JSCleaningWe would like to have clean JavaScript code. JSHintWe use JSHint to check for warnings. To run it on the accessors: Create a file that contains the .js files of interestThis uses $PTII/adm/bin/ptIItxtfiles >& /tmp/f cat /tmp/f | egrep '.js$' > /tmp/js cat /tmp/js | egrep '(actor/lib/jjs|org/terraswarm/accessor)' | egrep -v '(browser/modules|cordova.js|duk*/examples|duktape-sys|common/modules|events.js|ecma_eventloop.js|jsdoc/scripts|modules/testing|node_modules|node/test|test/auto|setTimeout-nashorn.js|test/manual|test/mocha|util.js|vendors)' > /tmp/jss JS FormattersSee JS Formatters for how we reformat code. CopyrightsA bit of a nightmare, really. This uses
Add Trailing NewlinesThis uses # Run addtrailingnl without actually doing anything: cat /tmp/jss | xargs $PTII/adm/bin/addtrailingnl -n # Run addtrailingnl with adding the new lines: cat /tmp/jss | xargs $PTII/adm/bin/addtrailingnl Fix Common ProblemsThis uses cat /tmp/jss | xargs ~/ptII/adm/bin/fixjs-files -n >& /tmp/ff # Review the contents of /tmp/ff, then run it for real: cat /tmp/jss | xargs ~/ptII/adm/bin/fixjs-files >& /tmp/ff Remove TabsThis uses cat /tmp/jss | xargs ~/ptII/util/testsuite/rmtabs -n # Inspect the output and then run for real: cat /tmp/jss | xargs ~/ptII/util/testsuite/rmtabs Remove Trailing SpacesThis uses cat /tmp/jss | xargs ~/ptII/util/testsuite/rmtrailingspace -n # Inspect the output and then run for real: cat /tmp/jss | xargs ~/ptII/util/testsuite/rmtrailingspace @AuthorAt least all the accessors should have @author tags: cat /tmp/jss | xargs grep @author | awk -F : '{print $1}' | sort > /tmp/jauthor cat /tmp/jss | xargs grep @accessor | awk -F : '{print $1}' | sort > /tmp/jaccessor comm -23 /tmp/jaccessor /tmp/jauthor Add Use @VersionWe use @version $$Id$$. The $$ is so that we avoid interpreting the value as a number in Ptolemy II cat /tmp/jss | xargs grep @version | awk -F : '{print $1}' | sort > /tmp/jversion cat /tmp/jss | xargs grep @accessor | awk -F : '{print $1}' | sort > /tmp/jaccessor comm -23 /tmp/jaccessor /tmp/jversion Then add Check with: cat /tmp/jss| xargs grep @version | grep -v '@version \$\$Id:.*\$\$' SVN PropertiesMake sure that svn:keywords and svn:eol-style are set. Run it separately for the ptII repo and for the accessors repo. This uses cd $PTII cat /tmp/jss | grep -v accessors/web| xargs $PTII/adm/bin/svnpropcheck > /tmp/props grep keywords: /tmp/props | grep / | awk '{print $1}' | egrep -v '.xml$' > /tmp/keys grep eolstyle: /tmp/props | grep / | awk '{print $1}' | egrep -v '.xml$'> /tmp/eols cat /tmp/keys | xargs svn propset svn:keywords "Author Date Id Revision" cat /tmp/eols | xargs svn propset svn:eol-style native svn commit -m "Added keywords and eol-style properties" `cat /tmp/eols /tmp/keys` cd $PTII/org/terraswarm/accessors/accessors/web cat /tmp/jss | grep accessors/web | sed 's@./org/terraswarm/accessor/accessors/web/@@' | xargs $PTII/adm/bin/svnpropcheck > /tmp/props grep keywords: /tmp/props | grep / | awk '{print $1}' | egrep -v '.xml$' > /tmp/keys grep eolstyle: /tmp/props | grep / | awk '{print $1}' | egrep -v '.xml$'> /tmp/eols cat /tmp/keys | xargs svn propset svn:keywords "Author Date Id Revision" cat /tmp/eols | xargs svn propset svn:eol-style native svn commit -m "Added keywords and eol-style properties" `cat /tmp/eols /tmp/keys` See Also |