Skip to content

Core code quality issues may not be noticed by code quality auditing tools #30446

Open
@ericmorand

Description

@ericmorand

Preconditions (*)

None. This issue applies to every Magento 2 release since its creation.
Magento 2.4-develop

Steps to reproduce (*)

Execute a global search of @SuppressWarnings in the packages located under the magento vendor.

Using PHPStorm to perform the search, I get 8462 (eight thousand four hundred and sixty two) occurences of @SuppressWarnings.

Expected result (*)

There should be zero occurence of @SuppressWarnings in the Core source code of Magento 2.

Actual result (*)

There are lots of @SuppressWarnings in the Core source code of Magento 2.

What does it mean?

It means that the Core maintainers are deliberately hiding potential code quality issues from the Core source code by using directives that make the code quality audit tools ignoring some issues.

For example, the Magento\Framework\View\Result\Page class alone is plagued by four potential quality code violations that would never be noticed by the code quality auditing tool:

 * @SuppressWarnings(PHPMD.TooManyFields)
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 * @SuppressWarnings(PHPMD.DepthOfInheritance)
 * @SuppressWarnings(PHPMD.ExcessiveParameterList)

In other words: Magento 2 code quality may be a a fraud, and a deliberate one.

I'm not saying that it is. Magento 2 code quality may be absolutely perfect, but these directives that suppress code quality warnings cast a shadow of doubt over the honesty of the maintainers. Magento 2 Core maintainers should seriously consider removing all these @SuppressWarnings directives, run their code quality audit and publish the result. This is the only way to remove the doubts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: CodeIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: ready for confirmationPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.0Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions