Skip to content

Commit b10cd56

Browse files
committed
Merge commit '53b33966d7d3fba607ebeaadd76cfd9d9ac3a954'
Conflicts: bin/.jshintrc bin/.travis.yml bin/readme.md
2 parents 67085f1 + 53b3396 commit b10cd56

7 files changed

Lines changed: 73 additions & 69 deletions

File tree

bin/.jshintrc

Lines changed: 19 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,20 @@
1-
// --------------------------------------------------------------------
2-
// WordPress JSHint Configuration
3-
// --------------------------------------------------------------------
41
{
5-
"bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
6-
"curly" : true, // Require {} for every new block or scope.
7-
"eqeqeq" : true, // Require triple equals i.e. `===`.
8-
"forin" : true, // Tolerate `for in` loops without `hasOwnPrototype`.
9-
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
10-
"latedef" : true, // Prohibit variable use before definition.
11-
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
12-
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
13-
"noempty" : true, // Prohibit use of empty blocks.
14-
"nonew" : true, // Prohibit use of constructors for side-effects.
15-
"plusplus" : false, // Prohibit use of `++` & `--`.
16-
"regexp" : false, // Prohibit `.` and `[^...]` in regular expressions.
17-
"undef" : true, // Require all non-global variables be declared before they are used.
18-
"strict" : true, // Require `use strict` pragma in every file.
19-
"trailing" : true, // Prohibit trailing whitespaces.
20-
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
21-
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
22-
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
23-
"eqnull" : false, // Tolerate use of `== null`.
24-
"es5" : false, // Allow EcmaScript 5 syntax.
25-
"esnext" : false, // Allow ES.next specific features such as `const` and `let`.
26-
"evil" : false, // Tolerate use of `eval`.
27-
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
28-
"funcscope" : false, // Tolerate declarations of variables inside of control structures while accessing them later from the outside.
29-
"globalstrict" : false, // Allow global "use strict" (also enables 'strict').
30-
"iterator" : false, // Allow usage of __iterator__ property.
31-
"lastsemic" : false, // Tolerate missing semicolons when it is omitted for the last statement in a one-line block.
32-
"laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
33-
"laxcomma" : false, // Suppress warnings about comma-first coding style.
34-
"loopfunc" : false, // Allow functions to be defined within loops.
35-
"multistr" : false, // Tolerate multi-line strings.
36-
"onecase" : false, // Tolerate switches with just one case.
37-
"proto" : false, // Tolerate __proto__ property. This property is deprecated.
38-
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
39-
"scripturl" : false, // Tolerate script-targeted URLs.
40-
"smarttabs" : false, // Tolerate mixed tabs and spaces when the latter are used for alignmnent only.
41-
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
42-
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
43-
"supernew" : true, // Tolerate `new function () { ... };` and `new Object;`.
44-
"validthis" : false, // Tolerate strict violations when the code is running in strict mode and you use this in a non-constructor function.
45-
"browser" : true, // Standard browser globals e.g. `window`, `document`.
46-
"couch" : false, // Enable globals exposed by CouchDB.
47-
"devel" : false, // Allow development statements e.g. `console.log();`.
48-
"dojo" : false, // Enable globals exposed by Dojo Toolkit.
49-
"jquery" : true, // Enable globals exposed by jQuery JavaScript library.
50-
"mootools" : false, // Enable globals exposed by MooTools JavaScript framework.
51-
"node" : false, // Enable globals available when code is running inside of the NodeJS runtime environment.
52-
"nonstandard" : false, // Define non-standard but widely adopted globals such as escape and unescape.
53-
"prototypejs" : false, // Enable globals exposed by Prototype JavaScript framework.
54-
"rhino" : false, // Enable globals available when your code is running inside of the Rhino runtime environment.
55-
"wsh" : false, // Enable globals available when your code is running as a script for the Windows Script Host.
56-
"nomen" : false, // Prohibit use of initial or trailing underbars in names.
57-
"onevar" : false, // Allow only one `var` statement per function.
58-
"passfail" : false, // Stop on first error.
59-
"white" : false, // Check against strict whitespace and indentation rules.
60-
"maxerr" : 100, // Maximum errors before stopping.
61-
"predef" : [], // Extra globals.
62-
"indent" : 4 // Specify indentation spacing
63-
}
2+
"boss": true,
3+
"curly": true,
4+
"eqeqeq": true,
5+
"eqnull": true,
6+
"expr": true,
7+
"immed": true,
8+
"noarg": true,
9+
"quotmark": "single",
10+
"trailing": true,
11+
"undef": true,
12+
"unused": true,
13+
14+
"browser": true,
15+
16+
"globals": {
17+
"jQuery": false,
18+
"wp": false
19+
}
20+
}

bin/.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ node_js:
1212
env:
1313
- WP_VERSION=master WP_MULTISITE=0
1414
- WP_VERSION=master WP_MULTISITE=1
15-
- WP_VERSION=3.7 WP_MULTISITE=0
16-
- WP_VERSION=3.7 WP_MULTISITE=1
15+
- WP_VERSION=latest WP_MULTISITE=0
16+
- WP_VERSION=latest WP_MULTISITE=1
1717

