Skip to content

CNF-24259: Consolidate duplicate normalizeHost functions#72

Open
sebrandon1 wants to merge 1 commit into
openshift:mainfrom
sebrandon1:consolidate-normalize-host
Open

CNF-24259: Consolidate duplicate normalizeHost functions#72
sebrandon1 wants to merge 1 commit into
openshift:mainfrom
sebrandon1:consolidate-normalize-host

Conversation

@sebrandon1
Copy link
Copy Markdown
Member

Summary

  • Replace three identical host-normalization functions with a single exported stringutil.NormalizeHost()
  • All three trimmed whitespace and stripped IPv6 square brackets with the same 5-line body
  • Add 9 test cases covering IPv4, IPv6 (bracketed/unbracketed), whitespace, empty, and hostname inputs

Jira: CNF-24259

Functions removed

Function File
normalizeHost() cmd/tls-scanner/main.go
normalizeTargetHost() internal/scanner/scanner.go
normalizeTemplateHost() internal/scanner/template.go

Replaced with

stringutil.NormalizeHost() in internal/stringutil/stringutil.go

Test plan

  • go build ./... passes
  • go test ./... passes
  • make lint passes
  • New TestNormalizeHost covers 9 input variants

Replace three identical host-normalization functions with a single
exported stringutil.NormalizeHost to eliminate code duplication.
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 29, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 29, 2026

@sebrandon1: This pull request references CNF-24259 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Replace three identical host-normalization functions with a single exported stringutil.NormalizeHost()
  • All three trimmed whitespace and stripped IPv6 square brackets with the same 5-line body
  • Add 9 test cases covering IPv4, IPv6 (bracketed/unbracketed), whitespace, empty, and hostname inputs

Jira: CNF-24259

Functions removed

Function File
normalizeHost() cmd/tls-scanner/main.go
normalizeTargetHost() internal/scanner/scanner.go
normalizeTemplateHost() internal/scanner/template.go

Replaced with

stringutil.NormalizeHost() in internal/stringutil/stringutil.go

Test plan

  • go build ./... passes
  • go test ./... passes
  • make lint passes
  • New TestNormalizeHost covers 9 input variants

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 29, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sebrandon1
Once this PR has been reviewed and has the lgtm label, please assign smith-xyz for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 29, 2026

@sebrandon1: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants