phpro / grumphp

A PHP code-quality tool
MIT License
4.11k stars 429 forks source link

Support grumphp.dist.yml #1069

Closed jreklund closed 1 year ago

jreklund commented 1 year ago
Q A
Version 1.15.0
Bug? no
New feature? yes
Question? yes
Documentation? yes
Related tickets

Before I start coding a solution to add support for grumphp.dist.yml - is this something you want to support? Currently I'm in the works of changing all configurations to end with the actual file extension e.g. yml to simplify our .editorconfig and to get syntax highlight (without modifications).

Currently we need to add both yml and yml.dist as an supported file extension. It works, but without any syntax highligt.

# YAML
[*.{yml,yml.dist}]
indent_size = 2

grumphp.yml

grumphp:
  ascii: ~
  environment:
    paths:
      - node_modules/.bin
  tasks:
    phpcsfixer:
    phpstan:
      memory_limit: "-1"
    stylelint:
      triggered_by: [scss]
    eslint:
  fixer:
      fix_by_default: true

grumphp.yml.dist

grumphp:
  ascii: ~
  environment:
    paths:
      - node_modules/.bin
  tasks:
    phpcsfixer:
    phpstan:
      memory_limit: "-1"
    stylelint:
      triggered_by: [scss]
    eslint:
  fixer:
      fix_by_default: true

I can see your projects grumphp.yml.dist uses 2 spaces for indention but according to your .editorconfig you let the users editor decide the number of spaces. My editor will break yours as it defaults to 4 spaces. You also would need two file-extensions in your .editorconfig (or default into 2 spaces).


Some examples in the documentation uses 2 spaces but most are using 4 spaces. I think that needs to be standardized. Is this something you want help with?

veewee commented 1 year ago

Thanks for reporting. We currently didn't keep that specific issue in mind - but I don't mind having it normalized. Feel free to provide a PR for that!

On top of the regular yml and yml.dist, We also allow .yaml and .yaml.dist.

It might even be better if we added a task that checks the code with the editor config as well. That way we can either adjust the code or the editor config accordingly.

jreklund commented 1 year ago

I took a quick look at an editorconfig-checker and it may fail on some markdown files. Currently there are yaml, json and php tags in the documentation and they have a different indentation style. There are also some paragraphs getting indented with 4 or more spaces.