Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-732

CodeSniffer coding standard for Observium

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Incomplete
    • Major
    • None
    • None
    • None
    • r5081

    Description

      I'm attaching a patch to drop a PHP CodeSniffer coding standard into a contrib/phpcs/Observium/ directory. The only part of the path that matters is the Observium directory name. I think CodeSniffer uses it for a namespace when searching for Sniffs.

      The standard was developed on CentOS 6 with the default PHP-CodeSniffer 1.4.5). It relies heavily on existing checks from the CodeSniffer distribution, but Ubuntu and other distros should have everything included.

      To use the standard, do something like this:
      `phpcs --standard=contrib/phpcs/Observium/ path/to/my.php`
      `phpcs --standard=contrib/phpcs/Observium/ dir/path/`

      There are two Observium error rules that I don't have implemented. They are noted at the top of ruleset.xml as a TODO comment. They have to do with blank lines after global statements and before a return statement.

      I didn't write any Docs or Tests for the standard. See the ruleset and sniffs for documentation. Tests can come later if we find bugs in the sniffs.

      And if you want to get crazy later, you can tie it into svn with a pre-commit hook.

      Attachments

        1. phpcs-control2.patch
          2 kB
          Cameron Moore
        2. phpcs-list.patch
          6 kB
          Cameron Moore
        3. phpcs-r5081.patch
          38 kB
          Cameron Moore
        4. syslog.php
          2 kB
          Mike Stupalov

        Activity

          People

            sid3windr Tom Laermans
            moorereason Cameron Moore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: