Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function makepatch()
- {
- # remember current directory
- cwd=$(pwd);
- # check how many lines of unified context should be created
- if [ $# -eq 0 ]; then
- return;
- elif [ $# -eq 1 ]; then
- lines=5;
- else
- lines=$2;
- fi
- # create patch
- cd0adsvn;
- svn diff --diff-cmd diff -x "-p -U$lines" . > /media/tmpfs2/patch
- # restore current directory
- cd "$cwd";
- }
- function checkPatch()
- {
- # whitespace
- grep -n -P '^\+.*[[:blank:]]$' $1 # trailing whitespace
- grep -n -P '^\+.*\ \t' $1 # mixed whitespace
- # TODO: prohibit spaces before the first letter
- # TODO: warn if too many tabs are found
- # space in loops
- grep -n -P '^\+.*for\(' $1 # for(
- grep -n -P '^\+.*if\(' $1 # if(
- grep -n -P '^\+.*switch\(' $1 # switch(
- grep -n -P '^\+.*while\(' $1 # while(
- grep -n '\ No newline at end of file' $1 # file should end with newline
- # check that objects have spaces like { this }
- grep -n -P '^\+.*\{"' $1 # {"
- grep -n -P '^\+.*\)\}' $1 # )}
- grep -n -P '^\+.*\}\}' $1 # }}
- # Use unary plus instead of parseInt
- # both evaluate to NaN in case
- grep -n -P '^\+.*ParseInt\(' $1 # ParseInt
- # Use for ... of and for ... in
- # instead of for each
- grep -n -P '^\+.*for each' $1 # for each
- # Use fat arrow functions instead of inline functions
- grep -n -P '^\+.*function.*\{' $1
- ####################################
- # C++
- # CStr and CStrW should be used
- # instead of std::string and std::wstring
- grep -n -P '^\+.*std::string' $1 # CStr
- grep -n -P '^\+.*std::wstring' $1 # CStrW
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement