Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-25733

CodeSniffer will die "randomly" if run on multiple files.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • 2.0
    • Other
    • None
    • Ubuntu 10.10
    • MOODLE_20_STABLE
    • Easy

      I borrowed the Moodle Standard to use in a test of PHPCodeSniffer, I installed it into a current build of PHPCodeSniffer and tried to run it on the Moodle 1.9.10 code base. An unhandled exception was raised during the parsing of mnet/lib.php, causing phpcs to die.

      Tracking the issue down, it appears that there's an error in the Standards/Moodle/Sniffs/Commenting/FunctionCommentSniff.php file where the class pointer doesn't get reset before each file. Therefore the stale class pointer from the previous file environment.php was leaking into the next file, lib.php, and it was pointing to a token which was not a class declaration.

      I've attached a patch file that prevents the exception and the crash.

            Unassigned Unassigned
            tbannister Tyler Bannister
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.