Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Latest commit

 

History

History
86 lines (46 loc) · 3.89 KB

CONTRIBUTING.md

File metadata and controls

86 lines (46 loc) · 3.89 KB

Contributing to Sticky Tax

Thank you for your interest in contributing the ongoing development of Sticky Tax!

Contributing code

The dependencies for the plugin are loaded via Composer and npm, so it's necessary to have both of those tools installed locally.

Begin by cloning the GitHub repo locally and installing the dependencies:

# Clone the repository, ideally into a wp-content/plugins directory:
$ git clone https://github.com/liquidweb/sticky-tax.git sticky-tax && cd sticky-tax

# Install local dependencies
$ composer install && npm install

The Sticky Tax plugin is built for PHP versions 5.3 and above (required for using PHP namespaces).

Project structure

The main plugin file, sticky-tax.php, consists of a series of include files, each living in its own namespace under the base LiquidWeb\StickyTax namespace. New functionality should be introduced following this same scheme.

Branching

Pull requests should be based off the develop branch, which represents the current development state of the plugin. The only thing ever merged into master should be new release branches, at the time a release is tagged.

To create a new feature branch:

# Start on develop, making sure it's up-to-date
$ git checkout develop && git pull

# Create a new branch for your feature
$ git checkout -b feature/my-cool-new-feature

When submitting a new pull request, your feature/my-cool-new-feature should be compared against develop.

Coding standards

This project uses the WordPress-Extra and WordPress-Docs rulesets for PHP_CodeSniffer, as declared in phpcs.xml. PHP_CodeSniffer will be run automatically against any modified files on a pre-commit Git hook, thanks to WP Enforcer.

Localization

The Sticky Tax plugin aims to be 100% localization-ready, so any user-facing strings must use appropriate localization functions.

At any time, you may regenerate the plugin's languages/sticky-tax.pot file by running grunt i18n.

Running unit tests

Sticky Tax has a number of unit tests, using the WordPress Core Testing Framework. As the WordPress core tests require a WordPress installation, you may consider developing for the plugin within VVV.

When submitting changes, please be sure to add or update unit tests accordingly. You may run unit tests at any time by running:

# From the root of the plugin directory
$ phpunit

To generate a report of code coverage for the current branch, you may run the following Composer script, which will generate an HTML report in tests/coverage/:

$ composer test-coverage

Note that both the Xdebug and tokenizer PHP extensions must be installed and active on the machine running the tests. If you're building in VVV, both are available, but Xdebug is disabled by default; you can activate it by SSH-ing into VVV and running xdebug_on.

Sample taxonomies

If you need custom taxonomies registered for testing purposes, you can copy tests/test-files/custom-taxonomies.php into your development environment's wp-content/mu-plugins directory. This will register two new taxonomies — one hierarchal and one non-hierarchal — for testing purposes.

Contributors

Sticky Tax was built and is maintained by Liquid Web.

See a list of all contributors to the plugin.