-
Task
-
Resolution: Fixed
-
Low
-
None
Since the 31th of March 2023, the following coding style policy will be implemented:
- One or more spaces are allowed before assignments. One and only one space is allowed after assignments.
- When making decisions about the spaces to apply before assignments, please consider both surrounding and similar code.
Note1: Note that this issue completely leaves without effect the outcome agreed @ MDLSITE-6594.
Note2: In practice, the "new" coding style policy is not that new, but exactly the status-quo before these issues.
In MDLSITE-6594 it was agreed that 'There should be only one blank space before and after the assignment operator "="'. However, this has caused some problems so this issue is to re-evaluate it.
Voting
Timeframe
Voting for this issue opens immediately (Monday 20th March 2023) and will remain open until Thursday 30th March 2023 at 12pm UTC.
Voting options
The following options are suggested for voting:
Voting options
Option A
Continue with the rule that was agreed upon in MDLSITE-6594 (so only one space before and after = sign) and work out if some exceptions (like version.php) are required.
If you vote for this option, it would be great if you could give the exceptions you would expect.
$forumid = required_param('id', PARAM_INT); |
$userids = optional_param_array('userids', [], PARAM_INT); |
$discussionids = optional_param_array('discids', [], PARAM_INT); |
$from = optional_param_array('from', [], PARAM_INT); |
$to = optional_param_array('to', [], PARAM_INT); |
Option B
- Allow one or more spaces before the operator.
- Recommend that there should only be one space before the operator.
- Option B.1
- If the code has more than 1 space before the operator, emit a coding-style warning.
- Option B.2:
- If the code has more than 1 space before the operator, don't emit any coding-style warning.
This is what is recommended:
$action = required_param('action', PARAM_ALPHA); |
$id = optional_param('entryid', 0, PARAM_INT); |
$confirm = optional_param('confirm', 0, PARAM_BOOL); |
But this is valid too. With B.1 and B.2 you'll vote if a warning should be raised by CiBoT or not:
$action = required_param('action', PARAM_ALPHA); |
$id = optional_param('entryid', 0, PARAM_INT); |
$confirm = optional_param('confirm', 0, PARAM_BOOL); |
Option C
Entirely revert the policy agreed upon in MDLSITE-6594. Either one or more spaces before the operator is fine. moodle-cs checks for spaces before operators will stay reverted.
- has been marked as being related by
-
MDLSITE-6594 Coding style: white spaces around =
-
- Closed
-