#!/bin/bash ## usage: bash batch-1.sh.txt #[ -n "$1" ] && EDITOR="$1" #if [ -z "$EDITOR" ]; then # echo "Please provide parameter 1 (editor). Example: vi, joe" # exit 1 #fi function edit_at_line() { local f="$1" local l="$2" $EDITOR +$l "$f" } function ask_continue() { local line="" while [ "$line" != "y" -a "$line" != "n" ]; do echo -n "$1 (Y/n) " read line if [ -z "$line" ]; then line=y fi done if [ "$line" == "y" ]; then return 0 else return 1 fi } echo 'Welcome and thanks for helping with the cleanup!' echo '' echo 'This script will walk through a series of code-style issues in Civi'\''s PHP code.' echo 'For each issue, it will show a summary of the issue (ie how many files are' echo 'affected, how many lines of code are affected, and what detailed messages' echo 'are available about the issues.' echo '' echo 'The script will open the first file at the offending line so that you can fix' echo 'it. Please save, edit, close. The script will then repeat -- re-opening the text' echo 'editor at each offending line.' echo '' echo 'The script should generally open on the exact line with the problem; however,' echo 'if other changes were recently made to the file, then the line numbers may be' echo 'slightly off - if you don'\''t see a problem, then check the neighboring lines.' ask_continue 'Continue?' || exit echo '' echo 'What text editor would you prefer to use? [vi, emacs, joe]?' read EDITOR echo '===============================================================' echo 'Formatting issue: Drupal.Array.Array' echo 'Messages:Array ( [0] => A comma should follow the last multiline array item. Found: '\''wordpress'\'' [1] => A comma should follow the last multiline array item. Found: '\''modules'\'' [2] => A comma should follow the last multiline array item. Found: $siteDir [3] => A comma should follow the last multiline array item. Found: ) [4] => A comma should follow the last multiline array item. Found: \"There is no $dir folder\" [5] => A comma should follow the last multiline array item. Found: \"You seem to be using an unsupported webserver. The server variables SCRIPT_NAME, HTTP_HOST, SCRIPT_FILENAME need to be set.\" [6] => A comma should follow the last multiline array item. Found: $perm ) ' echo 'Lines:Array ( [0] => install/index.php:55 [1] => install/index.php:96 [2] => install/index.php:178 [3] => install/index.php:416 [4] => install/index.php:446 [5] => install/index.php:506 [6] => install/index.php:1435 ) ' echo '' echo 'Total number of edits to perform: 7' if ask_continue 'Edit these files?'; then edit_at_line 'install/index.php' 55 edit_at_line 'install/index.php' 96 edit_at_line 'install/index.php' 178 edit_at_line 'install/index.php' 416 edit_at_line 'install/index.php' 446 edit_at_line 'install/index.php' 506 edit_at_line 'install/index.php' 1435 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Array.Array!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Squiz.Scope.MethodScope.Missing' echo 'Messages:Array ( [0] => Visibility must be declared on method \"checkdatabase\" [1] => Visibility must be declared on method \"check\" [2] => Visibility must be declared on method \"requireMemory\" [3] => Visibility must be declared on method \"getPHPMemory\" [4] => Visibility must be declared on method \"listErrors\" [5] => Visibility must be declared on method \"showTable\" [6] => Visibility must be declared on method \"requireFunction\" [7] => Visibility must be declared on method \"checkXCache\" [8] => Visibility must be declared on method \"requirePHPVersion\" [9] => Visibility must be declared on method \"requireFile\" [10] => Visibility must be declared on method \"requireNoPathSeparator\" [11] => Visibility must be declared on method \"requireNoFile\" [12] => Visibility must be declared on method \"moveFileOutOfTheWay\" [13] => Visibility must be declared on method \"requireWriteable\" [14] => Visibility must be declared on method \"requireApacheModule\" [15] => Visibility must be declared on method \"requireMysqlConnection\" [16] => Visibility must be declared on method \"requireMySQLServer\" [17] => Visibility must be declared on method \"requireMySQLVersion\" [18] => Visibility must be declared on method \"requireMySQLInnoDB\" [19] => Visibility must be declared on method \"requireMySQLTempTables\" [20] => Visibility must be declared on method \"requireMySQLTrigger\" [21] => Visibility must be declared on method \"requireMySQLLockTables\" [22] => Visibility must be declared on method \"requireMySQLAutoIncrementIncrementOne\" [23] => Visibility must be declared on method \"requireMySQLThreadStack\" [24] => Visibility must be declared on method \"requireDatabaseOrCreatePermissions\" [25] => Visibility must be declared on method \"requireServerVariables\" [26] => Visibility must be declared on method \"isRunningApache\" [27] => Visibility must be declared on method \"getBaseDir\" [28] => Visibility must be declared on method \"testing\" [29] => Visibility must be declared on method \"error\" [30] => Visibility must be declared on method \"warning\" [31] => Visibility must be declared on method \"hasErrors\" [32] => Visibility must be declared on method \"hasWarnings\" [33] => Visibility must be declared on method \"createDatabaseIfNotExists\" [34] => Visibility must be declared on method \"install\" [35] => Visibility must be declared on method \"whereClause\" [36] => Visibility must be declared on method \"dateClause\" [37] => Visibility must be declared on method \"theme\" [38] => Visibility must be declared on method \"url\" [39] => Visibility must be declared on method \"href\" [40] => Visibility must be declared on method \"jsRedirect\" [41] => Visibility must be declared on method \"download\" [42] => Visibility must be declared on method \"languageNegotiationURL\" [43] => Visibility must be declared on method \"appendTPLFile\" [44] => Visibility must be declared on method \"__construct\" [45] => Visibility must be declared on method \"register\" ) ' echo 'Lines:Array ( [0] => install/index.php:289 [1] => install/index.php:407 [2] => install/index.php:545 [3] => install/index.php:566 [4] => install/index.php:584 [5] => install/index.php:596 [6] => install/index.php:624 [7] => install/index.php:639 [8] => install/index.php:653 [9] => install/index.php:685 [10] => install/index.php:699 [11] => install/index.php:710 [12] => install/index.php:723 [13] => install/index.php:739 [14] => install/index.php:764 [15] => install/index.php:777 [16] => install/index.php:794 [17] => install/index.php:811 [18] => install/index.php:839 [19] => install/index.php:874 [20] => install/index.php:904 [21] => install/index.php:944 [22] => install/index.php:992 [23] => install/index.php:1026 [24] => install/index.php:1063 [25] => install/index.php:1104 [26] => install/index.php:1125 [27] => install/index.php:1138 [28] => install/index.php:1145 [29] => install/index.php:1164 [30] => install/index.php:1175 [31] => install/index.php:1186 [32] => install/index.php:1193 [33] => install/index.php:1208 [34] => install/index.php:1230 [35] => CRM/Report/Form.php:1421 [36] => CRM/Report/Form.php:1607 [37] => CRM/Utils/System.php:186 [38] => CRM/Utils/System.php:232 [39] => CRM/Utils/System.php:264 [40] => CRM/Utils/System.php:430 [41] => CRM/Utils/System.php:802 [42] => CRM/Utils/System.php:1645 [43] => CRM/Utils/System.php:1667 [44] => CRM/Contribute/StateMachine/Search.php:47 [45] => CRM/Core/BAO/Log.php:89 ) ' echo '' echo 'Total number of edits to perform: 46' if ask_continue 'Edit these files?'; then edit_at_line 'install/index.php' 289 edit_at_line 'install/index.php' 407 edit_at_line 'install/index.php' 545 edit_at_line 'install/index.php' 566 edit_at_line 'install/index.php' 584 edit_at_line 'install/index.php' 596 edit_at_line 'install/index.php' 624 edit_at_line 'install/index.php' 639 edit_at_line 'install/index.php' 653 edit_at_line 'install/index.php' 685 edit_at_line 'install/index.php' 699 edit_at_line 'install/index.php' 710 edit_at_line 'install/index.php' 723 edit_at_line 'install/index.php' 739 edit_at_line 'install/index.php' 764 edit_at_line 'install/index.php' 777 edit_at_line 'install/index.php' 794 edit_at_line 'install/index.php' 811 edit_at_line 'install/index.php' 839 edit_at_line 'install/index.php' 874 edit_at_line 'install/index.php' 904 edit_at_line 'install/index.php' 944 edit_at_line 'install/index.php' 992 edit_at_line 'install/index.php' 1026 edit_at_line 'install/index.php' 1063 edit_at_line 'install/index.php' 1104 edit_at_line 'install/index.php' 1125 edit_at_line 'install/index.php' 1138 edit_at_line 'install/index.php' 1145 edit_at_line 'install/index.php' 1164 edit_at_line 'install/index.php' 1175 edit_at_line 'install/index.php' 1186 edit_at_line 'install/index.php' 1193 edit_at_line 'install/index.php' 1208 edit_at_line 'install/index.php' 1230 edit_at_line 'CRM/Report/Form.php' 1421 edit_at_line 'CRM/Report/Form.php' 1607 edit_at_line 'CRM/Utils/System.php' 186 edit_at_line 'CRM/Utils/System.php' 232 edit_at_line 'CRM/Utils/System.php' 264 edit_at_line 'CRM/Utils/System.php' 430 edit_at_line 'CRM/Utils/System.php' 802 edit_at_line 'CRM/Utils/System.php' 1645 edit_at_line 'CRM/Utils/System.php' 1667 edit_at_line 'CRM/Contribute/StateMachine/Search.php' 47 edit_at_line 'CRM/Core/BAO/Log.php' 89 echo '===============================================================' echo '' echo 'Completed formatting issue Squiz.Scope.MethodScope.Missing!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Squiz.PHP.NonExecutableCode.ReturnNotRequired' echo 'Messages:Array ( [0] => Empty return statement not required here ) ' echo 'Lines:Array ( [0] => install/index.php:983 ) ' echo '' echo 'Total number of edits to perform: 1' if ask_continue 'Edit these files?'; then edit_at_line 'install/index.php' 983 echo '===============================================================' echo '' echo 'Completed formatting issue Squiz.PHP.NonExecutableCode.ReturnNotRequired!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Semantics.FunctionAlias.FunctionAlias' echo 'Messages:Array ( [0] => sizeof() is a function name alias, use count() instead ) ' echo 'Lines:Array ( [0] => install/index.php:1187 [1] => install/index.php:1194 ) ' echo '' echo 'Total number of edits to perform: 2' if ask_continue 'Edit these files?'; then edit_at_line 'install/index.php' 1187 edit_at_line 'install/index.php' 1194 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Semantics.FunctionAlias.FunctionAlias!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Commenting.FunctionComment.InvalidNoReturn' echo 'Messages:Array ( [0] => @return doc comment specified, but function has no return statement ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:58 [1] => api/v3/utils.php:82 [2] => api/v3/utils.php:945 [3] => api/v3/Job.php:87 [4] => api/v3/Job.php:547 [5] => CRM/Core/Component/Config.php:47 ) ' echo '' echo 'Total number of edits to perform: 6' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 58 edit_at_line 'api/v3/utils.php' 82 edit_at_line 'api/v3/utils.php' 945 edit_at_line 'api/v3/Job.php' 87 edit_at_line 'api/v3/Job.php' 547 edit_at_line 'CRM/Core/Component/Config.php' 47 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Commenting.FunctionComment.InvalidNoReturn!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Commenting.FunctionComment.ReturnCommentIndentation' echo 'Messages:Array ( [0] => Return comment indentation must be 3 spaces, found 1 spaces ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:60 [1] => api/v3/Job.php:65 [2] => api/v3/Job.php:76 [3] => api/v3/Job.php:89 [4] => api/v3/Note.php:96 ) ' echo '' echo 'Total number of edits to perform: 5' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 60 edit_at_line 'api/v3/Job.php' 65 edit_at_line 'api/v3/Job.php' 76 edit_at_line 'api/v3/Job.php' 89 edit_at_line 'api/v3/Note.php' 96 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Commenting.FunctionComment.ReturnCommentIndentation!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace' echo 'Messages:Array ( [0] => There should be no white space after an opening \"{\" [1] => There should be no white space after an opening \"(\" ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:530 [1] => api/v3/utils.php:1856 [2] => CRM/UF/Page/ProfileEditor.php:232 ) ' echo '' echo 'Total number of edits to perform: 3' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 530 edit_at_line 'api/v3/utils.php' 1856 edit_at_line 'CRM/UF/Page/ProfileEditor.php' 232 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Commenting.FunctionComment.MissingReturnType' echo 'Messages:Array ( [0] => Return type missing for @return tag in function comment ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:829 [1] => api/v3/utils.php:1749 ) ' echo '' echo 'Total number of edits to perform: 2' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 829 edit_at_line 'api/v3/utils.php' 1749 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Commenting.FunctionComment.MissingReturnType!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Commenting.FunctionComment.ParamNameNoMatch' echo 'Messages:Array ( [0] => Doc comment for parameter $entity does not match actual variable name $params [1] => Doc comment for parameter $value: does not match actual variable name $fieldName [2] => Doc comment for parameter $options: does not match actual variable name $fieldName [3] => Doc comment for parameter $fieldName: does not match actual variable name $fieldName ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:920 [1] => api/v3/utils.php:2026 [2] => api/v3/utils.php:2027 [3] => api/v3/utils.php:2028 ) ' echo '' echo 'Total number of edits to perform: 4' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 920 edit_at_line 'api/v3/utils.php' 2026 edit_at_line 'api/v3/utils.php' 2027 edit_at_line 'api/v3/utils.php' 2028 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Commenting.FunctionComment.ParamNameNoMatch!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.WhiteSpace.ScopeIndent.Incorrect' echo 'Messages:Array ( [0] => Line indented incorrectly; expected 6 spaces, found 4 ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1416 ) ' echo '' echo 'Total number of edits to perform: 1' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1416 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.WhiteSpace.ScopeIndent.Incorrect!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.WhiteSpace.ScopeClosingBrace.BreakIdent' echo 'Messages:Array ( [0] => Case breaking statement indented incorrectly; expected 6 spaces, found 8 ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1418 ) ' echo '' echo 'Total number of edits to perform: 1' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1418 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.WhiteSpace.ScopeClosingBrace.BreakIdent!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.ControlStructures.ControlSignature' echo 'Messages:Array ( [0] => Expected \"foreach (...) {\n\"; found \"foreach(...) {\n\" [1] => Expected \"if (...) {\n\"; found \"if (...)\n {\n\" [2] => Expected \"if (...) {\n\"; found \"if(...) {\n\" ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1429 [1] => api/v3/utils.php:1800 [2] => api/v3/utils.php:1854 ) ' echo '' echo 'Total number of edits to perform: 3' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1429 edit_at_line 'api/v3/utils.php' 1800 edit_at_line 'api/v3/utils.php' 1854 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.ControlStructures.ControlSignature!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Generic.Formatting.SpaceAfterCast.NoSpace' echo 'Messages:Array ( [0] => A cast statement must be followed by a single space ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1429 ) ' echo '' echo 'Total number of edits to perform: 1' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1429 echo '===============================================================' echo '' echo 'Completed formatting issue Generic.Formatting.SpaceAfterCast.NoSpace!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Classes.ClassCreateInstance' echo 'Messages:Array ( [0] => Calling class constructors must always include parentheses ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1530 ) ' echo '' echo 'Total number of edits to perform: 1' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1530 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Classes.ClassCreateInstance!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Squiz.Arrays.ArrayDeclaration.NoSpaceAfterComma' echo 'Messages:Array ( [0] => Expected 1 space between comma and \"\"type\"\"; 0 found [1] => Expected 1 space between comma and \"\"error_code\"\"; 0 found ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1837 [1] => api/v3/utils.php:1915 ) ' echo '' echo 'Total number of edits to perform: 2' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1837 edit_at_line 'api/v3/utils.php' 1915 echo '===============================================================' echo '' echo 'Completed formatting issue Squiz.Arrays.ArrayDeclaration.NoSpaceAfterComma!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.WhiteSpace.Comma.NoSpace' echo 'Messages:Array ( [0] => Expected one space after the comma, 0 found ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1837 [1] => api/v3/utils.php:1915 [2] => api/v3/Job.php:373 ) ' echo '' echo 'Total number of edits to perform: 4' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1837 edit_at_line 'api/v3/utils.php' 1915 edit_at_line 'api/v3/Job.php' 373 edit_at_line 'api/v3/Job.php' 373 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.WhiteSpace.Comma.NoSpace!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Squiz.Arrays.ArrayDeclaration.NoSpaceBeforeDoubleArrow' echo 'Messages:Array ( [0] => Expected 1 space between \"\"type\"\" and double arrow; 0 found [1] => Expected 1 space between \"\"max_length\"\" and double arrow; 0 found [2] => Expected 1 space between \"\"field\"\" and double arrow; 0 found [3] => Expected 1 space between \"\"error_code\"\" and double arrow; 0 found ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1837 [1] => api/v3/utils.php:1857 [2] => api/v3/utils.php:1915 ) ' echo '' echo 'Total number of edits to perform: 4' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1837 edit_at_line 'api/v3/utils.php' 1857 edit_at_line 'api/v3/utils.php' 1915 edit_at_line 'api/v3/utils.php' 1915 echo '===============================================================' echo '' echo 'Completed formatting issue Squiz.Arrays.ArrayDeclaration.NoSpaceBeforeDoubleArrow!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Squiz.Arrays.ArrayDeclaration.NoSpaceAfterDoubleArrow' echo 'Messages:Array ( [0] => Expected 1 space between double arrow and \"\"integer\"\"; 0 found [1] => Expected 1 space between double arrow and \"$fieldInfo\"; 0 found [2] => Expected 1 space between double arrow and \"$fieldName\"; 0 found [3] => Expected 1 space between double arrow and \"\"xss\"\"; 0 found ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1837 [1] => api/v3/utils.php:1857 [2] => api/v3/utils.php:1915 ) ' echo '' echo 'Total number of edits to perform: 4' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1837 edit_at_line 'api/v3/utils.php' 1857 edit_at_line 'api/v3/utils.php' 1915 edit_at_line 'api/v3/utils.php' 1915 echo '===============================================================' echo '' echo 'Completed formatting issue Squiz.Arrays.ArrayDeclaration.NoSpaceAfterDoubleArrow!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.WhiteSpace.OperatorSpacing.NoSpaceBefore' echo 'Messages:Array ( [0] => Expected 1 space before \"=>\"; 0 found ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1837 [1] => api/v3/utils.php:1857 [2] => api/v3/utils.php:1915 ) ' echo '' echo 'Total number of edits to perform: 4' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1837 edit_at_line 'api/v3/utils.php' 1857 edit_at_line 'api/v3/utils.php' 1915 edit_at_line 'api/v3/utils.php' 1915 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.WhiteSpace.OperatorSpacing.NoSpaceBefore!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.WhiteSpace.OperatorSpacing.NoSpaceAfter' echo 'Messages:Array ( [0] => Expected 1 space after \"=>\"; 0 found ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1837 [1] => api/v3/utils.php:1857 [2] => api/v3/utils.php:1915 ) ' echo '' echo 'Total number of edits to perform: 4' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1837 edit_at_line 'api/v3/utils.php' 1857 edit_at_line 'api/v3/utils.php' 1915 edit_at_line 'api/v3/utils.php' 1915 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.WhiteSpace.OperatorSpacing.NoSpaceAfter!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.ControlStructures.ElseCatchNewline.ElseNewline' echo 'Messages:Array ( [0] => elseif must start on a new line ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:1838 ) ' echo '' echo 'Total number of edits to perform: 1' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 1838 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.ControlStructures.ElseCatchNewline.ElseNewline!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Commenting.FunctionComment.InvalidReturn' echo 'Messages:Array ( [0] => Expected \"string|int|bool|date|null\" but found \"string|int|boolean|date|null\" for function return type [1] => Expected \"bool\" but found \"boolean\" for function return type [2] => Expected \"array\" but found \"Array\" for function return type ) ' echo 'Lines:Array ( [0] => api/v3/utils.php:2119 [1] => api/v3/Job.php:412 [2] => api/v3/Job.php:439 [3] => api/v3/Job.php:547 [4] => CRM/Report/Form.php:3551 ) ' echo '' echo 'Total number of edits to perform: 5' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/utils.php' 2119 edit_at_line 'api/v3/Job.php' 412 edit_at_line 'api/v3/Job.php' 439 edit_at_line 'api/v3/Job.php' 547 edit_at_line 'CRM/Report/Form.php' 3551 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Commenting.FunctionComment.InvalidReturn!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Commenting.FunctionComment.MissingParamName' echo 'Messages:Array ( [0] => Missing parameter name ) ' echo 'Lines:Array ( [0] => api/v3/Job.php:73 ) ' echo '' echo 'Total number of edits to perform: 1' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/Job.php' 73 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Commenting.FunctionComment.MissingParamName!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint' echo 'Messages:Array ( [0] => Expected 1 space between type hint and argument \"$params\"; 2 found ) ' echo 'Lines:Array ( [0] => api/v3/Job.php:105 [1] => api/v3/Job.php:415 [2] => api/v3/Job.php:581 ) ' echo '' echo 'Total number of edits to perform: 3' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/Job.php' 105 edit_at_line 'api/v3/Job.php' 415 edit_at_line 'api/v3/Job.php' 581 echo '===============================================================' echo '' echo 'Completed formatting issue Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Commenting.DocComment.ContentAfterOpen' echo 'Messages:Array ( [0] => The open comment tag must be the only content on the line ) ' echo 'Lines:Array ( [0] => api/v3/Job.php:105 [1] => api/v3/Job.php:415 [2] => api/v3/Job.php:581 ) ' echo '' echo 'Total number of edits to perform: 3' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/Job.php' 105 edit_at_line 'api/v3/Job.php' 415 edit_at_line 'api/v3/Job.php' 581 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Commenting.DocComment.ContentAfterOpen!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines' echo 'Messages:Array ( [0] => Functions must not contain multiple empty lines in a row; found 2 empty lines ) ' echo 'Lines:Array ( [0] => api/v3/Job.php:134 [1] => CRM/Report/Form.php:1110 [2] => CRM/Report/Form.php:1815 [3] => CRM/Report/Form.php:2593 ) ' echo '' echo 'Total number of edits to perform: 4' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/Job.php' 134 edit_at_line 'CRM/Report/Form.php' 1110 edit_at_line 'CRM/Report/Form.php' 1815 edit_at_line 'CRM/Report/Form.php' 2593 echo '===============================================================' echo '' echo 'Completed formatting issue Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Array.Array.ArrayIndentation' echo 'Messages:Array ( [0] => Array indentation error, expected 4 spaces but found 6 [1] => Array indentation error, expected 4 spaces but found 0 [2] => Array indentation error, expected 8 spaces but found 10 ) ' echo 'Lines:Array ( [0] => api/v3/Job.php:272 [1] => api/v3/Job.php:273 [2] => api/v3/Job.php:274 [3] => api/v3/Job.php:495 [4] => api/v3/Job.php:496 [5] => CRM/Report/Form.php:1129 ) ' echo '' echo 'Total number of edits to perform: 6' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/Job.php' 272 edit_at_line 'api/v3/Job.php' 273 edit_at_line 'api/v3/Job.php' 274 edit_at_line 'api/v3/Job.php' 495 edit_at_line 'api/v3/Job.php' 496 edit_at_line 'CRM/Report/Form.php' 1129 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Array.Array.ArrayIndentation!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Generic.PHP.UpperCaseConstant.Found' echo 'Messages:Array ( [0] => TRUE, FALSE and NULL must be uppercase; expected \"TRUE\" but found \"true\" [1] => TRUE, FALSE and NULL must be uppercase; expected \"FALSE\" but found \"false\" [2] => TRUE, FALSE and NULL must be uppercase; expected \"NULL\" but found \"null\" ) ' echo 'Lines:Array ( [0] => api/v3/Job.php:551 [1] => api/v3/Job.php:552 [2] => api/v3/Job.php:553 [3] => api/v3/Job.php:554 [4] => api/v3/Job.php:555 [5] => api/v3/Job.php:556 [6] => api/v3/Job.php:608 ) ' echo '' echo 'Total number of edits to perform: 7' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/Job.php' 551 edit_at_line 'api/v3/Job.php' 552 edit_at_line 'api/v3/Job.php' 553 edit_at_line 'api/v3/Job.php' 554 edit_at_line 'api/v3/Job.php' 555 edit_at_line 'api/v3/Job.php' 556 edit_at_line 'api/v3/Job.php' 608 echo '===============================================================' echo '' echo 'Completed formatting issue Generic.PHP.UpperCaseConstant.Found!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace' echo 'Messages:Array ( [0] => There should be no white space before a closing \")\" ) ' echo 'Lines:Array ( [0] => api/v3/Job.php:551 [1] => api/v3/Job.php:552 [2] => api/v3/Job.php:553 [3] => api/v3/Job.php:554 ) ' echo '' echo 'Total number of edits to perform: 4' if ask_continue 'Edit these files?'; then edit_at_line 'api/v3/Job.php' 551 edit_at_line 'api/v3/Job.php' 552 edit_at_line 'api/v3/Job.php' 553 edit_at_line 'api/v3/Job.php' 554 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Formatting.MultiLineAssignment' echo 'Messages:Array ( [0] => Multi-line assignments must have the equal sign on the second line ) ' echo 'Lines:Array ( [0] => CRM/Report/Form.php:359 [1] => CRM/Report/Form.php:366 [2] => CRM/Report/Form.php:484 [3] => CRM/Report/Form.php:581 [4] => CRM/Report/Form.php:607 [5] => CRM/Report/Form.php:1495 [6] => CRM/Report/Form.php:1517 [7] => CRM/Report/Form.php:1527 [8] => CRM/Report/Form.php:2168 [9] => CRM/Report/Form.php:2244 [10] => CRM/Report/Form.php:2293 [11] => CRM/Report/Form.php:2720 [12] => CRM/Report/Form.php:2836 [13] => CRM/Report/Form.php:2862 [14] => CRM/Report/Form.php:2895 [15] => CRM/Report/Form.php:2900 [16] => CRM/Report/Form.php:3983 [17] => CRM/Utils/System.php:1467 [18] => CRM/Utils/System.php:1468 [19] => CRM/Utils/System.php:1469 [20] => CRM/Utils/System.php:1470 [21] => CRM/Utils/System.php:1471 [22] => CRM/Utils/System.php:1472 [23] => CRM/Utils/System.php:1473 [24] => CRM/Utils/System.php:1474 ) ' echo '' echo 'Total number of edits to perform: 25' if ask_continue 'Edit these files?'; then edit_at_line 'CRM/Report/Form.php' 359 edit_at_line 'CRM/Report/Form.php' 366 edit_at_line 'CRM/Report/Form.php' 484 edit_at_line 'CRM/Report/Form.php' 581 edit_at_line 'CRM/Report/Form.php' 607 edit_at_line 'CRM/Report/Form.php' 1495 edit_at_line 'CRM/Report/Form.php' 1517 edit_at_line 'CRM/Report/Form.php' 1527 edit_at_line 'CRM/Report/Form.php' 2168 edit_at_line 'CRM/Report/Form.php' 2244 edit_at_line 'CRM/Report/Form.php' 2293 edit_at_line 'CRM/Report/Form.php' 2720 edit_at_line 'CRM/Report/Form.php' 2836 edit_at_line 'CRM/Report/Form.php' 2862 edit_at_line 'CRM/Report/Form.php' 2895 edit_at_line 'CRM/Report/Form.php' 2900 edit_at_line 'CRM/Report/Form.php' 3983 edit_at_line 'CRM/Utils/System.php' 1467 edit_at_line 'CRM/Utils/System.php' 1468 edit_at_line 'CRM/Utils/System.php' 1469 edit_at_line 'CRM/Utils/System.php' 1470 edit_at_line 'CRM/Utils/System.php' 1471 edit_at_line 'CRM/Utils/System.php' 1472 edit_at_line 'CRM/Utils/System.php' 1473 edit_at_line 'CRM/Utils/System.php' 1474 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Formatting.MultiLineAssignment!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Formatting.SpaceInlineIf.SpacingAfter' echo 'Messages:Array ( [0] => Expected 1 space after \"?\"; newline found ) ' echo 'Lines:Array ( [0] => CRM/Report/Form.php:569 ) ' echo '' echo 'Total number of edits to perform: 1' if ask_continue 'Edit these files?'; then edit_at_line 'CRM/Report/Form.php' 569 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Formatting.SpaceInlineIf.SpacingAfter!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Array.Array.ArrayClosingIndentation' echo 'Messages:Array ( [0] => Array closing indentation error, expected 6 spaces but found 8 ) ' echo 'Lines:Array ( [0] => CRM/Report/Form.php:1130 ) ' echo '' echo 'Total number of edits to perform: 1' if ask_continue 'Edit these files?'; then edit_at_line 'CRM/Report/Form.php' 1130 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Array.Array.ArrayClosingIndentation!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Squiz.ControlStructures.SwitchDeclaration.SpacingAfterBreak' echo 'Messages:Array ( [0] => Case breaking statements must be followed by a single blank line ) ' echo 'Lines:Array ( [0] => CRM/Report/Form.php:1271 [1] => CRM/Report/Form.php:1285 [2] => CRM/Report/Form.php:1292 [3] => CRM/Report/Form.php:1298 [4] => CRM/Report/Form.php:1306 ) ' echo '' echo 'Total number of edits to perform: 5' if ask_continue 'Edit these files?'; then edit_at_line 'CRM/Report/Form.php' 1271 edit_at_line 'CRM/Report/Form.php' 1285 edit_at_line 'CRM/Report/Form.php' 1292 edit_at_line 'CRM/Report/Form.php' 1298 edit_at_line 'CRM/Report/Form.php' 1306 echo '===============================================================' echo '' echo 'Completed formatting issue Squiz.ControlStructures.SwitchDeclaration.SpacingAfterBreak!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Commenting.FunctionComment.InvalidReturnNotVoid' echo 'Messages:Array ( [0] => Function return type is not void, but function is returning void here ) ' echo 'Lines:Array ( [0] => CRM/Report/Form.php:1781 [1] => CRM/Utils/System.php:1309 [2] => CRM/Event/Cart/Form/Checkout/Payment.php:588 ) ' echo '' echo 'Total number of edits to perform: 3' if ask_continue 'Edit these files?'; then edit_at_line 'CRM/Report/Form.php' 1781 edit_at_line 'CRM/Utils/System.php' 1309 edit_at_line 'CRM/Event/Cart/Form/Checkout/Payment.php' 588 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Commenting.FunctionComment.InvalidReturnNotVoid!' echo '' echo 'Yay!' echo '' fi echo '===============================================================' echo 'Formatting issue: Drupal.Commenting.FunctionComment.WrongStyle' echo 'Messages:Array ( [0] => You must use \"/**\" style comments for a function comment ) ' echo 'Lines:Array ( [0] => CRM/Report/Form.php:2028 ) ' echo '' echo 'Total number of edits to perform: 1' if ask_continue 'Edit these files?'; then edit_at_line 'CRM/Report/Form.php' 2028 echo '===============================================================' echo '' echo 'Completed formatting issue Drupal.Commenting.FunctionComment.WrongStyle!' echo '' echo 'Yay!' echo '' fi