Issue Feature Closed

#90983Add support for manually flagged false-positives in ExtensionScanner\Php

Josef Glatz 04/09/20, 11:54 updated 02/19/22, 14:49

Description

Description

The extension scanner actually support the following comments:

For a whole class

/* @extensionScannerIgnoreFile */

For a specific line

/* @extensionScannerIgnoreLine */

It would be nice, to have a comment to mark lines as resolved for specific checks:

This is especially useful if you maintain an TYPO3 extension which supports multiple TYPO3 core versions.

An example: the scanner mentioned the old usage of the PageRepository namespace in the else block

        if (class_exists(TYPO3\CMS\Core\Domain\Repository\PageRepository::class)) {
            $doktypeSysfolder = \TYPO3\CMS\Core\Domain\Repository\PageRepository::DOKTYPE_SYSFOLDER;
        } else {
            $doktypeSysfolder = \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SYSFOLDER;
        }

A possible solution that comes to my mind:

        if (class_exists(TYPO3\CMS\Core\Domain\Repository\PageRepository::class)) {
            $doktypeSysfolder = \TYPO3\CMS\Core\Domain\Repository\PageRepository::DOKTYPE_SYSFOLDER;
        } else {
            /* @extensionScannerLineCheckedIssue 88746 */
            $doktypeSysfolder = \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SYSFOLDER;
        }

With such a functionality the following possibilities could be help

/* @extensionScannerIgnoreFile */
/* @extensionScannerIgnoreLine */

/* @extensionScannerFileCheckedIssue 88746 */
/* @extensionScannerFileCheckedIssue 88746 12345 45678  */

/* @extensionScannerLineCheckedIssue 88746 */
/* @extensionScannerLineCheckedIssue 88746 12345 45678 */

New Features:

  • ignore checks for one or more issues for a whole class
  • ignore checks for one or more issues for one line

—-

What do you think about?

Would like to hear your thoughts! Also some thoughts about the naming

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.