Skip to content
Merged
Changes from 3 commits
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
61 changes: 61 additions & 0 deletions design-documents/testing/static/coding-standard-versioning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 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, the 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.
- Implementing unit tests for existing rules.
- Adding new `exclude-pattern` or `include-pattern` to the rule.

Choose a reason for hiding this comment

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

include-pattern would be a breaking change, wouldn't it?


### `{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.

- Removing PHP CodeSniffer OOB rule from Magento Coding Standard `ruleset.xml` file.

### `{major}` Release
- Removing Magento rule from Magento Coding Standard (sniff code + `ruleset.xml`).
- 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).
- Changing the `severity` and the `type` of the rule.

Choose a reason for hiding this comment

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

Consider to distinguish between more or less strict rules. Increasing severity or changing a sniff type from "warning" to "error" is definitely backwards incompatible. The other way around, not (similar to removing a rule)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! That's a really good point.

Copy link
Contributor

Choose a reason for hiding this comment

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

@schmengler

Increasing severity or changing a sniff type from "warning" to "error" is definitely backwards incompatible

Actually, not. Any rule addition or change which does not require a backward-incompatible code change to satisfy it is backward-compatible.

- Changing platform requirements.
- Changing namespace.

## Release Line
Only one release line will be supported based on incremental approach depending on introduced changes.
General overview scheme:

```
1.0.0
|
1.0.1
|
1.0.2
|
|__1.1.0
|
|__2.0.0
|
|__2.0.1
```

No `{patch}` and `{minor}` releases will be made to the previous `{major}` (1.0.0) version if the new `{major}` (2.0.0) version already exists.