Skip to:
Content

BuddyPress.org

Changeset 13850


Ignore:
Timestamp:
05/04/2024 12:56:31 PM (3 years ago)
Author:
espellcaste
Message:

Improve handing of PHP code standards using WPCS

Until we have all WPCS warnings and errors fixed, we block pull requests, and releases, with code with escaping or/and PHP Compatibility issues.

For local development only, we set WPCS severity to 1 to see everything that is not effectively turned off.

Run composer run phpcs for showing all WPCS issues.
Run composer run phpcs-escape for showing escaping issues.
Run composer run phpcompat for showing PHP Compatibility issues.

See #7228
Closes ​https://github.com/buddypress/buddypress/pull/282/

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/coding-standards.yml

    r13684 r13850  
    3434          composer-options: "--ignore-platform-reqs"
    3535
    36       - name: Run PHPCS
    37         run: composer phpcs
     36      - name: Run PHPCS Escape
     37        run: composer phpcs-escape
     38
     39      - name: Run PHP Compatibility
     40        run: composer phpcompat
  • trunk/Gruntfile.js

    r13709 r13850  
    161161                        }
    162162                },
     163                // Remove this when all WPCS issues are resolved.
    163164                checktextdomain: {
    164165                        options: {
    … …  
    343344                                stdout: false
    344345                        },
     346                        phpcs_escape: {
     347                                command: 'composer run phpcs-escape',
     348                                stdout: true
     349                        },
    345350                        phpcompat: {
    346                                 command: './vendor/bin/phpcs -p --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 5.6- src tests',
     351                                command: 'composer run phpcompat',
    347352                                stdout: true
    348353                        },
    … …  
    402407        grunt.registerTask( 'style', ['stylelint', 'sass', 'postcss', 'rtlcss'] );
    403408        grunt.registerTask( 'makepot', ['exec:makepot'] );
    404         grunt.registerTask( 'commit', ['src', 'checktextdomain', 'imagemin', 'phplint', 'exec:phpcompat'] );
     409        grunt.registerTask( 'commit', ['src', 'checktextdomain', 'imagemin', 'phplint', 'exec:phpcs_escape', 'exec:phpcompat'] );
    405410        grunt.registerTask( 'commit:blocks', ['commit', 'exec:blocks_src', 'exec:modernJS_src'] );
    406411        grunt.registerTask( 'bp_rest', [ 'exec:rest_api', 'copy:bp_rest_components', 'copy:bp_rest_core', 'clean:bp_rest' ] );
  • trunk/composer.json

    r13801 r13850  
    4949                "phpcs": "@php ./vendor/bin/phpcs . --basepath=.",
    5050                "phpcbf": "@php ./vendor/bin/phpcbf . --basepath=.",
     51                "phpcs-escape": "@php ./vendor/bin/phpcs src --extensions=php -sp --standard=BuddyPress --sniffs=WordPress.Security.EscapeOutput",
     52                "phpcompat": "@php ./vendor/bin/phpcs --standard=PHPCompatibilityWP --extensions=php -sp --runtime-set testVersion 5.6- src tests",
    5153                "test:watch": [
    5254                        "Composer\\Config::disableProcessTimeout",
  • trunk/phpcs.xml.dist

    r13801 r13850  
    1212        v flag: Print processed files.
    1313        -->
    14         <arg value="psv" />
     14        <arg value="sp" />
     15
     16        <!-- Make it pretty. -->
     17        <arg name="colors"/>
    1518
    1619        <!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
    … …  
    2023        <arg name="parallel" value="20"/>
    2124
    22         <!-- Set severity to 6 to see everything that isn't effectively turned off. -->
    23         <arg name="severity" value="6"/>
     25        <!-- Set severity to 1 to see everything that isn't effectively turned off. -->
     26        <arg name="severity" value="1"/>
    2427
    2528        <!-- What to exclude -->
Note: See TracChangeset for help on using the changeset viewer.