Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supported versions #23

Open
fooman opened this issue May 7, 2018 · 7 comments
Open

Supported versions #23

fooman opened this issue May 7, 2018 · 7 comments
Assignees

Comments

@fooman
Copy link

fooman commented May 7, 2018

I think we need to have a discussion around supported versions of Magento (which in turn would inform what php language features to aim for).

My base assumption is that all active versions of Magento (currently 2.0/2.1/2.2) should be considered.

@larsroettig
Copy link
Contributor

Hi @fooman, the repository needs php7.1 but Magento 2.0.x and 2.1.x are not compatible with PHP 7.1.0.

@jissereitsma
Copy link
Contributor

jissereitsma commented May 14, 2018

Likewise, we need a discussion on which PHP Codesniffer version is used. Currently, the MEQP ruleset (at least MEQP1) requires PHPCS 2, ECG requires PHPCS 3. I would suggest to go for the obvious part: Support the latest available (3.x).

@schmengler
Copy link
Collaborator

As written in #31 (comment)

I would like this code sniffer to be oriented towards the future, not the past. If the need for a 2.1 compatibility branch (soon: 2.2 compatibility branch) arises, and people are willing to work on that, fine. But let's embrace the standards and possibilities of the latest version.

@fooman
Copy link
Author

fooman commented May 14, 2018

Nothing wrong in my view with taking a view towards the future and embracing what is possible. I however do think we do need to have at least 2.1 support as this is a supported version of Magento and as an extension dev I do not want to exclude them (it's also beyond my choice what version of Magento someone is on).

Also we will have these issues on an ongoing basis. For example declarative schema is coming in 2.3 - if we advocate for using it straight away we automatically suggest either dropping support for older versions or branching extension code - neither are great options in my view.

In summary I'd like us to formulate some approach so that we can tag certain rules as coming into effect on a certain Magento targeted version (or maybe it's easier to do this as a negative: this rule applies to all except 2.1 branch). Maybe it is in relation to the levels discussion? So if a rule is 2.2+ only while 2.1 is still around this becomes a suggestion rather than an error.

I am happy to help with this effort.

@jissereitsma
Copy link
Contributor

As an extension provider, I would love to see a ruleset that is compatible with older versions indeed. However, as a project-based developer (working for a SI), I would love to work with a Magento-version-specific ruleset. Different jobs, different needs. It would be good if we could support all these different needs.

One way to deal with this is git branching.

Another way to deal with this is by simply organizing the PHP classes of rules in a subfolder in this repo per Magento version. For instance, a rule on ViewModels could be added to a file Extdn/Magento-2.2/Sniffs/PreferViewModelsOverBlocks.php which is referred to in a ruleset Extdn/Magento-2.2/ruleset.xml and perhaps as well in the general ruleset Extdn/Magento-2/ruleset.xml. One would need to play with symlinks to set this up correctly with PHPCS, but this could be documented.

@schmengler
Copy link
Collaborator

schmengler commented May 15, 2018

@jissereitsma I think you are onto something there. Git branching can get tedious, organizing the rules within the repository makes more sense. But I don't think we need symlinks or even subdirectories.

Instead, we can create magento-2.x-ruleset.xml for older versions with exclude declarations. It's also possible to override default severities in the XML ruleset, so it is possible to introduce new rules as kind of optional for older versions.

@schmengler
Copy link
Collaborator

schmengler commented May 15, 2018

As discussed, I will create separate rulesets that may exclude rules from the default, latest one:

  • magento-2.0/ruleset.xml
  • magento-2.1/ruleset.xml
  • magento-2.2/ruleset.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants