Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CONTRIB-3564 codechecker: update sniffer to 1.3.3 and require Moodle 2.2

  • Loading branch information...
commit a8c3b2e9db2f1867949b0ae004f93517d61e6803 1 parent 9eadaae
@stronk7 stronk7 authored
Showing with 1,781 additions and 1,040 deletions.
  1. +61 −29 pear/PHP/CodeSniffer.php
  2. 0  pear/PHP/CodeSniffer.sample.conf
  3. +43 −10 pear/PHP/CodeSniffer/CLI.php
  4. +3 −4 pear/PHP/CodeSniffer/CommentParser/AbstractDocElement.php
  5. +3 −4 pear/PHP/CodeSniffer/CommentParser/AbstractParser.php
  6. +3 −4 pear/PHP/CodeSniffer/CommentParser/ClassCommentParser.php
  7. +3 −4 pear/PHP/CodeSniffer/CommentParser/CommentElement.php
  8. +3 −4 pear/PHP/CodeSniffer/CommentParser/DocElement.php
  9. +3 −4 pear/PHP/CodeSniffer/CommentParser/FunctionCommentParser.php
  10. +3 −4 pear/PHP/CodeSniffer/CommentParser/MemberCommentParser.php
  11. +3 −4 pear/PHP/CodeSniffer/CommentParser/PairElement.php
  12. +3 −4 pear/PHP/CodeSniffer/CommentParser/ParameterElement.php
  13. +3 −4 pear/PHP/CodeSniffer/CommentParser/ParserException.php
  14. +3 −4 pear/PHP/CodeSniffer/CommentParser/SingleElement.php
  15. +5 −5 pear/PHP/CodeSniffer/DocGenerators/Generator.php
  16. +7 −6 pear/PHP/CodeSniffer/DocGenerators/HTML.php
  17. +6 −5 pear/PHP/CodeSniffer/DocGenerators/Text.php
  18. +4 −7 pear/PHP/CodeSniffer/Exception.php
  19. +20 −7 pear/PHP/CodeSniffer/File.php
  20. +3 −4 pear/PHP/CodeSniffer/MultiFileSniff.php
  21. +8 −7 pear/PHP/CodeSniffer/Report.php
  22. +20 −5 pear/PHP/CodeSniffer/Reporting.php
  23. +32 −19 pear/PHP/CodeSniffer/Reports/Checkstyle.php
  24. +6 −5 pear/PHP/CodeSniffer/Reports/Csv.php
  25. +14 −9 pear/PHP/CodeSniffer/Reports/Emacs.php
  26. +10 −8 pear/PHP/CodeSniffer/Reports/Full.php
  27. +2 −3 pear/PHP/CodeSniffer/Reports/Gitblame.php
  28. +134 −0 pear/PHP/CodeSniffer/Reports/Hgblame.php
  29. +13 −11 pear/PHP/CodeSniffer/Reports/Source.php
  30. +10 −8 pear/PHP/CodeSniffer/Reports/Summary.php
  31. +3 −4 pear/PHP/CodeSniffer/Reports/Svnblame.php
  32. +10 −10 pear/PHP/CodeSniffer/Reports/VersionControl.php
  33. +30 −16 pear/PHP/CodeSniffer/Reports/Xml.php
  34. +3 −4 pear/PHP/CodeSniffer/Sniff.php
  35. +21 −6 pear/PHP/CodeSniffer/Standards/AbstractPatternSniff.php
  36. +3 −4 pear/PHP/CodeSniffer/Standards/AbstractScopeSniff.php
  37. +28 −19 pear/PHP/CodeSniffer/Standards/AbstractVariableSniff.php
  38. 0  pear/PHP/CodeSniffer/Standards/Generic/Docs/Files/LineLengthStandard.xml
  39. 0  pear/PHP/CodeSniffer/Standards/Generic/Docs/Formatting/MultipleStatementAlignmentStandard.xml
  40. 0  pear/PHP/CodeSniffer/Standards/Generic/Docs/Functions/OpeningFunctionBraceBsdAllmanStandard.xml
  41. 0  pear/PHP/CodeSniffer/Standards/Generic/Docs/Functions/OpeningFunctionBraceKernighanRitchieStandard.xml
  42. 0  pear/PHP/CodeSniffer/Standards/Generic/Docs/NamingConventions/UpperCaseConstantNameStandard.xml
  43. 0  pear/PHP/CodeSniffer/Standards/Generic/Docs/PHP/DisallowShortOpenTagStandard.xml
  44. 0  pear/PHP/CodeSniffer/Standards/Generic/Docs/PHP/LowerCaseConstantStandard.xml
  45. 0  pear/PHP/CodeSniffer/Standards/Generic/Docs/PHP/UpperCaseConstantStandard.xml
  46. +42 −25 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Classes/DuplicateClassNameSniff.php
  47. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php
  48. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/ForLoopShouldBeWhileLoopSniff.php
  49. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/ForLoopWithTestFunctionCallSniff.php
  50. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/JumbledIncrementerSniff.php
  51. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/UnconditionalIfStatementSniff.php
  52. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/UnnecessaryFinalModifierSniff.php
  53. +4 −5 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/UnusedFunctionParameterSniff.php
  54. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Sniffs/CodeAnalysis/UselessOverridingMethodSniff.php
  55. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Commenting/TodoSniff.php
  56. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/ControlStructures/InlineControlStructureSniff.php
  57. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Debug/ClosureLinterSniff.php
  58. +109 −0 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Debug/JSHintSniff.php
  59. +93 −0 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Files/ByteOrderMarkSniff.php
  60. +5 −6 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Files/LineEndingsSniff.php
  61. +41 −38 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Files/LineLengthSniff.php
  62. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Formatting/DisallowMultipleStatementsSniff.php
  63. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff.php
  64. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Formatting/NoSpaceAfterCastSniff.php
  65. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Formatting/SpaceAfterCastSniff.php
  66. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php
  67. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Functions/FunctionCallArgumentSpacingSniff.php
  68. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceBsdAllmanSniff.php
  69. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Functions/OpeningFunctionBraceKernighanRitchieSniff.php
  70. +2 −3 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Metrics/CyclomaticComplexitySniff.php
  71. +2 −3 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Metrics/NestingLevelSniff.php
  72. +2 −3 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/NamingConventions/ConstructorNameSniff.php
  73. +18 −8 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/NamingConventions/UpperCaseConstantNameSniff.php
  74. +29 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php
  75. +3 −14 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/PHP/DisallowShortOpenTagSniff.php
  76. +76 −12 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/PHP/ForbiddenFunctionsSniff.php
  77. +9 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/PHP/LowerCaseConstantSniff.php
  78. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Sniffs/PHP/NoSilencedErrorsSniff.php
  79. +9 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/PHP/UpperCaseConstantSniff.php
  80. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/Strings/UnnecessaryStringConcatSniff.php
  81. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/VersionControl/SubversionPropertiesSniff.php
  82. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/WhiteSpace/DisallowTabIndentSniff.php
  83. +17 −8 pear/PHP/CodeSniffer/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php
  84. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.1.inc
  85. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.2.inc
  86. +11 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Classes/DuplicateClassNameUnitTest.php
  87. +3 −1 pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.inc
  88. +2 −2 pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.php
  89. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.inc
  90. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/ForLoopShouldBeWhileLoopUnitTest.php
  91. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.inc
  92. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/ForLoopWithTestFunctionCallUnitTest.php
  93. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.inc
  94. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/JumbledIncrementerUnitTest.php
  95. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.inc
  96. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.php
  97. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/UnnecessaryFinalModifierUnitTest.inc
  98. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/UnnecessaryFinalModifierUnitTest.php
  99. +4 −0 pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.inc
  100. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/UnusedFunctionParameterUnitTest.php
  101. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.inc
  102. +1 −2  pear/PHP/CodeSniffer/Standards/Generic/Tests/CodeAnalysis/UselessOverridingMethodUnitTest.php
  103. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Commenting/TodoUnitTest.inc
  104. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Commenting/TodoUnitTest.js
  105. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Commenting/TodoUnitTest.php
  106. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.inc
  107. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.js
  108. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/ControlStructures/InlineControlStructureUnitTest.php
  109. +3 −0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.inc
  110. +67 −0 pear/PHP/CodeSniffer/Standards/Generic/Tests/Files/ByteOrderMarkUnitTest.php
  111. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Files/LineEndingsUnitTest.css
  112. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Files/LineEndingsUnitTest.inc
  113. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Files/LineEndingsUnitTest.js
  114. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Files/LineEndingsUnitTest.php
  115. +0 −1  pear/PHP/CodeSniffer/Standards/Generic/Tests/Files/LineLengthUnitTest.inc
  116. +4 −5 pear/PHP/CodeSniffer/Standards/Generic/Tests/Files/LineLengthUnitTest.php
  117. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Formatting/DisallowMultipleStatementsUnitTest.inc
  118. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Formatting/DisallowMultipleStatementsUnitTest.php
  119. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.inc
  120. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.js
  121. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Formatting/MultipleStatementAlignmentUnitTest.php
  122. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Formatting/NoSpaceAfterCastUnitTest.inc
  123. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Formatting/NoSpaceAfterCastUnitTest.php
  124. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.inc
  125. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Formatting/SpaceAfterCastUnitTest.php
  126. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.inc
  127. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.php
  128. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.inc
  129. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.php
  130. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Functions/OpeningFunctionBraceBsdAllmanUnitTest.inc
  131. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Functions/OpeningFunctionBraceBsdAllmanUnitTest.php
  132. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Functions/OpeningFunctionBraceKernighanRitchieUnitTest.inc
  133. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Functions/OpeningFunctionBraceKernighanRitchieUnitTest.php
  134. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.inc
  135. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Metrics/CyclomaticComplexityUnitTest.php
  136. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.inc
  137. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Metrics/NestingLevelUnitTest.php
  138. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.inc
  139. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/NamingConventions/ConstructorNameUnitTest.php
  140. +15 −1 pear/PHP/CodeSniffer/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.inc
  141. +14 −14 pear/PHP/CodeSniffer/Standards/Generic/Tests/NamingConventions/UpperCaseConstantNameUnitTest.php
  142. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.inc
  143. +15 −11 pear/PHP/CodeSniffer/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.php
  144. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.inc
  145. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.php
  146. +3 −0  pear/PHP/CodeSniffer/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc
  147. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.js
  148. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php
  149. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/PHP/NoSilencedErrorsUnitTest.inc
  150. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/PHP/NoSilencedErrorsUnitTest.php
  151. +3 −0  pear/PHP/CodeSniffer/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc
  152. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.php
  153. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.inc
  154. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.js
  155. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/Strings/UnnecessaryStringConcatUnitTest.php
  156. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.css
  157. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.inc
  158. 0  pear/PHP/CodeSniffer/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.js
  159. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.php
  160. +11 −0 pear/PHP/CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.inc
  161. +3 −4 pear/PHP/CodeSniffer/Standards/Generic/Tests/WhiteSpace/ScopeIndentUnitTest.php
  162. 0  pear/PHP/CodeSniffer/Standards/Generic/ruleset.xml
  163. +3 −4 pear/PHP/CodeSniffer/Standards/IncorrectPatternException.php
  164. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/CSS/BrowserSpecificStylesSniff.php
  165. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/Channels/ChannelExceptionSniff.php
  166. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/Channels/DisallowSelfActionsSniff.php
  167. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/Channels/IncludeSystemSniff.php
  168. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/Channels/UnusedSystemSniff.php
  169. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/Commenting/FunctionCommentSniff.php
  170. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/Debug/DebugCodeSniff.php
  171. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/Debug/FirebugConsoleSniff.php
  172. +5 −6 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/Objects/AssignThisSniff.php
  173. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/Objects/CreateWidgetTypeCallbackSniff.php
  174. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/Objects/DisallowNewWidgetSniff.php
  175. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/PHP/EvalObjectFactorySniff.php
  176. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/PHP/GetRequestDataSniff.php
  177. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/PHP/ReturnFunctionValueSniff.php
  178. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Sniffs/Strings/JoinStringsSniff.php
  179. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/CSS/BrowserSpecificStylesUnitTest.css
  180. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/CSS/BrowserSpecificStylesUnitTest.php
  181. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/Channels/DisallowSelfActionsUnitTest.inc
  182. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/Channels/DisallowSelfActionsUnitTest.php
  183. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.inc
  184. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/Channels/IncludeSystemUnitTest.php
  185. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.inc
  186. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/Channels/UnusedSystemUnitTest.php
  187. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/Commenting/FunctionCommentUnitTest.inc
  188. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/Commenting/FunctionCommentUnitTest.php
  189. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/Debug/DebugCodeUnitTest.inc
  190. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/Debug/DebugCodeUnitTest.php
  191. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/Debug/FirebugConsoleUnitTest.js
  192. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/Debug/FirebugConsoleUnitTest.php
  193. +3 −1 pear/PHP/CodeSniffer/Standards/MySource/Tests/Objects/AssignThisUnitTest.js
  194. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/Objects/AssignThisUnitTest.php
  195. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/Objects/CreateWidgetTypeCallbackUnitTest.js
  196. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/Objects/CreateWidgetTypeCallbackUnitTest.php
  197. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/Objects/DisallowNewWidgetUnitTest.inc
  198. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/Objects/DisallowNewWidgetUnitTest.php
  199. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/PHP/EvalObjectFactoryUnitTest.inc
  200. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/PHP/EvalObjectFactoryUnitTest.php
  201. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/PHP/GetRequestDataUnitTest.inc
  202. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/PHP/GetRequestDataUnitTest.php
  203. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/PHP/ReturnFunctionValueUnitTest.inc
  204. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/PHP/ReturnFunctionValueUnitTest.php
  205. 0  pear/PHP/CodeSniffer/Standards/MySource/Tests/Strings/JoinStringsUnitTest.js
  206. +3 −4 pear/PHP/CodeSniffer/Standards/MySource/Tests/Strings/JoinStringsUnitTest.php
  207. 0  pear/PHP/CodeSniffer/Standards/MySource/ruleset.xml
  208. 0  pear/PHP/CodeSniffer/Standards/PEAR/Docs/Files/IncludingFileStandard.xml
  209. 0  pear/PHP/CodeSniffer/Standards/PEAR/Docs/Files/LineLengthStandard.xml
  210. 0  pear/PHP/CodeSniffer/Standards/PEAR/Docs/Functions/FunctionCallSignatureStandard.xml
  211. 0  pear/PHP/CodeSniffer/Standards/PEAR/Docs/Functions/ValidDefaultValueStandard.xml
  212. 0  pear/PHP/CodeSniffer/Standards/PEAR/Docs/NamingConventions/ValidClassNameStandard.xml
  213. 0  pear/PHP/CodeSniffer/Standards/PEAR/Docs/NamingConventions/ValidFunctionNameStandard.xml
  214. +23 −10 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/Classes/ClassDeclarationSniff.php
  215. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/Commenting/ClassCommentSniff.php
  216. +5 −5 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php
  217. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/Commenting/FunctionCommentSniff.php
  218. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/Commenting/InlineCommentSniff.php
  219. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/ControlStructures/ControlSignatureSniff.php
  220. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/ControlStructures/MultiLineConditionSniff.php
  221. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/Files/IncludingFileSniff.php
  222. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/Formatting/MultiLineAssignmentSniff.php
  223. +16 −8 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php
  224. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionDeclarationSniff.php
  225. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/Functions/ValidDefaultValueSniff.php
  226. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/NamingConventions/ValidClassNameSniff.php
  227. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/NamingConventions/ValidFunctionNameSniff.php
  228. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/NamingConventions/ValidVariableNameSniff.php
  229. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php
  230. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/WhiteSpace/ScopeClosingBraceSniff.php
  231. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Sniffs/WhiteSpace/ScopeIndentSniff.php
  232. +8 −0 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.inc
  233. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Classes/ClassDeclarationUnitTest.php
  234. +2 −2 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.inc
  235. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Commenting/ClassCommentUnitTest.php
  236. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/Commenting/FileCommentUnitTest.inc
  237. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Commenting/FileCommentUnitTest.php
  238. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.inc
  239. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Commenting/FunctionCommentUnitTest.php
  240. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/Commenting/InlineCommentUnitTest.inc
  241. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Commenting/InlineCommentUnitTest.php
  242. +4 −0 pear/PHP/CodeSniffer/Standards/PEAR/Tests/ControlStructures/ControlSignatureUnitTest.inc
  243. +4 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/ControlStructures/ControlSignatureUnitTest.php
  244. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/ControlStructures/MultiLineConditionUnitTest.inc
  245. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/ControlStructures/MultiLineConditionUnitTest.php
  246. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/Files/IncludingFileUnitTest.inc
  247. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Files/IncludingFileUnitTest.php
  248. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/Formatting/MultiLineAssignmentUnitTest.inc
  249. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Formatting/MultiLineAssignmentUnitTest.php
  250. +19 −0 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc
  251. +22 −20 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.php
  252. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.inc
  253. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Functions/FunctionDeclarationUnitTest.php
  254. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.inc
  255. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.php
  256. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/NamingConventions/ValidClassNameUnitTest.inc
  257. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/NamingConventions/ValidClassNameUnitTest.php
  258. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/NamingConventions/ValidFunctionNameUnitTest.inc
  259. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/NamingConventions/ValidFunctionNameUnitTest.php
  260. +14 −0 pear/PHP/CodeSniffer/Standards/PEAR/Tests/NamingConventions/ValidVariableNameUnitTest.inc
  261. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/NamingConventions/ValidVariableNameUnitTest.php
  262. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.inc
  263. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.php
  264. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/WhiteSpace/ScopeClosingBraceUnitTest.inc
  265. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/WhiteSpace/ScopeClosingBraceUnitTest.php
  266. 0  pear/PHP/CodeSniffer/Standards/PEAR/Tests/WhiteSpace/ScopeIndentUnitTest.inc
  267. +3 −4 pear/PHP/CodeSniffer/Standards/PEAR/Tests/WhiteSpace/ScopeIndentUnitTest.php
  268. 0  pear/PHP/CodeSniffer/Standards/PEAR/ruleset.xml
  269. +0 −1  pear/PHP/CodeSniffer/Standards/PHPCS/ruleset.xml
  270. 0  pear/PHP/CodeSniffer/Standards/Squiz/Docs/Arrays/ArrayDeclarationStandard.xml
  271. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Arrays/ArrayBracketSpacingSniff.php
  272. +29 −10 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Arrays/ArrayDeclarationSniff.php
  273. +15 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/ClassDefinitionClosingBraceSpaceSniff.php
  274. +11 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/ClassDefinitionNameSpacingSniff.php
  275. +31 −9 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/ClassDefinitionOpeningBraceSpaceSniff.php
  276. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/ColonSpacingSniff.php
  277. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/ColourDefinitionSniff.php
  278. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/DisallowMultipleStyleDefinitionsSniff.php
  279. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/DuplicateClassDefinitionSniff.php
  280. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/DuplicateStyleDefinitionSniff.php
  281. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/EmptyClassDefinitionSniff.php
  282. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/EmptyStyleDefinitionSniff.php
  283. +24 −11 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/IndentationSniff.php
  284. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/LowercaseStyleDefinitionSniff.php
  285. +9 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/MissingColonSniff.php
  286. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/OpacitySniff.php
  287. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CSS/SemicolonSpacingSniff.php
  288. +7 −5 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Classes/ClassDeclarationSniff.php
  289. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Classes/ClassFileNameSniff.php
  290. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Classes/DuplicatePropertySniff.php
  291. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Classes/LowercaseClassKeywordsSniff.php
  292. +10 −8 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Classes/SelfMemberReferenceSniff.php
  293. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Classes/ValidClassNameSniff.php
  294. +4 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/CodeAnalysis/EmptyStatementSniff.php
  295. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Commenting/BlockCommentSniff.php
  296. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Commenting/ClassCommentSniff.php
  297. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Commenting/ClosingDeclarationCommentSniff.php
  298. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Commenting/DocCommentAlignmentSniff.php
  299. +3 −4 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Commenting/EmptyCatchCommentSniff.php
  300. +13 −5 pear/PHP/CodeSniffer/Standards/Squiz/Sniffs/Commenting/FileCommentSniff.php
Sorry, we could not display the entire diff because too many files (628) changed.
View
90 pear/PHP/CodeSniffer.php 100755 → 100644
@@ -9,9 +9,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: CodeSniffer.php 308981 2011-03-06 21:54:08Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -61,7 +60,7 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
* @version Release: @package_version@
* @link http://pear.php.net/package/PHP_CodeSniffer
@@ -115,16 +114,6 @@ class PHP_CodeSniffer
protected $ruleset = array();
/**
- * The path that that PHP_CodeSniffer is being run from.
- *
- * Stored so that the path can be restored after it is changed
- * in the constructor.
- *
- * @var string
- */
- private $_cwd = null;
-
- /**
* The listeners array, indexed by token type.
*
* @var array
@@ -220,7 +209,10 @@ public function __construct(
// Change into a directory that we know about to stop any
// relative path conflicts.
- $this->_cwd = getcwd();
+ if (defined('PHPCS_CWD') === false) {
+ define('PHPCS_CWD', getcwd());
+ }
+
chdir(dirname(__FILE__).'/CodeSniffer/');
// Set default CLI object in case someone is running us
@@ -242,7 +234,7 @@ public function __construct(
*/
public function __destruct()
{
- chdir($this->_cwd);
+ chdir(PHPCS_CWD);
}//end __destruct()
@@ -430,8 +422,8 @@ public function process($files, $standard, array $sniffs=array(), $local=false)
if ($ruleset !== false) {
$standardName = (string) $ruleset['name'];
}
- } else if (is_file(realpath($this->_cwd.'/'.$standard)) === true) {
- $ruleset = simplexml_load_file(realpath($this->_cwd.'/'.$standard));
+ } else if (is_file(realpath(PHPCS_CWD.'/'.$standard)) === true) {
+ $ruleset = simplexml_load_file(realpath(PHPCS_CWD.'/'.$standard));
if ($ruleset !== false) {
$standardName = (string) $ruleset['name'];
}
@@ -604,7 +596,7 @@ public function setTokenListeners($standard, array $sniffs=array())
if (is_dir($this->standardDir) === false) {
// This isn't looking good. Let's see if this
// is a relative path to a custom standard.
- $path = realpath($this->_cwd.'/'.$standard);
+ $path = realpath(PHPCS_CWD.'/'.$standard);
if (is_dir($path) === true) {
// This is a relative path to a custom standard.
$this->standardDir = $path;
@@ -735,11 +727,11 @@ public function getSniffFiles($dir, $standard=null)
}
foreach ($ruleset->rule as $rule) {
- $includedSniffs = array_merge($includedSniffs, self::_expandRulesetReference($rule['ref']));
+ $includedSniffs = array_merge($includedSniffs, $this->_expandRulesetReference($rule['ref']));
if (isset($rule->exclude) === true) {
foreach ($rule->exclude as $exclude) {
- $excludedSniffs = array_merge($excludedSniffs, self::_expandRulesetReference($exclude['name']));
+ $excludedSniffs = array_merge($excludedSniffs, $this->_expandRulesetReference($exclude['name']));
}
}
}//end foreach
@@ -1027,6 +1019,10 @@ public function getFilesToProcess($paths, $local=false)
$files[] = $file->getPathname();
}//end foreach
} else {
+ if ($this->shouldIgnoreFile($path) === true) {
+ continue;
+ }
+
$files[] = $path;
}//end if
}//end foreach
@@ -1049,18 +1045,46 @@ public function shouldProcessFile($path)
{
// Check that the file's extension is one we are checking.
// We are strict about checking the extension and we don't
- // let files through with no extension.
- $fileParts = explode('.', $path);
- $extension = array_pop($fileParts);
- if ($extension === $path) {
+ // let files through with no extension or that start with a dot.
+ $fileName = basename($path);
+ $fileParts = explode('.', $fileName);
+ if ($fileParts[0] === $fileName || $fileParts[0] === '') {
return false;
}
- if (isset($this->allowedFileExtensions[$extension]) === false) {
+ // Checking multi-part file extensions, so need to create a
+ // complete extension list and make sure one is allowed.
+ $extensions = array();
+ array_shift($fileParts);
+ foreach ($fileParts as $part) {
+ $extensions[implode('.', $fileParts)] = 1;
+ array_shift($fileParts);
+ }
+
+ $matches = array_intersect_key($extensions, $this->allowedFileExtensions);
+ if (empty($matches) === true) {
return false;
}
// If the file's path matches one of our ignore patterns, skip it.
+ if ($this->shouldIgnoreFile($path) === true) {
+ return false;
+ }
+
+ return true;
+
+ }//end shouldProcessFile()
+
+
+ /**
+ * Checks filtering rules to see if a file should be ignored.
+ *
+ * @param string $path The path to the file being checked.
+ *
+ * @return bool
+ */
+ public function shouldIgnoreFile($path)
+ {
foreach ($this->ignorePatterns as $pattern) {
if (is_array($pattern) === true) {
// A sniff specific ignore pattern.
@@ -1074,13 +1098,13 @@ public function shouldProcessFile($path)
$pattern = strtr($pattern, $replacements);
if (preg_match("|{$pattern}|i", $path) === 1) {
- return false;
+ return true;
}
}//end foreach
- return true;
+ return false;
- }//end shouldProcessFile()
+ }//end shouldIgnoreFile()
/**
@@ -1105,6 +1129,9 @@ public function processFile($file, $contents=null)
}
$filePath = realpath($file);
+ if ($filePath === false) {
+ $filePath = $file;
+ }
// Before we go and spend time tokenizing this file, just check
// to see if there is a tag up top to indicate that the whole
@@ -1313,7 +1340,9 @@ public function getFilesErrors()
*/
public function generateDocs($standard, array $sniffs=array(), $generator='Text')
{
- include_once 'PHP/CodeSniffer/DocGenerators/'.$generator.'.php';
+ if (class_exists('PHP_CodeSniffer_DocGenerators_'.$generator, true) === false) {
+ throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_DocGenerators_'.$generator.' not found');
+ }
$class = "PHP_CodeSniffer_DocGenerators_$generator";
$generator = new $class($standard, $sniffs);
@@ -1536,6 +1565,9 @@ public static function resolveSimpleToken($token)
case '$':
$newToken['type'] = 'T_DOLLAR';
break;
+ case '`':
+ $newToken['type'] = 'T_BACKTICK';
+ break;
default:
$newToken['type'] = 'T_NONE';
break;
View
0  pear/PHP/CodeSniffer.sample.conf 100755 → 100644
File mode changed
View
53 pear/PHP/CodeSniffer/CLI.php 100755 → 100644
@@ -7,9 +7,8 @@
* @category PHP
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: CLI.php 307425 2011-01-12 22:23:07Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -25,9 +24,9 @@
* @category PHP
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_CLI
@@ -296,7 +295,7 @@ public function processLongArgument($arg, $pos, $values)
exit(0);
break;
case 'version':
- echo 'PHP_CodeSniffer version 1.3.0 (stable) ';
+ echo 'PHP_CodeSniffer version 1.3.3 (stable) ';
echo 'by Squiz Pty Ltd. (http://www.squiz.net)'.PHP_EOL;
exit(0);
break;
@@ -383,6 +382,7 @@ public function processLongArgument($arg, $pos, $values)
'summary',
'svnblame',
'gitblame',
+ 'hgblame',
);
if (in_array($report, $validReports) === false) {
@@ -486,10 +486,19 @@ public function process($values=array())
exit(0);
}
+ $fileContents = '';
if (empty($values['files']) === true) {
- echo 'ERROR: You must supply at least one file or directory to process.'.PHP_EOL.PHP_EOL;
- $this->printUsage();
- exit(2);
+ // Check if they passing in the file contents.
+ $handle = fopen('php://stdin', 'r');
+ $fileContents = stream_get_contents($handle);
+ fclose($handle);
+
+ if ($fileContents === '') {
+ // No files and no content passed in.
+ echo 'ERROR: You must supply at least one file or directory to process.'.PHP_EOL.PHP_EOL;
+ $this->printUsage();
+ exit(2);
+ }
}
$values['standard'] = $this->validateStandard($values['standard']);
@@ -541,6 +550,10 @@ public function process($values=array())
$values['local']
);
+ if ($fileContents !== '') {
+ $phpcs->processFile('STDIN', $fileContents);
+ }
+
return $this->printErrorReport(
$phpcs,
$values['reports'],
@@ -582,13 +595,21 @@ public function printErrorReport(
$reports['full'] = $reportFile;
}
- $errors = 0;
+ $errors = 0;
+ $toScreen = false;
foreach ($reports as $report => $output) {
if ($output === null) {
$output = $reportFile;
}
+ if ($reportFile === null) {
+ $toScreen = true;
+ }
+
+ // We don't add errors here because the number of
+ // errors reported by each report type will always be the
+ // same, so we really just need 1 number.
$errors = $reporting->printReport(
$report,
$filesViolations,
@@ -598,6 +619,18 @@ public function printErrorReport(
);
}
+ // Only print PHP_Timer output if no reports were
+ // printed to the screen so we don't put additional output
+ // in something like an XML report. If we are printing to screen,
+ // the report types would have already worked out who should
+ // print the timer info.
+ if ($toScreen === false
+ && PHP_CODESNIFFER_INTERACTIVE === false
+ && class_exists('PHP_Timer', false) === true
+ ) {
+ echo PHP_Timer::resourceUsage().PHP_EOL.PHP_EOL;
+ }
+
// They should all return the same value, so it
// doesn't matter which return value we end up using.
return $errors;
@@ -680,7 +713,7 @@ public function printUsage()
echo ' <generator> The name of a doc generator to use'.PHP_EOL;
echo ' (forces doc generation instead of checking)'.PHP_EOL;
echo ' <report> Print either the "full", "xml", "checkstyle", "csv", "emacs"'.PHP_EOL;
- echo ' "source", "summary", "svnblame" or "gitblame" report'.PHP_EOL;
+ echo ' "source", "summary", "svnblame", "gitblame" or "hgblame" report'.PHP_EOL;
echo ' (the "full" report is printed by default)'.PHP_EOL;
echo ' <reportfile> Write the report to the specified file path'.PHP_EOL;
echo ' <reportWidth> How many columns wide screen reports should be printed'.PHP_EOL;
View
7 pear/PHP/CodeSniffer/CommentParser/AbstractDocElement.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: AbstractDocElement.php 302087 2010-08-11 01:51:18Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -57,9 +56,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
abstract class PHP_CodeSniffer_CommentParser_AbstractDocElement implements PHP_CodeSniffer_CommentParser_DocElement
View
7 pear/PHP/CodeSniffer/CommentParser/AbstractParser.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: AbstractParser.php 302086 2010-08-11 01:50:50Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -62,9 +61,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
abstract class PHP_CodeSniffer_CommentParser_AbstractParser
View
7 pear/PHP/CodeSniffer/CommentParser/ClassCommentParser.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: ClassCommentParser.php 270281 2008-12-02 02:38:34Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -26,9 +25,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_CommentParser_ClassCommentParser extends PHP_CodeSniffer_CommentParser_AbstractParser
View
7 pear/PHP/CodeSniffer/CommentParser/CommentElement.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: CommentElement.php 270281 2008-12-02 02:38:34Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -40,9 +39,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_CommentParser_CommentElement extends PHP_CodeSniffer_CommentParser_SingleElement
View
7 pear/PHP/CodeSniffer/CommentParser/DocElement.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: DocElement.php 226723 2007-01-08 05:13:38Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -21,9 +20,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
interface PHP_CodeSniffer_CommentParser_DocElement
View
7 pear/PHP/CodeSniffer/CommentParser/FunctionCommentParser.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: FunctionCommentParser.php 270281 2008-12-02 02:38:34Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -41,9 +40,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_CommentParser_FunctionCommentParser extends PHP_CodeSniffer_CommentParser_AbstractParser
View
7 pear/PHP/CodeSniffer/CommentParser/MemberCommentParser.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: MemberCommentParser.php 270281 2008-12-02 02:38:34Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -26,9 +25,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_CommentParser_MemberCommentParser extends PHP_CodeSniffer_CommentParser_ClassCommentParser
View
7 pear/PHP/CodeSniffer/CommentParser/PairElement.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: PairElement.php 270281 2008-12-02 02:38:34Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -29,9 +28,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_CommentParser_PairElement extends PHP_CodeSniffer_CommentParser_AbstractDocElement
View
7 pear/PHP/CodeSniffer/CommentParser/ParameterElement.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: ParameterElement.php 270281 2008-12-02 02:38:34Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -26,9 +25,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_CommentParser_ParameterElement extends PHP_CodeSniffer_CommentParser_AbstractDocElement
View
7 pear/PHP/CodeSniffer/CommentParser/ParserException.php 100755 → 100644
@@ -9,9 +9,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: ParserException.php 224862 2006-12-11 23:59:35Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -23,9 +22,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_CommentParser_ParserException extends Exception
View
7 pear/PHP/CodeSniffer/CommentParser/SingleElement.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: SingleElement.php 301632 2010-07-28 01:57:56Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -29,9 +28,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_CommentParser_SingleElement extends PHP_CodeSniffer_CommentParser_AbstractDocElement
View
10 pear/PHP/CodeSniffer/DocGenerators/Generator.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: Generator.php 293524 2010-01-13 22:38:47Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -24,9 +23,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_DocGenerators_Generator
@@ -143,7 +142,8 @@ protected function getStandardFiles()
$standard = $this->_standard;
}
- $sniffs = PHP_CodeSniffer::getSniffFiles($standardDir, $standard);
+ $phpcs = new PHP_CodeSniffer();
+ $sniffs = $phpcs->getSniffFiles($standardDir, $standard);
$standardFiles = array();
foreach ($sniffs as $sniff) {
View
13 pear/PHP/CodeSniffer/DocGenerators/HTML.php 100755 → 100644
@@ -8,13 +8,14 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: HTML.php 270764 2008-12-07 21:40:02Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
-require_once 'PHP/CodeSniffer/DocGenerators/Generator.php';
+if (class_exists('PHP_CodeSniffer_DocGenerators_Generator', true) === false) {
+ throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_DocGenerators_Generator not found');
+}
/**
* A doc generator that outputs documentation in one big HTML file.
@@ -27,9 +28,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_DocGenerators_HTML extends PHP_CodeSniffer_DocGenerators_Generator
@@ -190,7 +191,7 @@ protected function printFooter()
error_reporting(E_ALL);
echo ' <div class="tag-line">';
echo 'Documentation generated on '.date('r');
- echo ' by <a href="http://pear.php.net/package/PHP_CodeSniffer">PHP_CodeSniffer 1.3.0</a>';
+ echo ' by <a href="http://pear.php.net/package/PHP_CodeSniffer">PHP_CodeSniffer 1.3.3</a>';
echo '</div>'.PHP_EOL;
error_reporting(E_ALL | E_STRICT);
View
11 pear/PHP/CodeSniffer/DocGenerators/Text.php 100755 → 100644
@@ -8,13 +8,14 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: Text.php 236085 2007-05-22 06:43:05Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
-require_once 'PHP/CodeSniffer/DocGenerators/Generator.php';
+if (class_exists('PHP_CodeSniffer_DocGenerators_Generator', true) === false) {
+ throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_DocGenerators_Generator not found');
+}
/**
* A doc generator that outputs text-based documentation.
@@ -25,9 +26,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_DocGenerators_Text extends PHP_CodeSniffer_DocGenerators_Generator
View
11 pear/PHP/CodeSniffer/Exception.php 100755 → 100644
@@ -8,14 +8,11 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: Exception.php 224861 2006-12-11 23:45:27Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
-require_once 'PEAR/Exception.php';
-
/**
* An exception thrown by PHP_CodeSniffer when it encounters an unrecoverable error.
*
@@ -23,12 +20,12 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
-class PHP_CodeSniffer_Exception extends PEAR_Exception
+class PHP_CodeSniffer_Exception extends Exception
{
}//end class
View
27 pear/PHP/CodeSniffer/File.php 100755 → 100644
@@ -9,9 +9,8 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: File.php 306530 2010-12-21 04:08:20Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -110,9 +109,9 @@
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
* @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_File
@@ -2193,7 +2192,7 @@ public function getMethodProperties($stackPtr)
/**
* Returns the visibility and implementation properies of the class member
- * variable found at the specified position in the stack.
+ * variable found at the specified position in the stack.
*
* The format of the array is:
*
@@ -2397,10 +2396,24 @@ public function isReference($stackPtr)
$lastBracket = array_pop($brackets);
if (isset($this->_tokens[$lastBracket]['parenthesis_owner']) === true) {
$owner = $this->_tokens[$this->_tokens[$lastBracket]['parenthesis_owner']];
- if ($owner['code'] === T_FUNCTION || $owner['code'] === T_ARRAY) {
+ if ($owner['code'] === T_FUNCTION
+ || $owner['code'] === T_CLOSURE
+ || $owner['code'] === T_ARRAY
+ ) {
// Inside a function or array declaration, this is a reference.
return true;
}
+ } else {
+ $prev = $this->findPrevious(
+ array(T_WHITESPACE),
+ ($this->_tokens[$lastBracket]['parenthesis_opener'] - 1),
+ null,
+ true
+ );
+
+ if ($prev !== false && $this->_tokens[$prev]['code'] === T_USE) {
+ return true;
+ }
}
}
@@ -2518,7 +2531,7 @@ public function findPrevious(
* If value is ommited, tokens with any value will
* be returned.
* @param bool $local If true, tokens outside the current statement
- * will not be cheked. IE. checking will stop
+ * will not be checked. i.e., checking will stop
* at the next semi-colon found.
*
* @return int | bool
View
7 pear/PHP/CodeSniffer/MultiFileSniff.php 100755 → 100644
@@ -7,9 +7,8 @@
* @category PHP
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: MultiFileSniff.php 263478 2008-07-25 04:24:11Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -23,9 +22,9 @@
* @category PHP
* @package PHP_CodeSniffer
* @author Greg Sherwood <gsherwood@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
interface PHP_CodeSniffer_MultiFileSniff
View
15 pear/PHP/CodeSniffer/Report.php 100755 → 100644
@@ -9,9 +9,8 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -23,9 +22,9 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
interface PHP_CodeSniffer_Report
@@ -38,13 +37,15 @@
* @param array $report Prepared report.
* @param boolean $showSources Show sources?
* @param int $width Maximum allowed lne width.
- *
- * @return string
+ * @param boolean $toScreen Is the report being printed to screen?
+ *
+ * @return string
*/
public function generate(
$report,
$showSources=false,
- $width=80
+ $width=80,
+ $toScreen=true
);
View
25 pear/PHP/CodeSniffer/Reporting.php 100755 → 100644
@@ -9,9 +9,8 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: Reporting.php 287726 2009-08-26 05:13:12Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -29,9 +28,9 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_Reporting
@@ -83,14 +82,30 @@ public function printReport(
$reportFile='',
$reportWidth=80
) {
+ if ($reportFile !== null) {
+ $reportDir = dirname($reportFile);
+ if ($reportDir === '.') {
+ // Passed report file is a filename in the current directory.
+ $reportFile = PHPCS_CWD.'/'.basename($reportFile);
+ } else {
+ $reportDir = realpath(PHPCS_CWD.'/'.$reportDir);
+ if ($reportDir !== false) {
+ // Report file path is relative.
+ $reportFile = $reportDir.'/'.basename($reportFile);
+ }
+ }
+ }
+
$reportClass = self::factory($report);
$reportData = $this->prepare($filesViolations);
+ $toScreen = true;
if ($reportFile !== null) {
+ $toScreen = false;
ob_start();
}
- $numErrors = $reportClass->generate($reportData, $showSources, $reportWidth);
+ $numErrors = $reportClass->generate($reportData, $showSources, $reportWidth, $toScreen);
if ($reportFile !== null) {
$generatedReport = ob_get_contents();
View
51 pear/PHP/CodeSniffer/Reports/Checkstyle.php 100755 → 100644
@@ -9,9 +9,8 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: IsCamelCapsTest.php 240585 2007-08-02 00:05:40Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -25,9 +24,9 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_Reports_Checkstyle implements PHP_CodeSniffer_Report
@@ -42,44 +41,58 @@ class PHP_CodeSniffer_Reports_Checkstyle implements PHP_CodeSniffer_Report
* @param array $report Prepared report.
* @param boolean $showSources Show sources?
* @param int $width Maximum allowed lne width.
- *
- * @return string
+ * @param boolean $toScreen Is the report being printed to screen?
+ *
+ * @return string
*/
public function generate(
$report,
$showSources=false,
- $width=80
+ $width=80,
+ $toScreen=true
) {
- echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
- echo '<checkstyle version="1.3.0">'.PHP_EOL;
+ $out = new XMLWriter;
+ $out->openMemory();
+ $out->setIndent(true);
+ $out->startDocument('1.0', 'UTF-8');
+ $out->startElement('checkstyle');
+ $out->writeAttribute('version', '1.3.3');
$errorsShown = 0;
foreach ($report['files'] as $filename => $file) {
- echo ' <file name="'.$filename.'">'.PHP_EOL;
+ if (count($file['messages']) === 0) {
+ continue;
+ }
+
+ $out->startElement('file');
+ $out->writeAttribute('name', $filename);
foreach ($file['messages'] as $line => $lineErrors) {
foreach ($lineErrors as $column => $colErrors) {
foreach ($colErrors as $error) {
- $error['type'] = strtolower($error['type']);
- $error['message'] = htmlspecialchars($error['message']);
+ $error['type'] = strtolower($error['type']);
if (PHP_CODESNIFFER_ENCODING !== 'utf-8') {
$error['message'] = iconv(PHP_CODESNIFFER_ENCODING, 'utf-8', $error['message']);
}
- echo ' <error line="'.$line.'" column="'.$column.'"';
- echo ' severity="'.$error['type'].'"';
- echo ' message="'.$error['message'].'"';
- echo ' source="'.$error['source'].'"';
- echo '/>'.PHP_EOL;
+ $out->startElement('error');
+ $out->writeAttribute('line', $line);
+ $out->writeAttribute('column', $column);
+ $out->writeAttribute('severity', $error['type']);
+ $out->writeAttribute('message', $error['message']);
+ $out->writeAttribute('source', $error['source']);
+ $out->endElement();
+
$errorsShown++;
}
}
}//end foreach
- echo ' </file>'.PHP_EOL;
+ $out->endElement();
}//end foreach
- echo '</checkstyle>'.PHP_EOL;
+ $out->endElement();
+ echo $out->flush();
return $errorsShown;
View
11 pear/PHP/CodeSniffer/Reports/Csv.php 100755 → 100644
@@ -9,9 +9,8 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: IsCamelCapsTest.php 240585 2007-08-02 00:05:40Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -25,9 +24,9 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_Reports_Csv implements PHP_CodeSniffer_Report
@@ -40,13 +39,15 @@ class PHP_CodeSniffer_Reports_Csv implements PHP_CodeSniffer_Report
* @param array $report Prepared report.
* @param boolean $showSources Show sources?
* @param int $width Maximum allowed lne width.
+ * @param boolean $toScreen Is the report being printed to screen?
*
* @return string
*/
public function generate(
$report,
$showSources=false,
- $width=80
+ $width=80,
+ $toScreen=true
) {
echo 'File,Line,Column,Type,Message,Source,Severity'.PHP_EOL;
View
23 pear/PHP/CodeSniffer/Reports/Emacs.php 100755 → 100644
@@ -9,9 +9,8 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: IsCamelCapsTest.php 240585 2007-08-02 00:05:40Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -25,9 +24,9 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_Reports_Emacs implements PHP_CodeSniffer_Report
@@ -36,17 +35,19 @@ class PHP_CodeSniffer_Reports_Emacs implements PHP_CodeSniffer_Report
/**
* Generates an emacs report.
- *
+ *
* @param array $report Prepared report.
* @param boolean $showSources Show sources?
* @param int $width Maximum allowed lne width.
- *
- * @return string
+ * @param boolean $toScreen Is the report being printed to screen?
+ *
+ * @return string
*/
public function generate(
$report,
$showSources=false,
- $width=80
+ $width=80,
+ $toScreen=true
) {
$errorsShown = 0;
@@ -55,7 +56,11 @@ public function generate(
foreach ($lineErrors as $column => $colErrors) {
foreach ($colErrors as $error) {
$message = $error['message'];
- $type = strtolower($error['type']);
+ if ($showSources === true) {
+ $message .= ' ('.$error['source'].')';
+ }
+
+ $type = strtolower($error['type']);
echo $filename.':'.$line.':'.$column.': '.$type.' - '.$message.PHP_EOL;
$errorsShown++;
}
View
18 pear/PHP/CodeSniffer/Reports/Full.php 100755 → 100644
@@ -9,9 +9,8 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: IsCamelCapsTest.php 240585 2007-08-02 00:05:40Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -25,9 +24,9 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_Reports_Full implements PHP_CodeSniffer_Report
@@ -42,13 +41,15 @@ class PHP_CodeSniffer_Reports_Full implements PHP_CodeSniffer_Report
* @param array $report Prepared report.
* @param boolean $showSources Show sources?
* @param int $width Maximum allowed lne width.
- *
- * @return string
+ * @param boolean $toScreen Is the report being printed to screen?
+ *
+ * @return string
*/
public function generate(
$report,
$showSources=false,
- $width=80
+ $width=80,
+ $toScreen=true
) {
$errorsShown = 0;
$width = max($width, 70);
@@ -135,7 +136,8 @@ public function generate(
echo str_repeat('-', $width).PHP_EOL.PHP_EOL;
}//end foreach
- if (PHP_CODESNIFFER_INTERACTIVE === false
+ if ($toScreen === true
+ && PHP_CODESNIFFER_INTERACTIVE === false
&& class_exists('PHP_Timer', false) === true
) {
echo PHP_Timer::resourceUsage().PHP_EOL.PHP_EOL;
View
5 pear/PHP/CodeSniffer/Reports/Gitblame.php 100755 → 100644
@@ -8,9 +8,8 @@
* @package PHP_CodeSniffer
* @author Ben Selby <benmatselby@gmail.com>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: IsCamelCapsTest.php 240585 2007-08-02 00:05:40Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -23,7 +22,7 @@
* @package PHP_CodeSniffer
* @author Ben Selby <benmatselby@gmail.com>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
* @version Release: 1.2.2
* @link http://pear.php.net/package/PHP_CodeSniffer
View
134 pear/PHP/CodeSniffer/Reports/Hgblame.php
@@ -0,0 +1,134 @@
+<?php
+/**
+ * Mercurial report for PHP_CodeSniffer.
+ *
+ * PHP version 5
+ *
+ * @category PHP
+ * @package PHP_CodeSniffer
+ * @author Ben Selby <benmatselby@gmail.com>
+ * @copyright 2009 SQLI <www.sqli.com>
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
+ * @link http://pear.php.net/package/PHP_CodeSniffer
+ */
+
+/**
+ * Mercurial report for PHP_CodeSniffer.
+ *
+ * PHP version 5
+ *
+ * @category PHP
+ * @package PHP_CodeSniffer
+ * @author Ben Selby <benmatselby@gmail.com>
+ * @copyright 2009 SQLI <www.sqli.com>
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
+ * @version Release: 1.3.3
+ * @link http://pear.php.net/package/PHP_CodeSniffer
+ */
+class PHP_CodeSniffer_Reports_Hgblame extends PHP_CodeSniffer_Reports_VersionControl
+{
+
+ /**
+ * The name of the report we want in the output
+ *
+ * @var string
+ */
+ protected $reportName = 'MERCURIAL';
+
+
+ /**
+ * Extract the author from a blame line.
+ *
+ * @param string $line Line to parse.
+ *
+ * @return mixed string or false if impossible to recover.
+ */
+ protected function getAuthor($line)
+ {
+ $blameParts = array();
+ $line = preg_replace('|\s+|', ' ', $line);
+
+ preg_match(
+ '|(.+[0-9]{2}:[0-9]{2}:[0-9]{2}\s[0-9]{4}\s.[0-9]{4}:)|',
+ $line,
+ $blameParts
+ );
+
+ if (isset($blameParts[0]) === false) {
+ return false;
+ }
+
+ $parts = explode(' ', $blameParts[0]);
+
+ if (count($parts) < 6) {
+ return false;
+ }
+
+ $parts = array_slice($parts, 0, (count($parts) - 6));
+
+ return trim(preg_replace('|<.+>|', '', implode($parts, ' ')));
+
+ }//end getAuthor()
+
+
+ /**
+ * Gets the blame output.
+ *
+ * @param string $filename File to blame.
+ *
+ * @return array
+ */
+ protected function getBlameContent($filename)
+ {
+ $cwd = getcwd();
+
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ echo 'Getting MERCURIAL blame info for '.basename($filename).'... ';
+ }
+
+ $fileParts = explode('/', $filename);
+ $found = false;
+ $location = '';
+ while (empty($fileParts) === false) {
+ array_pop($fileParts);
+ $location = implode($fileParts, '/');
+ if (is_dir($location.'/.hg') === true) {
+ $found = true;
+ break;
+ }
+ }
+
+ if ($found === true) {
+ chdir($location);
+ } else {
+ echo 'ERROR: Could not locate .hg directory '.PHP_EOL.PHP_EOL;
+ exit(2);
+ }
+
+ $command = 'hg blame -u -d -v '.$filename;
+ $handle = popen($command, 'r');
+ if ($handle === false) {
+ echo 'ERROR: Could not execute "'.$command.'"'.PHP_EOL.PHP_EOL;
+ exit(2);
+ }
+
+ $rawContent = stream_get_contents($handle);
+ fclose($handle);
+
+ if (PHP_CODESNIFFER_VERBOSITY > 0) {
+ echo 'DONE'.PHP_EOL;
+ }
+
+ $blames = explode("\n", $rawContent);
+ chdir($cwd);
+
+ return $blames;
+
+ }//end getBlameContent()
+
+
+}//end class
+
+?>
View
24 pear/PHP/CodeSniffer/Reports/Source.php 100755 → 100644
@@ -9,9 +9,8 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: IsCamelCapsTest.php 240585 2007-08-02 00:05:40Z squiz $
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
@@ -25,9 +24,9 @@
* @author Gabriele Santini <gsantini@sqli.com>
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2009 SQLI <www.sqli.com>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
+ * @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0
+ * @version Release: 1.3.3
* @link http://pear.php.net/package/PHP_CodeSniffer
*/
class PHP_CodeSniffer_Reports_Source implements PHP_CodeSniffer_Report
@@ -40,13 +39,15 @@ class PHP_CodeSniffer_Reports_Source implements PHP_CodeSniffer_Report
* @param array $report Prepared report.
* @param boolean $showSources Show sources?
* @param int $width Maximum allowed lne width.
- *
- * @return string
+ * @param boolean $toScreen Is the report being printed to screen?
+ *
+ * @return string
*/
public function generate(
$report,
$showSources=false,
- $width=80
+ $width=80,
+ $toScreen=true
) {
$sources = array();
$width = max($width, 70);
@@ -67,8 +68,8 @@ public function generate(
}
}
}
- }//end foreach
- }//end foreach
+ }
+ }
if ($errorsShown === 0) {
// Nothing to show.
@@ -111,7 +112,7 @@ public function generate(
if (isset($parts[3]) === true) {
$name = $this->makeFriendlyName($parts[3]);
$name[0] = strtolower($name[0]);
- $sniff .= ' '.$name;
+ $sniff .= ' '.$name;
}
if (strlen($sniff) > ($width - 37)) {
@@ -129,7 +130,8 @@ public function generate(
echo 'WERE FOUND IN '.count($sources).' SOURCE(S)'.PHP_EOL;
echo str_repeat('-', $width).PHP_EOL.PHP_EOL;
- if (PHP_CODESNIFFER_INTERACTIVE === false
+ if ($toScreen === true
+ && PHP_CODESNIFFER_INTERACTIVE === false
&& class_exists('PHP_Timer', false) === true
) {
echo PHP_Timer::resourceUsage().PHP_EOL.PHP_EOL;