Skip to content
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

Array trailing comma on comment lines #230

Closed
GaryJones opened this issue Aug 28, 2014 · 4 comments · Fixed by #327
Closed

Array trailing comma on comment lines #230

GaryJones opened this issue Aug 28, 2014 · 4 comments · Fixed by #327

Comments

@GaryJones
Copy link
Member

Related: #59

add_theme_support( 'tha_hooks', array(

    /**
     * As a Theme developer, use the 'all' parameter, to declare support for all
     * hook types.
     * Please make sure you then actually reference all the hooks in this file,
     * Plugin developers depend on it!
     */
    'all',

    /**
     * Themes can also choose to only support certain hook types.
     * Please make sure you then actually reference all the hooks in this type
     * family.
     *
     * When the 'all' parameter was set, specific hook types do not need to be
     * added explicitly.
     */
    'html',
    'body',
    'head',
    'header',
    'content',
    'entry',
    'comments',
    'sidebars',
    'sidebar',
    'footer',

    /**
     * If/when WordPress Core implements similar methodology, Themes and Plugins
     * will be able to check whether the version of THA supplied by the theme
     * supports Core hooks.
     */
//  'core'
) );

This is from the Theme Hooks Alliance, specifically a PR that aims to fix up the CS.

One false-positive seems to be occurring on that penultimate line ( // 'core' ) - it's asking for a trailing comma.

Comma required after last value in array declaration (WordPress.Arrays.ArrayDeclaration)

Since this is a comment, there shouldn't be a comma, and the previous non-comment line does have a trailing comma. Moving the block comment to last doesn't change the false positive. Moving 'footer', down naturally fixes the problem, so it strongly suggests it is related to having a comment / block comment as the last item.

Does the sniff need to exclude the trailing comma check for comment / block comment tokens?

@westonruter
Copy link
Member

Yes, it looks like it.

@jrfnl
Copy link
Member

jrfnl commented Aug 28, 2014

Related issue #134

@GaryJones
Copy link
Member Author

Ah, sorry. I did look for an existing issue but didn't spot that one. I'd even commented on #134 before!

@jrfnl
Copy link
Member

jrfnl commented Aug 29, 2014

@GaryJones Happens to the best of us ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants