Skip to content

Typos: Adherence to Go guidlines and typos#983

Open
CygnusMaximillian wants to merge 1 commit into
goharbor:mainfrom
CygnusMaximillian:typos-fix
Open

Typos: Adherence to Go guidlines and typos#983
CygnusMaximillian wants to merge 1 commit into
goharbor:mainfrom
CygnusMaximillian:typos-fix

Conversation

@CygnusMaximillian

Copy link
Copy Markdown

🔍 Overview

This PR continues the effort to standardize error message formatting across the codebase to adhere to the idiomatic Go Code Review Guidelines. Specifically, it ensures returned error strings are in lowercase and avoid ending punctuation.

Care was taken during this pass to only update standard text and strictly preserve all important capitalized acronyms/proper nouns (e.g., URL, Harbor, Ref) so that no pre-committed information or acronym capitalization is disrupted.

Fixes: #975

💡 Rationale

According to official Go guidelines:

"Error strings should not be capitalized (unless beginning with proper nouns or acronyms) or end with punctuation, since they are usually printed following other context."

These targeted changes resolve remaining capitalization style violations, resulting in cleaner and more idiomatic CLI error wrapping and logging.

🛠️ Changes Breakdown

  1. Command-Line Layer (cmd/harbor/root/...)
    Artifacts & Labels:
    artifact/label/list.go — Standardized the missing argument error message.
    Projects:
    project/list.go — Standardized flag conflict errors.
    project/member/update.go — Lowercased "no members found" errors.
    Robot Accounts:
    robot/create.go, robot/delete.go, robot/list.go, robot/view.go — Standardized "permission denied" privilege errors across all robot commands.
    Tags & Retention:
    tag/retention/delete.go, tag/retention/list.go — Standardized flag conflict errors for retention rules.
    Users:
    user/create.go, user/delete.go, user/list.go, user/password.go — Standardized "permission denied" privilege errors.
    user/elevate.go — Lowercased the user confirmation and permission errors.
  2. API Handlers (pkg/api/...)
    pkg/api/quota_handler.go — Standardized unexpected reference type errors (preserving Ref capitalization).
    pkg/api/retention_handler.go — Lowercased missing retention policy errors.
  3. UI & Views (pkg/views/...)
    pkg/views/member/create/view.go — Lowercased empty username validation errors.
    pkg/views/quota/list/view.go — Standardized unexpected reference type errors.

✅ Verification

Compilation: Built successfully using go build.
Tests: Verified that the entire test suite passes (go test ./... returns ok).
Preservation: Verified that acronyms and specific identifiers within these files were carefully preserved to ensure no test assertions or semantic meaning was altered.

Signed-off-by: CygnusMaximillian <dprajjwal11@gmail.com>
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 14.28571% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 9.17%. Comparing base (60ad0bd) to head (fba1070).
⚠️ Report is 186 commits behind head on main.

Files with missing lines Patch % Lines
cmd/harbor/root/robot/delete.go 0.00% 2 Missing ⚠️
cmd/harbor/root/user/list.go 0.00% 2 Missing ⚠️
cmd/harbor/root/artifact/label/list.go 0.00% 1 Missing ⚠️
cmd/harbor/root/project/member/update.go 0.00% 1 Missing ⚠️
cmd/harbor/root/robot/create.go 0.00% 1 Missing ⚠️
cmd/harbor/root/robot/list.go 0.00% 1 Missing ⚠️
cmd/harbor/root/robot/view.go 0.00% 1 Missing ⚠️
cmd/harbor/root/tag/retention/delete.go 0.00% 1 Missing ⚠️
cmd/harbor/root/tag/retention/list.go 0.00% 1 Missing ⚠️
cmd/harbor/root/user/create.go 0.00% 1 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff            @@
##             main    #983      +/-   ##
=========================================
- Coverage   10.99%   9.17%   -1.82%     
=========================================
  Files         173     321     +148     
  Lines        8671   16081    +7410     
=========================================
+ Hits          953    1475     +522     
- Misses       7612   14472    +6860     
- Partials      106     134      +28     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@NucleoFusion NucleoFusion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm!
Thanks for the contribution!

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.

style: align error message formatting with idiomatic Go guidelines

2 participants