Skip to content

Can not ignore SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff #675

@eusonlito

Description

@eusonlito
Q A
Bug report? maybe
Feature request? no
Library version dev-master (f476219)

I have a large function that only returns an array, and I'm try to disable the SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff error but I can...

I have tried:

    /**
     * @phpcsSuppress SlevomatCodingStandard.Functions.FunctionLength
     *
     * @return array
     */
    // phpcs:disable
    public function keys(): array
    {
        return [
            [
                'key' => 'first',
                'title' => __('forecast-version-v1.first'),
                'description' => __('forecast-version-v1.first-description'),
                'format' => 'float',
                'list' => true,
            ],
...
            [
                'key' => 'last_first_percent_valid',
                'title' => __('forecast-version-v1.last_first_percent_valid'),
                'description' => __('forecast-version-v1.last_first_percent_valid-description'),
                'format' => 'bool',
                'list' => false,
            ],
        ];
    }
    // phpcs:enable

But I always get:

• [Architecture] Function length: (SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff)
  app/Domains/Forecast/Service/Version/V1/Values.php:52: Your function is too long. Currently using 100 lines. Can be up to 80 lines.

I get the same error for UnusedParameterSniff using all available ignore comments:

• [Code] Unused parameter: (SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff)

How can I ignore this errors?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions