phpro / grumphp

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

PhpMd cannot exclude directories #921

Closed nntoan closed 1 year ago

nntoan commented 3 years ago
Q A
Version GrumPHP 1.3.2
Bug? yes
New feature? no
Question? no
Documentation? yes
Related tickets comma-separated list of related tickets

My configuration

# grumphp.yml
# Please add a copy of your grumphp.yml file.
grumphp:
  hide_circumvention_tip: true
  process_timeout: 300
  stop_on_failure: false
  ignore_unstaged_changes: false
  tasks:
    phpmd:
      ruleset: ['./dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml']
      triggered_by: ['php']
      exclude:
        - "./app/code/Magento/"
        - "./app/code/*/*/Setup/"
        - "./legacy/*/*/src/*/*"
        - "./legacy/*/*/*"
      metadata:
        priority: 70
    #  uncomment to skip modules using whitelist patterns
      whitelist_patterns:
         - /^legacy\/.*/

Steps to reproduce:

# Generate empty folder
mkdir -p legacy/{vendor-a,vendor-b}
mkdir -p legacy/vendor-a/src/module-a
mkdir -p legacy/vendor-b/module-a
composer require --dev phpro/grumphp

# Your actions
# Please add the steps on how to reproduce the issue here.

# Run GrumPHP:
./vendor/bin/grumphp run

Result:

# Please add the result of the run or git commit actions here.
GrumPHP still pickup PHP files inside legacy dir
veewee commented 3 years ago

It is most likely related to the mix of adding the files to the CLI command and specifying exclude patterns. Can you check how this works in phpmd?

veewee commented 1 year ago

Closing this one because of inactivity If the issue still persists - feel free to reopen and provide some additional context.