Skip to content

Add --verbose to checksecuritytxt.php#95

Merged
spaze merged 2 commits intomainfrom
spaze/verbose
Apr 15, 2026
Merged

Add --verbose to checksecuritytxt.php#95
spaze merged 2 commits intomainfrom
spaze/verbose

Conversation

@spaze
Copy link
Copy Markdown
Owner

@spaze spaze commented Apr 15, 2026

If specified, the following messages will be printed:

  • "Loading security.txt from ..."
  • "Redirected from ... to ..."
  • "Not found ..."

They were always printed until now.

@spaze spaze self-assigned this Apr 15, 2026
Copilot AI review requested due to automatic review settings April 15, 2026 00:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a --verbose flag to the checksecuritytxt.php CLI so that previously-always-printed informational messages (loading URLs, redirects, not-found attempts) are now only emitted when requested, while keeping the rest of the CLI output unchanged.

Changes:

  • Add --verbose CLI option and update usage/help text.
  • Add a $verbose parameter to SecurityTxtCheckHostCli::check() and conditionally print URL/redirect/not-found info.
  • Update and extend CLI tests to cover non-verbose output.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/Check/SecurityTxtCheckHostCliTest.phpt Updates existing calls for the new parameter and adds a non-verbose expectation test.
src/Check/SecurityTxtCheckHostCli.php Adds $verbose param and wraps URL/redirect/not-found info hooks behind it.
bin/checksecuritytxt.php Parses --verbose and documents it in usage output.
Comments suppressed due to low confidence (1)

