Skip to content

Commit

Permalink
PHPCS Update
Browse files Browse the repository at this point in the history
  • Loading branch information
eleshar committed Aug 29, 2020
1 parent 16e4f33 commit 52be375
Show file tree
Hide file tree
Showing 8 changed files with 2,482 additions and 104 deletions.
60 changes: 47 additions & 13 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,56 @@
engines:
phpcodesniffer:
version: "2"
checks:
argument-count:
enabled: true
config:
standard: "WordPress"
eslint:
threshold: 15
complex-logic:
enabled: true
scss-lint:
config:
threshold: 15
file-lines:
enabled: false
method-complexity:
enabled: true
duplication:
config:
threshold: 25
method-count:
enabled: true
config:
languages:
- php
- javascript
ratings:
paths:
- "includes/*"
exclude_paths:
threshold: 25
method-lines:
enabled: false
nested-control-flow:
enabled: false
return-statements:
enabled: false
similar-code:
enabled: false
identical-code:
enabled: true
plugins:
eslint:
enabled: true
csslint:
enabled: true
scss-lint:
enabled: true
exclude_patterns:
- "tests/"
- "sample-data/"
- "i18n/"
- "bin/"
- "languages/"
- "includes/classes/legacy/"
- "vendor/"
- "config/"
- "db/"
- "dist/"
- "features/"
- "**/node_modules/"
- "script/"
- "**/spec/"
- "**/test/"
- "**/tests/"
- "**/vendor/"
- "**/*.d.ts"
2 changes: 1 addition & 1 deletion .github/workflows/cancel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Get all workflow ids and set to env variable
run: echo ::set-env name=WORKFLOW_IDS_TO_CANCEL::$(curl https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/workflows -s | jq -r '.workflows | map(.id|tostring) | join(",")')

- uses: styfle/[email protected].0
- uses: styfle/[email protected].1
with:
workflow_id: ${{ env.WORKFLOW_IDS_TO_CANCEL }}
access_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/stale@v1
- uses: actions/stale@v3.0.10
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Stale issue message'
Expand Down
34 changes: 15 additions & 19 deletions .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,26 @@
<exclude-pattern>*/woocommerce/*</exclude-pattern>
<exclude-pattern>*/tribe-events/*</exclude-pattern>
<exclude-pattern>*/.github/*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>gulpfile\.js</exclude-pattern>
<exclude-pattern>*/wp-content/*</exclude-pattern>
<exclude-pattern>*.css*</exclude-pattern>
<exclude-pattern>*.js*</exclude-pattern>
<exclude-pattern type="relative">^build/*</exclude-pattern>

<!-- Check up to 8 files simultaneously. -->
<arg name="parallel" value="8" />

<config name="minimum_supported_wp_version" value="5.2" />
<config name="minimum_supported_wp_version" value="5.3" />
<config name="testVersion" value="7.0-" />

<rule ref="WordPress">
<!-- @TODO remove this exclusion: -->
<exclude name="Squiz.Commenting" />
<exclude name="Generic.Commenting" />
<exclude name="Generic.WhiteSpace" />
<exclude name="Squiz.WhiteSpace" />
<exclude name="Squiz.Scope.MethodScope.Missing" />
<exclude name="WordPress.WP.EnqueuedResourceParameters.MissingVersion" />
<exclude name="WordPress.WP.GlobalVariablesOverride.Prohibited" />

<!-- Not interested in whitespace issues at the moment -->
<exclude name="PEAR.Functions.FunctionCallSignature" />
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma" />
<exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed" />
</rule>

<rule ref="WordPress-Extra" />

<!-- Not interested in whitespace issues in JS and CSS files at the moment -->
<!-- Not interested in whitespace issues in JS and CSS files at the moment -->
<rule ref="Squiz.WhiteSpace">
<exclude-pattern>*\.css</exclude-pattern>
<exclude-pattern>*\.js</exclude-pattern>
Expand All @@ -59,12 +52,15 @@
<exclude-pattern>*\.css</exclude-pattern>
<exclude-pattern>*\.js</exclude-pattern>
</rule>

<rule ref="Generic.Files.EndFileNewline">
<exclude-pattern>*\.css</exclude-pattern>
<exclude-pattern>*\.js</exclude-pattern>
</rule>

<rule ref="Generic.PHP.Syntax"/>

<rule ref="WordPress.WP.DeprecatedFunctions">
<properties>
<property name="minimum_supported_version" value="5.2" />
</properties>
</rule>
<rule ref="WordPress.WP.DeprecatedFunctions"/>

<rule ref="PHPCompatibilityWP"/>
</ruleset>
65 changes: 2 additions & 63 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
language: php
dist: focal

services:
- mysql

notifications:
email:
on_success: never
Expand All @@ -25,70 +22,12 @@ matrix:
- name: Coding Standards
php: 7.4
env: WP_VERSION=latest RUN_PHPCS=1
- name: Bleeding Edge
php: nightly
env: WP_VERSION=trunk
allow_failures:
- name: Bleeding Edge

before_install:
- phpenv config-rm xdebug.ini || true

# Use this to prepare the system to install prerequisites or dependencies.
# e.g. sudo apt-get update.
# Failures in this section will result in build status 'errored'.
# before_install:

# Use this to prepare your build for testing.
# e.g. copy database configurations, environment variables, etc.
# Failures in this section will result in build status 'errored'.
before_script:
# Set up WordPress installation.
- export WP_DEVELOP_DIR=/tmp/wordpress/
- mkdir -p $WP_DEVELOP_DIR
# Use the Git mirror of WordPress.
#- git clone --depth=1 --branch="$WP_VERSION" git://develop.git.wordpress.org/ $WP_DEVELOP_DIR
# Set up theme information.
- theme_slug=$(basename $(pwd))
#- theme_dir=$WP_DEVELOP_DIR/src/wp-content/themes/$theme_slug
- theme_dir=$WP_DEVELOP_DIR/$theme_slug
- cd ..
- mv $theme_slug $theme_dir
# Set up WordPress configuration.
- cd $WP_DEVELOP_DIR
- echo $WP_DEVELOP_DIR
#- cp wp-tests-config-sample.php wp-tests-config.php
#- sed -i "s/youremptytestdbnamehere/wordpress_test/" wp-tests-config.php
#- sed -i "s/yourusernamehere/root/" wp-tests-config.php
#- sed -i "s/yourpasswordhere//" wp-tests-config.php
# Create WordPress database.
#- mysql -e 'CREATE DATABASE wordpress_test;' -uroot
# Install CodeSniffer for WordPress Coding Standards checks.
- git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs
# Install WordPress Coding Standards.
- git clone -b master https://github.com/WordPress/WordPress-Coding-Standards.git wpcs

# Hop into CodeSniffer directory.
- cd phpcs
# Set install paths for Coding Standards.
- ./bin/phpcs --config-set installed_paths "/tmp/wordpress/wpcs"
# Hop into themes directory.
- cd $theme_dir
# After CodeSniffer install you should refresh your path.
- phpenv rehash

- composer install

# Run test script commands.
# Default is specific to project language.
# All commands must exit with code 0 on success. Anything else is considered failure.
script:
# WordPress Coding Standards
# @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
# @link http://pear.php.net/package/PHP_CodeSniffer/
# -p flag: Show progress of the run.
# -s flag: Show sniff codes in all reports.
# -v flag: Print verbose output.
# -n flag: Do not print warnings. (shortcut for --warning-severity=0)
# --standard: Use WordPress as the standard.
# --extensions: Only sniff PHP files.
- $WP_DEVELOP_DIR/phpcs/bin/phpcs --colors -p -s -v -n --standard=./.phpcs.xml
- ./vendor/bin/phpcs --colors -p -s -v -n --standard=.phpcs.xml .
14 changes: 7 additions & 7 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -645,14 +645,14 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

{project} Copyright (C) {year} {fullname}
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
25 changes: 25 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "lightspeeddevelopment/lsx-team",
"description": "The LSX Team Extension provides a custom post type that allows you to easily show off the people that make up your business.",
"type": "wordpress-plugin",
"require": {
"php": ">=7.2",
"composer/installers": "^1.7.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5",
"wp-coding-standards/wpcs": "^2.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"wpackagist-plugin/tour-operator": "^1.4.1",
"wpackagist-theme/lsx": "^2.8.0",
"phpcompatibility/phpcompatibility-wp": "^2.1.0",
"roave/security-advisories": "dev-master"
},
"repositories":[{
"type":"composer",
"url":"https://wpackagist.org"
}],
"license": "GPL-3.0-or-later",
"prefer-stable": true,
"minimum-stability": "dev"
}
Loading

0 comments on commit 52be375

Please sign in to comment.