Skip to content

Publish XSD file(s) on stable URL #1094

Closed
@jrfnl

Description

@jrfnl

As per PHPCS 4.0, the master branch in the PHP_CodeSniffer repo will be removed - also see: #3

A lot of PHPCS rulesets reference the phpcs.xsd file though and the URL they use for that will start breaking once the master branch has been removed.

This will still work:

<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MyStandard" xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">

This will now reference a non-existing URL (though won't necessarily break anything unless an automated XML checker is used which uses the XSD reference):

<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MyStandard" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">

Now, people could, of course, start updating these references to link to the 4.x branch instead, but that means they will have to keep updating for every new major as future majors will have their own 5.x/6.x etc branch.

Proposed solution

  • Create a new repo for a GH Pages website for schema.phpcodesniffer.com
  • Publish the phpcs.xsd file via that web address
    I imagine a similar structure as PHPUnit is using can be used here:
    - root directory
      - `phpcs.xsd` (current version)
      - subdirectories for each minor with the `phpcs.xsd` file applicable for that minor.
    
    Note: the phpcs.xsd file hasn't changed much over time, but using a structure like the above would mean that users don't need to be aware of when the file changed, they can just reference the file for the minor they are using.
  • Create automation to update the schema website whenever a new PHPCS release is tagged.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions