Skip to content

Commit 2348691

Browse files
authored
Merge pull request #3 from Automattic/fix/coding-standards
2 parents 9613908 + 3ce7a88 commit 2348691

File tree

8 files changed

+372
-143
lines changed

8 files changed

+372
-143
lines changed

.distignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/.distignore
2+
/.editorconfig
3+
/.git
4+
/.gitignore
5+
/.github
6+
/.phpcs.xml.dist
7+
/composer.json
8+
/package.json
9+
/package-lock.json
10+
/phpunit.xml.dist
11+
/tests

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# It is based on https://core.trac.wordpress.org/browser/trunk/.editorconfig
3+
# See https://editorconfig.org for more information about the standard.
4+
5+
# WordPress Coding Standards
6+
# https://make.wordpress.org/core/handbook/coding-standards/
7+
8+
root = true
9+
10+
[*]
11+
charset = utf-8
12+
end_of_line = lf
13+
insert_final_newline = true
14+
trim_trailing_whitespace = true
15+
indent_style = tab
16+
17+
[*.yml]
18+
indent_style = space
19+
indent_size = 2
20+
21+
[*.md]
22+
trim_trailing_whitespace = false
23+
24+
[*.txt]
25+
end_of_line = crlf

.gitattributes

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Exclude these files from release archives.
2+
# This will also make them unavailable when using Composer with `--prefer-dist`.
3+
# If you develop for CAP using Composer, use `--prefer-source`.
4+
# https://blog.madewithlove.be/post/gitattributes/
5+
6+
/.github/ export-ignore
7+
/tests/ export-ignore
8+
/.distignore export-ignore
9+
/.editorconfig export-ignore
10+
/.gitattributes export-ignore
11+
/.gitignore export-ignore
12+
/.phpcs.xml.dist export-ignore
13+
/phpunit.xml.dist export-ignore
14+
/CHANGELOG.md export-ignore
15+
16+
# Auto detect text files and perform LF normalization
17+
# https://pablorsk.medium.com/be-a-git-ninja-the-gitattributes-file-e58c07c9e915
18+
19+
* text=auto
20+
21+
# The above will handle all files NOT found below
22+
23+
*.md text
24+
*.php text
25+
*.inc text

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/.phpunit.cache/
2+
/phpunit.xml
3+
/node_modules/
4+
/vendor/
5+
/.phpcs.xml
6+
/phpcs.xml
7+
/composer.lock

.phpcs.xml.dist

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="WordPress Coding Standards for Plugins">
3+
<description>Generally-applicable sniffs for WordPress plugins</description>
4+
5+
<rule ref="WordPress-VIP-Go" />
6+
7+
<!-- Rules: WordPress Coding Standards - see
8+
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
9+
<rule ref="WordPress-Extra"/> <!-- Includes WordPress-Core -->
10+
<rule ref="WordPress-Docs"/>
11+
<!-- For help in understanding this minimum_supported_wp_version:
12+
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#setting-minimum-supported-wp-version-for-all-sniffs-in-one-go-wpcs-0140 -->
13+
<config name="minimum_supported_wp_version" value="4.4.2"/>
14+
15+
<rule ref="WordPress.WP.I18n">
16+
<properties>
17+
<property name="text_domain" type="array">
18+
<element value="buddypress-vip-go"/>
19+
</property>
20+
</properties>
21+
</rule>
22+
23+
<rule ref="PHPCompatibilityWP"/>
24+
<config name="testVersion" value="8.1-"/>
25+
26+
<!-- How to scan -->
27+
<arg value="sp"/> <!-- Show sniff and progress -->
28+
<arg name="colors"/> <!-- Show results with colors. Disable if working on Windows -->
29+
<arg name="basepath" value="."/> <!-- Strip the file paths down to the relevant bit -->
30+
<arg name="parallel" value="8"/> <!-- Enables parallel processing when available for faster results -->
31+
<arg name="extensions" value="php"/> <!-- Limit to PHP files -->
32+
33+
<!-- Allow invoking just `phpcs` on command line without assuming STDIN for file input. -->
34+
<file>.</file>
35+
36+
<exclude-pattern>*/node_modules/*</exclude-pattern>
37+
<exclude-pattern>*/vendor/*</exclude-pattern>
38+
</ruleset>

buddypress-vip-go.php

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
<?php
22
/**
3-
* Plugin Name: BuddyPress for VIP Go
4-
* Plugin URI: https://github.com/humanmade/buddypress-vip-go
5-
* Description: Makes BuddyPress' media work with Automattic's VIP Go hosting.
6-
* Author: Human Made
7-
* Author URI: https://hmn.md/
8-
* License: GPLv2 or later.
9-
* Text Domain: buddypress-vip-go
10-
* Version: 1.0
3+
* BuddyPress VIP Go
4+
*
5+
* @package BuddyPress-VIP-Go
6+
* @author Human Made, WordPress VIP
7+
* @copyright 2016-onwards Shared and distributed between Paul Gibbs and contributors.
8+
* @license GPL-2.0-or-later
9+
*
10+
* @wordpress-plugin
11+
* Plugin Name: BuddyPress VIP Go
12+
* Description: Makes BuddyPress' media work with WordPress VIP's hosting.
13+
* Version: 1.0.0
14+
* Requires at least: 4.4.2
15+
* Requires PHP: 8.2
16+
* Author: Human Made, WordPress VIP
17+
* Text Domain: buddypress-vip-go
18+
* License: GPL v2 or later
19+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
1120
*/
1221

