[TYPO3-core] CGL violations "unused parameters"

Andy Grunwald andygrunwald at gmail.com
Mon Oct 22 15:38:58 CEST 2012


Am 19.10.2012 22:52, schrieb Roland:
> can someone please tell me if i can fix those CGL violations just by
> deleting the unused parameters? or are those unused parameters there on
> purpose?
>
> http://bit.ly/S3gEsS
>
> according to sonat in total there are 400+ unused parameters in core. i
> could fix that but am not sure if there were some pitfalls...
>
> https://metrics.typo3.org/drilldown/violations/2
>

It is not possible to answer this question in general.
Your linked metric is only a static analysis.

As you see in Xaviers example, you have to decide this from case to 
case. In many cases the parameter is not used and not necessary. In some 
other cases the parameter is there for legacy reasons. And in the last 
cases the unused parameter is used in xclasses for special services 
(like DBAL).

But for this question the code reviews which must be done in Gerrit are 
perfect, because many people know more than one alone. Some cases you 
know as well. And the discussion with the other developers will bring 
the result.

As we know now this rule is wrong for t3lib_DB. This seems to be a 
useful exclude rule for this sniff to this class.
I opened a new ticket for this: http://forge.typo3.org/issues/42276

if you decide to "fight" against this violations and you detect other 
code snippets which are "correct" (like t3lib_DB) ould you be so nice to 
open a new ticket at 
http://forge.typo3.org/projects/team-php_codesniffer ? That would be great.

Thanks!

Andy


More information about the TYPO3-team-core mailing list