Skip to content

Config: bug fix - "reports" could get set incorrectly when in CBF mode #1077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2025

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented May 4, 2025

Description

There are three CLI arguments related to the reporting:

  • --report=[comma separated list]
  • --report-file=[path to file]
  • --report-<type>=[path to file]

The --report-file... option is ignored when in CBF mode. Whether that is the correct behaviour or not, is outside the scope of the current bug fix.

In the Config::processLongArgument() method, the --report-file option is handled before the --report-<type> option to ensure that --report-file is handled correctly, as the handling of the --report-<type> argument is based on seeing the prefix --report-, which overlaps with --report-file.

However, this logic was broken in CBF mode, as in that case, the --report-file CLI arg would still fall through to the --report-<type> handling, which would break the setting of the $reports.

Fixed now.

Includes tests specifically for this issue.

This is a logic bug only and had no impact on end-users, as the Runner::runPHPCBF() method includes a hard-coded overrule of the reportFile and report settings.

Suggested changelog entry

N/A

There are three CLI arguments related to the reporting:
* `--report=[comma separated list]`
* `--report-file=[path to file]`
* `--report-<type>=[path to file]`

The `--report-file...` option is ignored when in CBF mode. Whether that is the correct behaviour or not, is outside the scope of the current bug fix.

In the `Config::processLongArgument()` method, the `--report-file` option is handled _before_ the `--report-<type>` option to ensure that `--report-file` is handled correctly, as the handling of the `--report-<type>` argument is based on seeing the prefix `--report-`, which overlaps with `--report-file`.

However, this logic was broken in CBF mode, as in that case, the `--report-file` CLI arg would still fall through to the `--report-<type>` handling, which would break the setting of the `$reports`.

Fixed now.

Includes tests specifically for this issue.
@jrfnl jrfnl added this to the 3.13.0 milestone May 4, 2025
@jrfnl jrfnl merged commit 33cd903 into master May 6, 2025
78 checks passed
@jrfnl jrfnl deleted the feature/config-bug-report-file-vs-phpcbf branch May 6, 2025 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant