You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating an issue to track rules that would be useful to add, change or remove in our existing CS. Adding some could help with automagic code formatting, whereas changing or removing could help with annoying ones that we frequently ignore anyway.
To add
Warning if a new function is over 100 lines long, it can probably be refactored/split up. Error at 500?
Warning if a new file (handmade, not generated) is over 500 lines long. Error at 1000?
Warning if we are chaining foreach loops or looping over the same variable twice, might be a better way to do things.
Warning if we are accessing the property of an object or array without a defensive check, i.e. if ($array[0] != null && count($array[0]) > 1)
To Change/Remove
Squiz.Classes.ValidClassName.NotCamelCaps Do we actually care? WP uses snake_case but "Class names should use capitalized words separated by underscores. Any acronyms should be all upper case" e.g. Walker_Category, WP_Post & WP_HTTP.
WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase See Squiz.Classes.ValidClassName.NotCamelCaps above.
The text was updated successfully, but these errors were encountered:
Re: Squiz.Classes.ValidClassName.NotCamelCaps, I've never found this to be that big a problem for readability. Comments and the keywords used in naming variables and functions seem to be more important for comprehension.
A few ideas off the top of my head:
Warning if a new function is over 100 lines long, it can probably be refactored/split up. Error at 500?
Warning if a new file (handmade, not generated) is over 500 lines long. Error at 1000?
Warning if we are chaining foreach loops or looping over the same variable twice, might be a better way to do things.
Warning if we are accessing the property of an object or array without a defensive check, i.e. if ($array[0] != null && count($array[0]) > 1)
Why
Creating an issue to track rules that would be useful to add, change or remove in our existing CS. Adding some could help with automagic code formatting, whereas changing or removing could help with annoying ones that we frequently ignore anyway.
To add
To Change/Remove
Squiz.Classes.ValidClassName.NotCamelCaps
Do we actually care? WP uses snake_case but "Class names should use capitalized words separated by underscores. Any acronyms should be all upper case" e.g. Walker_Category, WP_Post & WP_HTTP.WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
SeeSquiz.Classes.ValidClassName.NotCamelCaps
above.The text was updated successfully, but these errors were encountered: