- @jonathan1055 opened merge request.
- π¬π§United Kingdom jonathan1055
New branch for 10.1. Initially running all DrupalPractice sniffs to see what we get.
- Status changed to Needs review
almost 2 years ago 2:11pm 26 February 2023 - π¬π§United Kingdom jonathan1055
There are 40 sniffs in DrupalPractice. 5 are already in phpcs.xml.dist and being checked for. 15 have failures. 2 have been suggested as no longer relevant to 10.x (see comment #12). That leaves 40 - 5 - 15 -2 = 18 which already pass in core 10.1 but are not tested for. The next commit adds these 18 sniffs into phpcs.xml.dist
- π¬π§United Kingdom jonathan1055
That's good. The dispatcher output now shows that 23 sniffs (not 5) were checked, and they all passed.
DrupalPractice (23 sniffs) -------------------------- DrupalPractice.CodeAnalysis.VariableAnalysis DrupalPractice.Commenting.AuthorTag DrupalPractice.Commenting.ExpectedException DrupalPractice.FunctionCalls.CheckPlain DrupalPractice.FunctionCalls.CurlSslVerifier DrupalPractice.FunctionCalls.DbQuery DrupalPractice.FunctionCalls.DbSelectBraces DrupalPractice.FunctionCalls.DefaultValueSanitize DrupalPractice.FunctionCalls.FormErrorT DrupalPractice.FunctionCalls.LCheckPlain DrupalPractice.FunctionCalls.MessageT DrupalPractice.FunctionDefinitions.AccessHookMenu DrupalPractice.FunctionDefinitions.FormAlterDoc DrupalPractice.FunctionDefinitions.HookInitCss DrupalPractice.FunctionDefinitions.InstallT DrupalPractice.General.AccessAdminPages DrupalPractice.General.ClassName DrupalPractice.General.ExceptionT DrupalPractice.General.FormStateInput DrupalPractice.General.LanguageNone DrupalPractice.General.VariableName DrupalPractice.InfoFiles.NamespacedDependency DrupalPractice.Objects.GlobalFunction
The 18 additional sniffs could now be committed to the phpcs.xml.dist file, as in the MR, so that we do not accidentally introduce new failures for these in future commits.
- Status changed to Needs work
almost 2 years ago 12:18am 27 February 2023 - π¬π§United Kingdom alexpott πͺπΊπ
There's still one in that list that make no sense. Like most of the function call ones are checking for functions that don't exist. Perhaps they should have other equivalents but someone needs to do that work. As I wrote before in #14 I think we should swap it around and chose to add each sniff based on the value it gives to us not blindly just because they pass.
A quick check reveals that DrupalPractice.FunctionCalls.CheckPlain, DrupalPractice.FunctionCalls.LCheckPlain, DrupalPractice.General.AccessAdminPages, DrupalPractice.General.VariableName are bogus for Drupal 10 and there are more...
- π¬π§United Kingdom jonathan1055
Thanks @alexpott
we should swap it around and chose to add each sniff based on the value it gives to us not blindly just because they pass
Yes OK, I accept that. I just wanted to make a new branch for 10.1 and update the issue to get it to the same point we had reached in 9.5.
I will go through all 35 sniffs in DrupalPractice that are not yet included in the core phpcs.xml.dist and come back with a suggested list to add, and reasons for excluding the others. I think we need to document why sniffs are excluded so that someone in future does not have to go through the same process.
- π¬π§United Kingdom alexpott πͺπΊπ
I think we need to document why sniffs are excluded...
We also need to do something about upstream - like I think coder shouldn't be running quite a few of these rules on Drupal 9 / 10 code
- π³πΏNew Zealand quietone
Yes, it will help to be sure we are running the right sniffs and to add some documentation.
I made a child issue for the remaining work of implementing DrupalPractice.CodeAnalysis.VariableAnalysis and moved the few remaining issues there.