Skip to content

Discussion: Migration to a offline code checker or better not? #1092

Open
@christianlupus

Description

@christianlupus

In #1048 the discussion started, if it was somehow possible to check the code style offline. This would speed up the development process: in case of online checks, the potential error-prone code needs to be checked in, causing errors by StyleCI. Then a refactor cycle can be done and the corrected code (force-) pushed.
All in all not best from the perspective of potential contributors.

I tried out the PHP_CodeSniffer as suggested in the comments of the named PR. It reports a bunch of errors in the psr1 mode. The other modes report hundreds of issues. I think those in the psr1 mode can be solved quite simply.

However, I am unsure if this is sufficient to make StyleCI happy in the long run. A short test revealed, that some changes @dromer made to fix StyleCI need to be reversed again as phpcs's styles seem to enforce the contrary.
Example: Appending strings in PHP. StyleCI seems (from the commits) to require no blanks between period and text: 'Some Text'.$var. The styles psr2 and psr12 require 'Some Text' . $var.

I think it should be in general decided, how we want to proceed. An offline test simplifies working much. I have seen this during the development of e.g. #1088. Lots of commits mainly to make Travis and the GitHub actions happy as this is the only way to trigger builds/checks online. Inserting the phpcs checker in Travis should be straight forward. So we could do the following:

  1. Stick with StyleCI. This has the drawback that future development will always require push-modify-repush development cycles.
  2. Migrate to PHP style checker. This makes @dromer's work partly redundant as it needs refactored and the new checker installed in the test scripts.

I think it is true that we should stick with one tool here. Using multiple tools with contradicting requirements will cause a lot of headaches.

Therefore I put this here for discussion. I hope for a fluent and friendly discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    metafor issues not related to the code itself but the repo, the wiki, the programming standards, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions