Skip to content

Gate blocks a staged file that phpstan.neon excludes ("No files found to analyse") #305

Description

@piwi3910

What happens

When the only staged PHP file is listed under parameters.excludePaths.analyse in the project's phpstan.neon, the commit gate runs phpstan on that file alone. phpstan answers [ERROR] No files found to analyse. and the gate reports a blocking finding:

BLOCKING …/clients/php/src/Types.php NOT checked — phpstan failed: [ERROR] No files found to analyse. (lint)

The file is excluded deliberately. It is generated code (azrtydxb/novamem clients/php/src/Types.php, written by go run ./clients/gen) with 244 level-6 findings by design, reviewed through its template instead. So every commit that regenerates it is blocked, unless it happens to stage a hand-written PHP file alongside it.

Repro (procoder 3.7.0)

  1. phpstan.neon with paths: [src] and excludePaths: { analyse: [src/Types.php] }.
  2. Modify and stage only src/Types.php.
  3. Run procoder check or the PreToolUse hook on git commit. It blocks.

Expected

A file the project's phpstan config excludes should be skipped, the same as a .prettierignored file is for formatting. Equivalently, phpstan's "No files found to analyse" for paths that are all excluded should mean nothing to check, not a failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions