Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions design-documents/testing/static/coding-standard-versioning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Magento Coding Standard Versioning

The purpose of this document is the defining versioning strategy for [Magento Coding Standard](https://github.com/magento/magento-coding-standard).

## Summary

Version number should be increased with taking [Semantic Versioning](https://semver.org/) into account.
Given a version number `{major}`.`{minor}`.`{patch}`, following rules MUST be applied:

- `{patch}` version MUST be incremented when backward compatible changes (bug fixes) were made.

- `{minor}` version MUST be incremented when backward compatible changes (new features) were added.

- `{major}` version MUST be incremented when backward incompatible changes were made.

### Terminology

**PHP CodeSniffer OOB rule** - rule that goes out-of-box with PHP CodeSniffer, the part of its package, the part of specific Coding Standard (PSR2, Squiz, etc).

**Magento rule** - Magento specific rule, tah part of Magento Coding Standard, located under [Magento2/Sniffs/](https://github.com/magento/magento-coding-standard/tree/develop/Magento2/Sniffs) directory.

### Versioning use cases

Following use cases are representing code change examples relatively to the version part that needs to be changed.

### `{patch}` Release
- Bug fix to existing rule that prevents false-positive findings.
- Removing PHP CodeSniffer OOB rule from Magento Coding Standard `ruleset.xml` file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to minor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved.

- Removing Magento rule from MagentoCoding Standard (sniff code + `ruleset.xml`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to major.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would "remove rule" be backward incompatible for Magento sniffs, but not for OOB sniffs? Both means, there will be less findings, which is technically backwards compatible

- Adding unit tests to existing rules.

### `{minor}` Release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this move to major.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved.

- Adding new OOB rule to Magento Coding Standard `ruleset.xml` file.
- Implementing new Magento rule and adding it to `ruleset.xml` file.
- Changing the behaviour of existing Magento rule (extending functionality).

### `{major}` Release
- Changing platform requirements.
- Namespace changes.