1322
// Exit if accessed directly.
1423
defined( 'ABSPATH' ) || exit;
1524

16-
add_action( 'bp_loaded', function() {
17-
if ( ! class_exists( 'A8C_Files' ) || ! defined( 'FILES_CLIENT_SITE_ID' ) || !defined( 'FILES_ACCESS_TOKEN' ) ) {
18-
return;
19-
}
25+
add_action(
26+
'bp_loaded',
27+
function () {
28+
if ( ! class_exists( 'A8C_Files' ) || ! defined( 'FILES_CLIENT_SITE_ID' ) || ! defined( 'FILES_ACCESS_TOKEN' ) ) {
29+
return;
30+
}
2031

21-
require_once __DIR__ . '/files.php';
22-
} );
32+
require_once __DIR__ . '/files.php';
33+
}
34+
);

composer.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "automattic/buddypress-vip-go",
3+
"description": "Makes BuddyPress' media work with WordPress VIP's hosting.",
4+
"type": "wordpress-plugin",
5+
"license": "GPL-2.0-or-later",
6+
"authors": [
7+
{
8+
"name": "Human Made",
9+
"homepage": "https://humanmade.com/"
10+
},
11+
{
12+
"name": "Automattic",
13+
"homepage": "https://automattic.com/"
14+
}
15+
],
16+
"support": {
17+
"issues": "https://github.com/Automattic/BuddyPress-VIP-Go/issues",
18+
"source": "https://github.com/Automattic/BuddyPress-VIP-Go"
19+
},
20+
"require": {
21+
"composer/installers": "^2",
22+
"php": ">=8.2"
23+
},
24+
"require-dev": {
25+
"automattic/vipwpcs": "^3",
26+
"php-parallel-lint/php-parallel-lint": "^1.0",
27+
"phpcompatibility/phpcompatibility-wp": "^2.1",
28+
"wp-coding-standards/wpcs": "^3.1"
29+
},
30+
"scripts": {
31+
"coverage": [
32+
"@putenv WP_MULTISITE=1",
33+
"@php ./vendor/bin/phpunit --exclude=ms-excluded --coverage-html ./.phpunit.cache/coverage-html"
34+
],
35+
"coverage-ci": [
36+
"@putenv WP_MULTISITE=1",
37+
"@php ./vendor/bin/phpunit --exclude=ms-excluded"
38+
],
39+
"cs": [
40+
"@php ./vendor/bin/phpcs"
41+
],
42+
"cbf": [
43+
"@php ./vendor/bin/phpcbf"
44+
],
45+
"lint": [
46+
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --exclude vendor --exclude .git"
47+
],
48+
"lint-ci": [
49+
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --exclude vendor --exclude .git --checkstyle"
50+
]
51+
},
52+
"config": {
53+
"allow-plugins": {
54+
"composer/installers": true,
55+
"dealerdirect/phpcodesniffer-composer-installer": true
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)