src/Check/SecurityTxtCheckHostCli.php:34

  • SecurityTxtCheckHostCli::check() added a new required $verbose parameter in the middle of the public method signature. This is a backwards-incompatible change for any external callers using positional arguments (their old $strictMode value will now be interpreted as $verbose). Consider preserving BC by keeping the old parameter order and adding a new optional parameter at the end (or introducing an options object/DTO), then update the CLI script/tests accordingly.
	public function check(
		?Url $url,
		?int $expiresWarningThreshold,
		bool $colors,
		bool $verbose,
		bool $strictMode,
		bool $requireTopLevelLocation,
		bool $noIpv6,
		bool $showUsageHelp,
		string $usageHelp,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Check/SecurityTxtCheckHostCli.php Outdated
Comment thread tests/Check/SecurityTxtCheckHostCliTest.phpt
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a --verbose flag to the bin/checksecuritytxt.php CLI so that “Loading security.txt from …”, “Redirected from … to …”, and “Not found …” messages are only printed when explicitly requested, while keeping the rest of the CLI output intact.

Changes:

  • Add a new $verbose parameter to SecurityTxtCheckHostCli::check() and gate URL/redirect/not-found callbacks behind it.
  • Add --verbose flag handling and update CLI usage/help text in bin/checksecuritytxt.php.
  • Update and extend CLI .phpt tests to cover verbose vs non-verbose output.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Check/SecurityTxtCheckHostCli.php Introduces $verbose and conditionally registers fetch/redirect/not-found output callbacks.
bin/checksecuritytxt.php Parses --verbose argument and updates usage/help text accordingly.
tests/Check/SecurityTxtCheckHostCliTest.phpt Updates existing tests for the new parameter and adds a non-verbose test case.
Comments suppressed due to low confidence (1)

src/Check/SecurityTxtCheckHostCli.php:35

  • SecurityTxtCheckHostCli::check() gained a new required $verbose parameter inserted in the middle of the argument list. This is a backwards-incompatible public API change (existing positional calls will now fatal due to missing argument). To preserve BC, consider adding $verbose as an optional parameter at the end (defaulting to false), or introducing an options object/array while keeping the old signature available.
	public function check(
		?Url $url,
		?int $expiresWarningThreshold,
		bool $colors,
		bool $verbose,
		bool $strictMode,
		bool $requireTopLevelLocation,
		bool $noIpv6,
		bool $showUsageHelp,
		string $usageHelp,
	): void {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Check/SecurityTxtCheckHostCli.php Outdated
Comment thread tests/Check/SecurityTxtCheckHostCliTest.phpt
If specified, the following messages will be printed:
- Loading security.txt from ...
- Redirected from ... to ...
- Not found ...
They were always printed until now.
@spaze spaze requested a review from Copilot April 15, 2026 01:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in --verbose flag to the checksecuritytxt.php CLI so that fetch progress details (loaded URLs, redirects, and “not found” messages) are only printed when explicitly requested, while keeping the core “Using …” message.

Changes:

  • Add --verbose argument parsing and usage text to bin/checksecuritytxt.php.
  • Update SecurityTxtCheckHostCli to accept a verbose parameter and gate URL/redirect/not-found output accordingly.
  • Adjust CLI tests to cover both verbose and non-verbose output, including switching between the two within a single CLI instance.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
tests/Check/SecurityTxtCheckHostCliTest.phpt Updates call signatures and adds a test to verify verbose vs non-verbose output behavior across sequential runs.
src/Check/SecurityTxtCheckHostCli.php Introduces a per-run $verbose flag and registers callbacks once, printing fetch details only when verbose is enabled.
src/Check/SecurityTxtCheckHost.php Moves fetcher-callback initialization to the constructor to avoid re-registering callbacks on every check() call.
bin/checksecuritytxt.php Adds --verbose flag handling and updates usage/help text accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a --verbose switch to the checksecuritytxt.php CLI so URL/redirect “progress” messages are only printed when explicitly requested, aligning CLI output with the new default behavior.

Changes:

  • Add --verbose CLI flag and extend help/usage output accordingly.
  • Gate “Loading…”, “Redirected…”, and “Not found…” messages behind a verbose flag in SecurityTxtCheckHostCli.
  • Refactor callback registration to happen once (constructor-time) and update/add CLI tests to cover verbose vs non-verbose behavior across multiple runs.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
bin/checksecuritytxt.php Adds --verbose argument parsing and updates usage/help text.
src/Check/SecurityTxtCheckHostCli.php Introduces per-run verbose gating and registers callbacks once to avoid handler accumulation side effects.
src/Check/SecurityTxtCheckHost.php Moves fetcher callback initialization to the constructor (avoids re-registering per check() call).
tests/Check/SecurityTxtCheckHostCliTest.phpt Updates call signatures and adds coverage for verbose then non-verbose execution on the same CLI instance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Check/SecurityTxtCheckHostCli.php
Comment thread tests/Check/SecurityTxtCheckHostCliTest.phpt Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an opt-in --verbose mode to the bin/checksecuritytxt.php CLI so that URL-level informational messages (loading attempts, redirects, and not-found notices) are only printed when explicitly requested, instead of always.

Changes:

  • Add --verbose argument to bin/checksecuritytxt.php and document it in usage output.
  • Gate “Loading…”, “Redirected…”, and “Not found…” messages behind a verbose flag while keeping the final “Using …” line.
  • Add/adjust CLI tests to cover a verbose run followed by a non-verbose run on the same CLI instance.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
bin/checksecuritytxt.php Parses --verbose, updates usage text, passes verbose flag into the CLI runner.
src/Check/SecurityTxtCheckHostCli.php Introduces a per-run verbose flag and registers callbacks once, printing selected info messages only when verbose.
src/Check/SecurityTxtCheckHost.php Moves fetcher-callback initialization to the constructor (avoids repeated registrations per check() call).
tests/Check/SecurityTxtCheckHostCliTest.phpt Updates call signature for the new verbose argument and adds coverage for verbose vs non-verbose output behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@spaze spaze merged commit 00d8e1c into main Apr 15, 2026
10 checks passed
@spaze spaze deleted the spaze/verbose branch April 15, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants