Skip to content

feat: Add Style Linters (usestdlibvars, dupl)#22670

Merged
Vad1mo merged 5 commits intogoharbor:mainfrom
bupd:lint/style-duplication
Jan 22, 2026
Merged

feat: Add Style Linters (usestdlibvars, dupl)#22670
Vad1mo merged 5 commits intogoharbor:mainfrom
bupd:lint/style-duplication

Conversation

@bupd
Copy link
Copy Markdown
Contributor

@bupd bupd commented Dec 23, 2025

Comprehensive Summary of your change

Add style linters to enforce consistency:

  • usestdlibvars - Enforces stdlib constants (eg http.MethodGet, http.StatusOK)
  • dupl - Detects duplicate code blocks (threshold: 300 tokens)
  • Set dupl threshold to 300 tokens to avoid false positives
  • Fixed usestdlibvars violations (replaced literals with constants)
  • Added revive exclusion for var-naming in existing packages

Issue being fixed

Fixes #22665

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/update"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

@bupd bupd requested a review from a team as a code owner December 23, 2025 00:39
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 23, 2025

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.88%. Comparing base (c8c11b4) to head (6f4bee5).
⚠️ Report is 634 commits behind head on main.

Files with missing lines Patch % Lines
src/pkg/oidc/helper.go 0.00% 1 Missing ⚠️
src/pkg/reg/adapter/huawei/huawei_adapter.go 66.66% 1 Missing ⚠️
src/server/v2.0/handler/search.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #22670       +/-   ##
===========================================
+ Coverage   45.36%   65.88%   +20.51%     
===========================================
  Files         244     1074      +830     
  Lines       13333   116357   +103024     
  Branches     2719     2932      +213     
===========================================
+ Hits         6049    76661    +70612     
- Misses       6983    35447    +28464     
- Partials      301     4249     +3948     
Flag Coverage Δ
unittests 65.88% <70.00%> (+20.51%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/pkg/reg/adapter/huawei/image_registry.go 58.49% <100.00%> (ø)
src/server/registry/referrers.go 61.15% <100.00%> (ø)
src/pkg/oidc/helper.go 43.88% <0.00%> (ø)
src/pkg/reg/adapter/huawei/huawei_adapter.go 55.39% <66.66%> (ø)
src/server/v2.0/handler/search.go 0.00% <0.00%> (ø)

... and 984 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

bupd added 3 commits December 23, 2025 06:33
Signed-off-by: bupd <bupdprasanth@gmail.com>
Signed-off-by: bupd <bupdprasanth@gmail.com>
Signed-off-by: bupd <bupdprasanth@gmail.com>
@bupd bupd force-pushed the lint/style-duplication branch from 54f1c9c to 53e40b8 Compare December 23, 2025 01:04
Copy link
Copy Markdown
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

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

lgtm

@chlins chlins added the release-note/update Update or Fix label Jan 22, 2026
@Vad1mo Vad1mo enabled auto-merge (squash) January 22, 2026 12:05
@Vad1mo Vad1mo merged commit 64b8a02 into goharbor:main Jan 22, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/update Update or Fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more linters to catch bugs earlier

5 participants