From 4d46e54074571bff0712cf4746e14e35792049e2 Mon Sep 17 00:00:00 2001
From: Grzegorz Rola <grola@seostudio.pl>
Date: Tue, 14 Apr 2020 17:59:14 +0200
Subject: [PATCH] Init

---
 .editorconfig           | 22 ++++++++++++++++++++++
 .gitattributes          | 12 ++++++++++++
 .gitignore              |  3 +++
 .gitlab-ci.yml          |  7 +++++++
 CHANGELOG.md            |  3 +++
 LICENSE.md              | 21 +++++++++++++++++++++
 README.md               | 14 +++++++++++++-
 apigen.neon             | 27 +++++++++++++++++++++++++++
 composer.json           | 36 ++++++++++++++++++++++++++++++++++++
 phpcs.xml.dist          | 28 ++++++++++++++++++++++++++++
 phpunit-integration.xml | 34 ++++++++++++++++++++++++++++++++++
 phpunit-unit.xml        | 21 +++++++++++++++++++++
 12 files changed, 227 insertions(+), 1 deletion(-)
 create mode 100644 .editorconfig
 create mode 100644 .gitattributes
 create mode 100644 .gitignore
 create mode 100644 .gitlab-ci.yml
 create mode 100644 CHANGELOG.md
 create mode 100644 LICENSE.md
 create mode 100644 apigen.neon
 create mode 100644 composer.json
 create mode 100644 phpcs.xml.dist
 create mode 100644 phpunit-integration.xml
 create mode 100644 phpunit-unit.xml

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..c394f50
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,22 @@
+# This file is for unifying the coding style for different editors and IDEs
+# editorconfig.org
+
+# WordPress Coding Standards
+# https://make.wordpress.org/core/handbook/coding-standards/
+
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.yml]
+indent_style = space
+indent_size = 2
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..6b71fc7
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,12 @@
+.git/ export-ignore
+tests/ export-ignore
+vendor/ export-ignore
+.editorconfig export-ignore
+.gitattributes export-ignore
+.gitignore export-ignore
+.gitlab-ci.yml export-ignore
+.idea export-ignore
+apigen.neon export-ignore
+phpcs.xml.dist export-ignore
+phpunit-integration.xml export-ignore
+phpunit-unit.xml export-ignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..30babff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/vendor/
+.idea
+composer.lock
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..1b1c48b
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,7 @@
+variables:
+  DISABLE_PHP_5_5: 1
+  DISABLE_INTEGRATION_TESTS: 1
+  DISABLE_CODECEPTION: 1
+  IS_LIBRARY: 1
+
+include: 'https://gitlab.com/wpdesk/gitlab-ci/raw/master/gitlab-ci-1.2.yml'
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..1758120
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,3 @@
+[1.0.0] - 2019-05-30
+# Added
+* First version
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..ffa89b5
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 WP Desk
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index 0fbd555..3eb6c9d 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,14 @@
-# wp-code-sniffer
+[![pipeline status](https://gitlab.com/wpdesk/wp-code-sniffer/badges/master/pipeline.svg)](https://gitlab.com/wpdesk/wp-code-sniffer/pipelines) 
+[![coverage report](https://gitlab.com/wpdesk/wp-code-sniffer/badges/master/coverage.svg?job=integration+test+lastest+coverage)](https://gitlab.com/wpdesk/wp-code-sniffer/commits/master) 
+[![Latest Stable Version](https://poser.pugx.org/wpdesk/wp-code-sniffer/v/stable)](https://packagist.org/packages/wpdesk/wp-code-sniffer) 
+[![Total Downloads](https://poser.pugx.org/wpdesk/wp-code-sniffer/downloads)](https://packagist.org/packages/wpdesk/wp-code-sniffer) 
+[![Latest Unstable Version](https://poser.pugx.org/wpdesk/wp-code-sniffer/v/unstable)](https://packagist.org/packages/wpdesk/wp-code-sniffer) 
+[![License](https://poser.pugx.org/wpdesk/wp-code-sniffer/license)](https://packagist.org/packages/wpdesk/wp-code-sniffer) 
 
+
+Library for Wp Desk Coding Standards in plugins.
+===============================================
+
+# Installation
+
+`composer require --dev wpdesk/wp-code-sniffer`
diff --git a/apigen.neon b/apigen.neon
new file mode 100644
index 0000000..1aec8cf
--- /dev/null
+++ b/apigen.neon
@@ -0,0 +1,27 @@
+destination: docs
+templateConfig: /app/theme-woocommerce/config.neon
+extensions: [php]
+source:
+    - src
+exclude:
+    - vendor
+    - tests
+    - languages
+
+charset: [UTF-8]
+main: Wordpress plugin
+title: Plugin template more info
+baseUrl: "/"
+
+templateTheme: default
+php: false
+sourceCode: false
+tree: true
+deprecated: false
+todo: false
+download: false
+
+accessLevels:       
+    - public
+    - private
+    - protected
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..5ab7fa2
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,36 @@
+{
+    "name": "wpdesk/wp-code-sniffer",
+    "description": "Library for WP Desk Coding standards in plugins.",
+    "license": "MIT",
+    "keywords": ["wordpress", "code sniffer", "admin"],
+    "homepage": "https://gitlab.com/wpdesk/wp-code-sniffer",
+    "type": "library",
+    "minimum-stability": "stable",
+    "authors": [
+        {
+            "name": "grola",
+            "email": "grola@wpdesk.net"
+        }
+    ],
+    "require": {
+        "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2",
+        "phpcompatibility/php-compatibility": "^9.3",
+        "squizlabs/php_codesniffer": "^3.5",
+        "wp-coding-standards/wpcs": "^2.2"
+    },
+    "require-dev": {
+        "phpunit/phpunit": "<7",
+        "mockery/mockery": "*",
+        "10up/wp_mock": "*"
+    },
+    "autoload": {
+    },
+    "autoload-dev": {
+    },
+    "scripts": {
+        "phpcs": "phpcs"
+    },
+    "extra": {
+        "class": "WPDesk\\Composer\\Codeception\\Plugin"
+    }
+}
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
new file mode 100644
index 0000000..0f63900
--- /dev/null
+++ b/phpcs.xml.dist
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<ruleset name="WordPress Coding Standards for WP Desk Plugin">
+	<description>Sniffs for WordPress WPDesk plugins</description>
+
+	<config name="testVersion" value="5.6-"/>
+
+	<arg name="extensions" value="php"/>
+
+	<rule ref="PHPCompatibility"/>
+	<rule ref="WordPress"/>
+
+	<!-- Remove checking if classes are in class- files -->
+	<rule ref="WordPress.Files.FileName">
+		<exclude-pattern>/class/.*\.php</exclude-pattern>
+	</rule>
+
+	<rule ref="WordPress.Files.FileName.InvalidClassFileName">
+    	<exclude-pattern>/class/.*\.php</exclude-pattern>
+    </rule>
+
+	<rule ref="WordPress.NamingConventions.ValidVariableName">
+    	<exclude-pattern>/class/.*\.php</exclude-pattern>
+    </rule>
+
+    <rule ref="Generic.Commenting.DocComment.MissingShort">
+        <exclude-pattern>\.php</exclude-pattern>
+    </rule>
+</ruleset>
diff --git a/phpunit-integration.xml b/phpunit-integration.xml
new file mode 100644
index 0000000..634b884
--- /dev/null
+++ b/phpunit-integration.xml
@@ -0,0 +1,34 @@
+<phpunit bootstrap="tests/integration/bootstrap.php"
+         backupGlobals="false"
+>
+    <testsuites>
+        <testsuite>
+            <directory prefix="Test" suffix=".php">./tests/integration</directory>
+        </testsuite>
+    </testsuites>
+
+    <filter>
+        <whitelist>
+            <directory suffix=".php">src</directory>
+            <exclude>
+                <file>src/init.php</file>
+                <directory>src/assets</directory>
+                <directory suffix=".php">tests</directory>
+                <directory suffix=".php">vendor</directory>
+            </exclude>
+        </whitelist>
+    </filter>
+
+    <logging>
+        <log type="junit" target="build-coverage/report.junit.xml"/>
+        <log type="coverage-html" target="build-coverage/coverage" charset="UTF-8" yui="true" highlight="true"/>
+        <log type="coverage-text" target="build-coverage/coverage.txt"/>
+        <log type="coverage-clover" target="build-coverage/clover.xml"/>
+    </logging>
+
+    <php>
+        <env name="WP_DEVELOP_DIR" value="/tmp/wordpress-develop"/>
+        <env name="WC_DEVELOP_DIR" value="/tmp/woocommerce"/>
+    </php>
+
+</phpunit>
diff --git a/phpunit-unit.xml b/phpunit-unit.xml
new file mode 100644
index 0000000..06391cd
--- /dev/null
+++ b/phpunit-unit.xml
@@ -0,0 +1,21 @@
+<phpunit bootstrap="tests/unit/bootstrap.php">
+    <testsuites>
+        <testsuite>
+            <directory prefix="test-" suffix=".php">./tests/unit/</directory>
+        </testsuite>
+    </testsuites>
+
+    <filter>
+        <whitelist>
+            <directory suffix=".php">src</directory>
+        </whitelist>
+    </filter>
+
+    <logging>
+        <log type="junit" target="build-coverage/report.junit.xml"/>
+        <log type="coverage-html" target="build-coverage/coverage" charset="UTF-8" yui="true" highlight="true"/>
+        <log type="coverage-text" target="build-coverage/coverage.txt"/>
+        <log type="coverage-clover" target="build-coverage/clover.xml"/>
+    </logging>
+
+</phpunit>
-- 
GitLab