1818
before_script:
1919
- export WP_TESTS_DIR=/tmp/wordpress-tests/

bin/class-wordpress-readme-parser.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,20 @@ function __construct( $args = array() ) {
8383
*/
8484
function to_markdown( $params = array() ) {
8585

86+
$general_section_formatter = function ( $body ) use ( $params ) {
87+
$body = preg_replace(
88+
'#\[youtube\s+(?:http://www\.youtube\.com/watch\?v=|http://youtu\.be/)(.+?)\]#',
89+
'[![Play video on YouTube](http://i1.ytimg.com/vi/$1/hqdefault.jpg)](http://www.youtube.com/watch?v=$1)',
90+
$body
91+
);
92+
return $body;
93+
};
94+
8695
// Parse sections
8796
$section_formatters = array(
8897
'Description' => function ( $body ) use ( $params ) {
8998
if ( isset( $params['travis_ci_url'] ) ) {
90-
$body .= sprintf( "\n\n[![Build Status](%s.png)](%s)", $params['travis_ci_url'], $params['travis_ci_url'] );
99+
$body .= sprintf( "\n\n[![Build Status](%s.png?branch=master)](%s)", $params['travis_ci_url'], $params['travis_ci_url'] );
91100
}
92101
return $body;
93102
},
@@ -170,9 +179,12 @@ function ( $tag ) {
170179
$markdown .= "\n";
171180

172181
$body = $section['body'];
182+
183+
$body = call_user_func( $general_section_formatter, $body );
173184
if ( isset( $section_formatters[$section['heading']] ) ) {
174185
$body = trim( call_user_func( $section_formatters[$section['heading']], $body ) );
175186
}
187+
176188
if ( $body ) {
177189
$markdown .= sprintf( "%s\n", $body );
178190
}

bin/install-wp-tests.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ set -ex
1616
# set up a WP install
1717
WP_CORE_DIR=/tmp/wordpress/
1818
mkdir -p $WP_CORE_DIR
19-
wget -nv -O /tmp/wordpress.tar.gz https://github.com/WordPress/WordPress/tarball/$WP_VERSION
19+
20+
if [ $WP_VERSION == 'latest' ]; then
21+
ARCHIVE_URL='http://wordpress.org/latest.tar.gz'
22+
else
23+
ARCHIVE_URL="https://github.com/WordPress/WordPress/tarball/$WP_VERSION"
24+
fi
25+
26+
wget -nv -O /tmp/wordpress.tar.gz $ARCHIVE_URL
2027
tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
2128

2229
# set up testing suite

bin/phpcs.ruleset.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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">
6+
<exclude name="WordPress.VIP.RestrictedFunctions"/>
7+
<exclude name="WordPress.VIP.SuperGlobalInputUsage"/>
8+
<exclude name="WordPress.VIP.ValidatedSanitizedInput"/>
9+
</rule>
10+
<rule ref="WordPress.NamingConventions.ValidFunctionName">
11+
<exclude-pattern>/tests/*</exclude-pattern><!-- because of PHPUnit method names -->
12+
</rule>
13+
14+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
15+
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
16+
<rule ref="Generic.Files.ByteOrderMark"/>
17+
<rule ref="Generic.PHP.LowerCaseConstant"/>
18+
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
19+
<rule ref="Generic.PHP.NoSilencedErrors" />
20+
<rule ref="Generic.ControlStructures.InlineControlStructure" />
21+
<rule ref="Generic.Files.LineEndings">
22+
<properties>
23+
<property name="eolChar" value="\n"/>
24+
</properties>
25+
</rule>
26+
27+
</ruleset>

bin/readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ git subtree push --prefix bin \
2626
git@github.com:x-team/wp-plugin-dev-lib.git master
2727
```
2828

29-
Symlink to the `.travis.yml` and `.jshintrc` inside of the `bin/` directory you added:
29+
Symlink to the `.travis.yml`, `.jshintrc`, and `phpcs.ruleset.xml` inside of the `bin/` directory you added:
3030

3131
```bash
3232
ln -s bin/.travis.yml . && git add .travis.yml
3333
ln -s bin/.jshintrc . && git add .jshintrc
34+
ln -s bin/phpcs.ruleset.xml . && git add phpcs.ruleset.xml
3435
```
3536

3637
Symlink to `pre-commit` from your project's `.git/hooks/pre-commit`:

bin/svn-push

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# Given a svn-url file one directory up, export the latest git commits to the specified SVN repo.
3-
# Create a git release tag from the verison specified in the plugin file.
3+
# Create a git release tag from the version specified in the plugin file.
44
# Author: Weston Ruter (@westonruter)
55

66
set -e
@@ -154,4 +154,4 @@ rm $svn_commit_file
154154
# Restore branch
155155
if [ $current_branch != 'master' ]; then
156156
git checkout $current_branch
157-
fi
157+
fi

0 commit comments

Comments
 (0)