-
Sub-task
-
Resolution: Fixed
-
Minor
-
2.1, 2.2
-
None
-
MOODLE_21_STABLE, MOODLE_22_STABLE
-
MOODLE_23_STABLE, MOODLE_24_STABLE
I have been using the code-checker to help upgrade some previously-1.9 code to 2.x, and I have noticed that indentation is sometimes reported as incorrect when it is not (as far as I am aware).
In the below (example) scenario, when breaking out of PHP to add a block of HTML, the codechecker suggests that lines 4 to 10 are incorrectly indented:
|
01. <?php
|
02. if (1=1) {
|
03. $somevar = true;
|
04. ?>
|
05. <div>
|
06. <p>
|
07. <span>some page content</span>
|
08. </p>
|
09. </div>
|
10. <?php
|
11. }
|
12. ?>
|
The code-checker identifies line 3 as intented correctly, but then expects the PHP tags and HTML to be similarly indented, which I do not believe should be the case. Example error:
<center>
472: Line indented incorrectly; expected at least 4 spaces, found 0
I don't think that when breaking out of PHP into HTML the indentation should be maintained. Certainly this is not the case from many chunks of code I have seen: HTML maintains its own intentation, sometimes using two spaces instead of four, sometimes using no indentation at all.
- has been marked as being related by
-
CONTRIB-4148 Detect multiple classes per test file
- Closed