New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update _s for Coding Standards Issues / VIP Scanner Results #553

Closed
philiparthurmoore opened this Issue Aug 6, 2014 · 17 comments

Comments

Projects
None yet
4 participants
@philiparthurmoore
Copy link
Collaborator

philiparthurmoore commented Aug 6, 2014

@lancewillett brought up a ticket at https://core.trac.wordpress.org/ticket/29127 that I really like and have been thinking about recently. In Subtitles I've set up an automated Travis CI build file that checks the plugin against WordPress Coding Standards and also a few other things like PHP syntax errors. Every time a commit is made to the repository, Travis CI checks the commit build and reports a pass or fail (example here). If the goal is that people will use underscores.me to download _s and the GitHub repo for development, then what are you all's thoughts on setting up _s for build checks?

Things that would be automatically checked on every commit (and pull request) are coding standards and other one-liner tests that are run against themes during code reviews. This would help us know if someone has suggested code that, if merged, would mess things up.

For example, running the current copy of _s against checks returns the following results:

Registering sniffs in the Underscores WordPress Plugin Coding Standards standard... DONE (31 sniffs registered)
Creating file list... DONE (22 files in queue)
Changing into directory /Applications/XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s
Processing 404.php [259 tokens in 56 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing archive.php [763 tokens in 105 lines]... DONE in < 1 second (17 errors, 0 warnings)
Processing comments.php [427 tokens in 69 lines]... DONE in < 1 second (1 errors, 0 warnings)
Processing content-none.php [170 tokens in 33 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing content-page.php [126 tokens in 26 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing content-search.php [399 tokens in 55 lines]... DONE in < 1 second (2 errors, 0 warnings)
Processing content-single.php [366 tokens in 62 lines]... DONE in < 1 second (8 errors, 0 warnings)
Processing content.php [451 tokens in 57 lines]... DONE in < 1 second (2 errors, 0 warnings)
Processing footer.php [99 tokens in 25 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing functions.php [608 tokens in 130 lines]... DONE in < 1 second (22 errors, 0 warnings)
Processing header.php [187 tokens in 37 lines]... DONE in < 1 second (0 errors, 0 warnings)
Changing into directory /Applications/XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s/inc
Processing custom-header.php [478 tokens in 126 lines]... DONE in < 1 second (37 errors, 0 warnings)
Processing customizer.php [147 tokens in 26 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing extras.php [450 tokens in 89 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing jetpack.php [67 tokens in 19 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing template-tags.php [883 tokens in 135 lines]... DONE in < 1 second (33 errors, 0 warnings)
Processing wpcom.php [119 tokens in 29 lines]... DONE in < 1 second (0 errors, 0 warnings)
Changing into directory /Applications/XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s
Processing index.php [154 tokens in 46 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing page.php [124 tokens in 35 lines]... DONE in < 1 second (1 errors, 0 warnings)
Processing search.php [183 tokens in 45 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing sidebar.php [46 tokens in 15 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing single.php [128 tokens in 32 lines]... DONE in < 1 second (1 errors, 0 warnings)

FILE: ...ns/XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s/archive.php
--------------------------------------------------------------------------------
FOUND 17 ERROR(S) AFFECTING 17 LINE(S)
--------------------------------------------------------------------------------
 20 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 23 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 26 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 29 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 32 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 35 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 38 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 41 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 44 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 47 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 50 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 53 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 56 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 59 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 62 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 65 | ERROR | Incorrect indentation; expected 1 space, found 6
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 74 | ERROR | Incorrect indentation; expected 1 space, found 5
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
--------------------------------------------------------------------------------


FILE: ...s/XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s/comments.php
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 62 | ERROR | Incorrect indentation; expected 0 space, found 2
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
--------------------------------------------------------------------------------


FILE: ...P/xamppfiles/htdocs/develop/src/wp-content/themes/_s/content-search.php
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
 31 | ERROR | Incorrect indentation; expected 1 space, found 4
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 41 | ERROR | Incorrect indentation; expected 1 space, found 4
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
--------------------------------------------------------------------------------


FILE: ...P/xamppfiles/htdocs/develop/src/wp-content/themes/_s/content-single.php
--------------------------------------------------------------------------------
FOUND 8 ERROR(S) AFFECTING 8 LINE(S)
--------------------------------------------------------------------------------
 34 | ERROR | Incorrect indentation; expected 0 space, found 3
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 36 | ERROR | Incorrect indentation; expected 1 space, found 4
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 38 | ERROR | Incorrect indentation; expected 1 space, found 4
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 40 | ERROR | Blank line found after control structure
    |       | (WordPress.WhiteSpace.ControlStructureSpacing)
 42 | ERROR | Incorrect indentation; expected 0 space, found 3
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 44 | ERROR | Incorrect indentation; expected 1 space, found 4
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 46 | ERROR | Incorrect indentation; expected 1 space, found 4
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 48 | ERROR | Blank line found after control structure
    |       | (WordPress.WhiteSpace.ControlStructureSpacing)
--------------------------------------------------------------------------------


FILE: ...ns/XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s/content.php
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
 33 | ERROR | Incorrect indentation; expected 1 space, found 4
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 43 | ERROR | Incorrect indentation; expected 1 space, found 4
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
--------------------------------------------------------------------------------


FILE: .../XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s/functions.php
--------------------------------------------------------------------------------
FOUND 22 ERROR(S) AFFECTING 22 LINE(S)
--------------------------------------------------------------------------------
 16 | ERROR | Line indented incorrectly; expected at least 1 spaces, found 0
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 23 | ERROR | Incorrect indentation; expected 1 space, found 0
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 25 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 31 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 33 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 34 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 36 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 41 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 43 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 44 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 46 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 48 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 52 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 53 | ERROR | Comma required after last value in array declaration
    |       | (WordPress.Arrays.ArrayDeclaration)
 54 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 56 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 60 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 61 | ERROR | Comma required after last value in array declaration
    |       | (WordPress.Arrays.ArrayDeclaration)
 62 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 64 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 65 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 68 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
--------------------------------------------------------------------------------


FILE: ...amppfiles/htdocs/develop/src/wp-content/themes/_s/inc/custom-header.php
--------------------------------------------------------------------------------
FOUND 37 ERROR(S) AFFECTING 36 LINE(S)
--------------------------------------------------------------------------------
  40 | ERROR | Line indented incorrectly; expected at least 1 spaces, found 0
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  45 | ERROR | Incorrect indentation; expected 1 space, found 0
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  46 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  48 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  49 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  50 | ERROR | Incorrect indentation; expected 2 space, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  51 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 2
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  54 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  55 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  56 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  60 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  61 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 2
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  62 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 2
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  65 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 2
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  67 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 2
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  69 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  69 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  70 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 2
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  71 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 2
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  72 | ERROR | Expected next thing to be a escaping function, not
     |       | '$header_text_color' (WordPress.XSS.EscapeOutput.)
  73 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 2
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  75 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  81 | ERROR | Line indented incorrectly; expected at least 1 spaces, found 0
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  86 | ERROR | Incorrect indentation; expected 1 space, found 0
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  87 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 0
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
  88 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 103 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 104 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 0
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 109 | ERROR | Line indented incorrectly; expected at least 1 spaces, found 0
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 114 | ERROR | Incorrect indentation; expected 1 space, found 0
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 115 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 116 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 0
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 117 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 118 | ERROR | Expected next thing to be a escaping function, not '$style'
     |       | (WordPress.XSS.EscapeOutput.)
 119 | ERROR | Expected next thing to be a escaping function, not '$style'
     |       | (WordPress.XSS.EscapeOutput.)
 123 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 124 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 0
     |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
--------------------------------------------------------------------------------


FILE: ...amppfiles/htdocs/develop/src/wp-content/themes/_s/inc/template-tags.php
--------------------------------------------------------------------------------
FOUND 33 ERROR(S) AFFECTING 31 LINE(S)
--------------------------------------------------------------------------------
 11 | ERROR | Line indented incorrectly; expected at least 1 spaces, found 0
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 14 | ERROR | Incorrect indentation; expected 1 space, found 0
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 15 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 16 | ERROR | Incorrect indentation; expected 2 space, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 17 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 2
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 19 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 20 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 33 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 39 | ERROR | Line indented incorrectly; expected at least 1 spaces, found 0
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 42 | ERROR | Incorrect indentation; expected 1 space, found 0
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 43 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 44 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 45 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 47 | ERROR | Incorrect indentation; expected 2 space, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 48 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 2
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 50 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 51 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 59 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 65 | ERROR | Line indented incorrectly; expected at least 1 spaces, found 0
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 68 | ERROR | Incorrect indentation; expected 1 space, found 0
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 69 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 70 | ERROR | Incorrect indentation; expected 2 space, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 71 | ERROR | Line indented incorrectly; expected at least 3 spaces, found 2
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 74 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 79 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 81 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 83 | ERROR | Expected next thing to be a escaping function, not '$time_string'
    |       | (WordPress.XSS.EscapeOutput.)
 84 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 86 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 89 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 91 | ERROR | Line indented incorrectly; expected at least 2 spaces, found 1
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
 91 | ERROR | Expected next thing to be a escaping function, not '$posted_on'
    |       | (WordPress.XSS.EscapeOutput.)
 91 | ERROR | Expected next thing to be a escaping function, not '$byline'
    |       | (WordPress.XSS.EscapeOutput.)
--------------------------------------------------------------------------------


FILE: ...tions/XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s/page.php
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 24 | ERROR | Incorrect indentation; expected 1 space, found 5
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
--------------------------------------------------------------------------------


FILE: ...ons/XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s/single.php
--------------------------------------------------------------------------------
FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
 21 | ERROR | Incorrect indentation; expected 1 space, found 4
    |       | (WordPress.WhiteSpace.ScopeIndent.Incorrect)
--------------------------------------------------------------------------------

You'll notice that a lot of these results are related to whitespace, which we can choose to either adopt or ignore. Some results are related to escaping, which we can choose to either tackle or suggest improvements in the scanner to ignore false results.

I'm a big fan of these automated checks and would be happy to add a config file into the repo to handle all of this, but I'd like to hear what you all think first.

@lancewillett

This comment has been minimized.

Copy link
Member

lancewillett commented Aug 6, 2014

Note for themes, I don't think the indentation errors are valid. Makes more sense for 100% PHP files.

For default themes I turned that off in WordPress/ruleset.xml:

<rule ref="WordPress.WhiteSpace.ScopeIndent">
  <exclude-pattern>*/wp-content/themes/*</exclude-pattern>
</rule>
@obenland

This comment has been minimized.

Copy link
Member

obenland commented Aug 6, 2014

If the goal is that people will use underscores.me to download _s and the GitHub repo for development, then what are you all's thoughts on setting up _s for build checks?

Uh yes please! I saw it the other day over on https://github.com/Automattic/Jetpack and <3 it.

Adding this would also provide another good opportunity for a Themeshaper post on why they should use underscores.me and not Github directly.

@philiparthurmoore

This comment has been minimized.

Copy link
Collaborator

philiparthurmoore commented Aug 6, 2014

Woot! Yes, Lance, totally agreed on ignoring the indentation stuff. I'll work on getting this added in tomorrow.

@jacklenox

This comment has been minimized.

Copy link
Member

jacklenox commented Aug 6, 2014

I actually don't believe it's possible to follow the coding standards and have correct indentation in theme files. I had a look at this and trying to please the code sniffer made things very hard to read.

@philiparthurmoore

This comment has been minimized.

Copy link
Collaborator

philiparthurmoore commented Aug 7, 2014

I actually don't believe it's possible to follow the coding standards and have correct indentation in theme files. I had a look at this and trying to please the code sniffer made things very hard to read.

Yep, I had the same problem. As Lance noted, it works really well with pure PHP files but for theme files it doesn't work so well at all.

@philiparthurmoore

This comment has been minimized.

Copy link
Collaborator

philiparthurmoore commented Aug 7, 2014

Alright, before I go about adding codesniffer.ruleset.xml and .travis.yml into this repository, there are a few issues that I think we need to figure out, mainly around the fact that scans against the current coding standards will absolutely fail, even if we account for the fact that WordPress.WhiteSpace.ScopeIndent.Incorrect needs to be ignored.

The primary issue is with WordPress.XSS.EscapeOutput, which reports the following errors in the current version of _s:

FILE: ...P/xamppfiles/htdocs/develop/src/wp-content/themes/_s/content-single.php
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
 40 | ERROR | Blank line found after control structure
    |       | (WordPress.WhiteSpace.ControlStructureSpacing)
 48 | ERROR | Blank line found after control structure
    |       | (WordPress.WhiteSpace.ControlStructureSpacing)
--------------------------------------------------------------------------------


FILE: .../XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s/functions.php
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
 53 | ERROR | Comma required after last value in array declaration
    |       | (WordPress.Arrays.ArrayDeclaration)
 61 | ERROR | Comma required after last value in array declaration
    |       | (WordPress.Arrays.ArrayDeclaration)
--------------------------------------------------------------------------------


FILE: ...amppfiles/htdocs/develop/src/wp-content/themes/_s/inc/custom-header.php
--------------------------------------------------------------------------------
FOUND 3 ERROR(S) AFFECTING 3 LINE(S)
--------------------------------------------------------------------------------
  72 | ERROR | Expected next thing to be a escaping function, not
     |       | '$header_text_color' (WordPress.XSS.EscapeOutput.)
 118 | ERROR | Expected next thing to be a escaping function, not '$style'
     |       | (WordPress.XSS.EscapeOutput.)
 119 | ERROR | Expected next thing to be a escaping function, not '$style'
     |       | (WordPress.XSS.EscapeOutput.)
--------------------------------------------------------------------------------


FILE: ...amppfiles/htdocs/develop/src/wp-content/themes/_s/inc/template-tags.php
--------------------------------------------------------------------------------
FOUND 3 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
 83 | ERROR | Expected next thing to be a escaping function, not '$time_string'
    |       | (WordPress.XSS.EscapeOutput.)
 91 | ERROR | Expected next thing to be a escaping function, not '$posted_on'
    |       | (WordPress.XSS.EscapeOutput.)
 91 | ERROR | Expected next thing to be a escaping function, not '$byline'
    |       | (WordPress.XSS.EscapeOutput.)
--------------------------------------------------------------------------------

There seem to be a few things that we can do to deal with this:

  1. Raise all false alarm issues on the coding standards repo and get those fixed in the standards scanner.
  2. Be okay with the fact that Travis CI will continue to report failed builds with every _s commit until the first objective is fully taken care of.
  3. Choose to ignore the WordPress.XSS.EscapeOutput output, which I highly recommend against.

We keep running into a few of these issues as false alarms during theme reviews as well, so I think that we should really try to tackle this in the scanner and also add the config files into _s even though we know that the builds will fail.

Thoughts?

@jacklenox

This comment has been minimized.

Copy link
Member

jacklenox commented Aug 7, 2014

This is definitely a tricky issue; I looked into this a couple of months ago.

I agree that 3 is bad.

It's slightly hackish, but one way of getting round the escaping issue is to put something like this in the functions.php:

// Echo content that has already been sanitised
function unescaped_echo( $content ) {
    echo $content;
}

While this is ugly and not really advisable, it allows us to at least acknowledge that the content in question is already escaped, and therefore we're intentionally letting it be echoed as is.

It also solves the problem of scans being littered with false alarms. We would just have one in functions.php (which we at least know about).

I don't think the first two chunks of errors in your comment are escaping-related. We could solve those by doing what it says. For the first, as far as I can tell, it just doesn't like these blank lines:

                }

            } else {
                }

            } // end check for categories on this blog

For the second, it wants to change this:

    add_theme_support( 'html5', array(
        'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
    ) );

To this:

    add_theme_support( 'html5', array(
        'search-form', 'comment-form', 'comment-list', 'gallery', 'caption',
    ) );

Forgive me if I've misunderstood any of this.

@obenland

This comment has been minimized.

Copy link
Member

obenland commented Aug 7, 2014

I think we should wait to add it until we can be sure we don't get false positives.

@philiparthurmoore

This comment has been minimized.

Copy link
Collaborator

philiparthurmoore commented Aug 8, 2014

Which may be never. I'd love to leave this open and put a lot of effort
into fixing those false positives as soon as possible. They've been
plaguing theme reviews for as long as I can remember. One thing we can also
do is add the files into the repo and exclude the XSS rules until the false
positives are fixed. That way we'd still benefit from all the other scanner
stuff.
On Aug 8, 2014 1:09 AM, "Konstantin Obenland" notifications@github.com
wrote:

I think we should wait to add it until we can be sure we don't get false
positives.


Reply to this email directly or view it on GitHub
#553 (comment).

@philiparthurmoore

This comment has been minimized.

Copy link
Collaborator

philiparthurmoore commented Aug 12, 2014

Note that I'll take care of this this weekend by adding in proper configuration files and excluding both XSS and whitespace rules so that we're able to benefit from all other coding standards findings and also be able to tackle the false alerts.

@ghost

This comment has been minimized.

Copy link

ghost commented Aug 13, 2014

Note for themes, I don't think the indentation errors are valid. Makes more sense for 100% PHP files.

I agree, however on most occurrences it can easily be solved by starting an array on a new line.

@philiparthurmoore

This comment has been minimized.

Copy link
Collaborator

philiparthurmoore commented Aug 17, 2014

Excluding Whitespace and false XSS issues, PHP Syntax and all other Coding Standards issues are passed by _s.

See this: https://travis-ci.org/philiparthurmoore/_s/builds/32783504. Also see this: https://github.com/philiparthurmoore/_s/commit/895b7a93ab80c8c01eb946a8dc2aab909ee9f0b5.

Build status will update shortly. Once all those tests pass, we can integrate these files into _s and then go about the business of tackling false positives and also start adding in good scans to check the theme against.

Moving forward, this file should be used to add in the types of scans that WordPress.com uses against themes and also the theme check.

The goals here:

  1. All pull requests will automatically be checked against coding standards.
  2. We'll be able to keep track of all scans run against themes and make sure that _s passes everything.

The goal isn't to reinvent the wheel, but to use all the current tools we have in an automated fashion to make sure that _s stays the best coded theme in the world. 😄

It's probably time to add an ignore file into the repo for stuff like this.

@philiparthurmoore

This comment has been minimized.

Copy link
Collaborator

philiparthurmoore commented Aug 17, 2014

While Travis is building my commit, here's the expected output:

Registering sniffs in the Underscores WordPress Theme Coding Standards Configuration standard... DONE (30 sniffs registered)
Creating file list... DONE (22 files in queue)
Changing into directory /Applications/XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s
Processing 404.php [259 tokens in 56 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing archive.php [763 tokens in 105 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing comments.php [427 tokens in 69 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing content-none.php [170 tokens in 33 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing content-page.php [126 tokens in 26 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing content-search.php [399 tokens in 55 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing content-single.php [364 tokens in 60 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing content.php [451 tokens in 57 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing footer.php [99 tokens in 25 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing functions.php [610 tokens in 130 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing header.php [187 tokens in 37 lines]... DONE in < 1 second (0 errors, 0 warnings)
Changing into directory /Applications/XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s/inc
Processing custom-header.php [478 tokens in 126 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing customizer.php [147 tokens in 26 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing extras.php [450 tokens in 89 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing jetpack.php [67 tokens in 19 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing template-tags.php [883 tokens in 135 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing wpcom.php [119 tokens in 29 lines]... DONE in < 1 second (0 errors, 0 warnings)
Changing into directory /Applications/XAMPP/xamppfiles/htdocs/develop/src/wp-content/themes/_s
Processing index.php [154 tokens in 46 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing page.php [124 tokens in 35 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing search.php [183 tokens in 45 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing sidebar.php [46 tokens in 15 lines]... DONE in < 1 second (0 errors, 0 warnings)
Processing single.php [128 tokens in 32 lines]... DONE in < 1 second (0 errors, 0 warnings)
@obenland

This comment has been minimized.

Copy link
Member

obenland commented Aug 17, 2014

❤️ it!

@philiparthurmoore

This comment has been minimized.

Copy link
Collaborator

philiparthurmoore commented Aug 17, 2014

When things pass, there will be a nice little notice in the build boxes from Travis:

The command "find . \( -name '*.php' \) -exec php -lf {} \;" exited with 0.

And also:

The command "$WP_DEVELOP_DIR/php-codesniffer/scripts/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php" exited with 0.

0 is good. Very good.

@philiparthurmoore

This comment has been minimized.

Copy link
Collaborator

philiparthurmoore commented Aug 17, 2014

For posterity, because I'll probably end up ditching my _s repo when this is done. This is what good builds look like:

2014-08-17_23-57-57

philiparthurmoore added a commit that referenced this issue Aug 17, 2014

gatespace added a commit to gatespace/_s that referenced this issue Aug 18, 2014

Merge remote-tracking branch 'upstream/master' into ja
* upstream/master:
  Kick off Travis CI Build Monitoring for _s
  Prepare Underscores for Coding Standards. See Automattic#553. [skip ci]
  Prepare Underscores for Coding Standards. See Automattic#553.
@philiparthurmoore

This comment has been minimized.

Copy link
Collaborator

philiparthurmoore commented Aug 31, 2014

I'm going to close this out and open separate Issues to address future scan problems that we'll need to take care of moving forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment