nunomaduro / phpinsights

🔰 Instant PHP quality checks from your console
https://phpinsights.com
MIT License
5.32k stars 283 forks source link

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

Open eusonlito opened 8 months ago

eusonlito commented 8 months ago
Q A
Bug report? maybe
Feature request? no
Library version dev-master (f476219759a61aad988641476259465c77203383)

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!

webmasterMeyers commented 2 months ago

Did you figure this out?

eusonlito commented 2 months ago

@webmasterMeyers no :(