Phpmd Error: The class uses sessions or cookies while not being a part of HTML Presentation layer in Magento 2.

In Magento 2, You are trying to commit the module with PHP Code standard tools GrumPHP and your module have an issue related to Sessions or cookies that are not used in the Presentation layer at that time you are facing the error like this,

The class uses sessions or cookies while not being a part of HTML Presentation layer.

You have to fixed PHPMD error by adding SuppressWarnings before the class name.

Class Demo,

/**
 * Customer Account Management
 *
 * @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
 */
class AccountManagement
{

}

You can Suppress the warning by @SuppressWarnings(PHPMD.CookieAndSessionMisuse) syntax.

CookieAndSessionMisuse Suppress Warnings introduced from Magento 2.3.1

After keeping above line in your class and you can prevent PHPMd error at commit time using Grumphp.