Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
eusonlito opened this issue Mar 4, 2024 · 0 comments

Comments

@eusonlito
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant