Skip to content

Misleading message for constant comment #164

Closed
@krisdante

Description

@krisdante

Preconditions

The following code comes from Image component:

    /**
     * Default font size
     */
    const DEFAULT_FONT_SIZE = 15;

Steps to reproduce

Test with phpcs
vendor/bin/phpcs --standard=Magento2 lib/internal/Magento/Framework/Image

Expected result

It shall pass

Actual result

FILE: 
lib/internal/Magento/Framework/Image/Adapter/AbstractAdapter.php
----------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------
 65 | WARNING | Constants must have short description if they add information beyond what the constant name supplies.
----------------------------------------------------------------------------------------------------------------------

This is misleading information. The code has a description. Also the constant is self-explanatory.

The test checks if the comment is not equal to the variable itself. That leads to situation that the comment needs to be rephrased to something like "Default size for the font" just to pass this test,

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions