Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-9387

Misleading message in codechecker

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 4.1.5, 4.2.2
    • Local: Code checker
    • None
    • 5
    • MOODLE_401_STABLE, MOODLE_402_STABLE

      Running codechecker (version 5.0.0) against a test folder, you may get the error:

      Data provider method "xxx" must return an array, a Generator or an Iterable.

      Let's assume this is your test starting, for instance, in line 200.

      200    /**
      201     * test_mymodule_coffee_is_ready
      202     *
      203     * @covers ::mymodule_coffee_is_ready
      204     * @dataProvider mymodule_coffee_is_ready_provider
      205     * @param object $userinput The passed user input
      206     * @param object $expected The expected result
      207     */
      208    public function test_mymodule_coffee_is_ready($userinput, $expected) {...

      Somewhere else, of course, you are supposed to have the method starting, for instance, in line 100

      100    /**
      101     * Data provider for mymodule_coffee_is_ready()
      102     *
      103     * Cases to be tested by mymodule_coffee_is_ready
      104     */
      105    public function mymodule_coffee_is_ready_provider(): array {...

      When codechecker finds the error it dispalys a message like:

      #204: ·····*·@dataProvider mymodule_coffee_is_ready_provider
      Data provider method "mymodule_coffee_is_ready_provider" must return an array, a Generator or an Iterable.

      where the line number shown by the message is the line number of the comment of the testing method where its dataProvider is declared (204, in this example)
      and NOT the line number where dataProvider method actually begins (105, in this example)

      IMHO this is a bit misleading.

            stronk7 Eloy Lafuente (stronk7)
            daniss Daniele Cordella
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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