Skip to content

feat: add structured error codes (PLB-XXXX) with documentation links#93

Open
stephrobert wants to merge 1 commit intogetplumber:mainfrom
stephrobert:feature/error-codes-doc-links
Open

feat: add structured error codes (PLB-XXXX) with documentation links#93
stephrobert wants to merge 1 commit intogetplumber:mainfrom
stephrobert:feature/error-codes-doc-links

Conversation

@stephrobert
Copy link
Contributor

Summary

Add structured error codes (PLB-XXXX) to every issue detected by Plumber, with direct links to dedicated documentation pages.

Changes

New file

  • control/codes.go — Central error code registry with 14 codes (PLB-0101 to PLB-0501), ErrorCode type, ErrorCodeInfo struct, and lookup/listing functions

Modified files

  • control/types.go — Added Code ErrorCode and DocURL string fields to issue structs
  • cmd/analyze.go — Display [PLB-XXXX] prefix on each issue line + ↳ docs: link + Codes column in summary table
  • control/mrcomment.go — Include error codes and doc links in MR comments
  • 10 control files — Assign error codes to all issue creation points

Error Codes

Code Issue Control
PLB-0101 Forbidden image tag containerImageMustNotUseForbiddenTags
PLB-0102 Image not pinned by digest containerImageMustNotUseForbiddenTags
PLB-0103 Unauthorized image source containerImageMustComeFromAuthorizedSources
PLB-0201 Branch not protected branchMustBeProtected
PLB-0202 Non-compliant branch protection branchMustBeProtected
PLB-0301 Hardcoded job pipelineMustNotIncludeHardcodedJobs
PLB-0302 Outdated include version includesMustBeUpToDate
PLB-0303 Forbidden include version includesMustNotUseForbiddenVersions
PLB-0401 Required component missing pipelineMustIncludeComponent
PLB-0402 Required component overridden pipelineMustIncludeComponent
PLB-0403 Required template missing pipelineMustIncludeTemplate
PLB-0404 Required template overridden pipelineMustIncludeTemplate
PLB-0501 Debug trace enabled pipelineMustNotEnableDebugTrace

CLI Output Example

[PLB-0101] Job "build" uses image "node:latest" with forbidden tag "latest"
  ↳ docs: https://getplumber.io/e/PLB-0101

Summary table now includes a Codes column with links to documentation.

Documentation

Companion PR for doc pages: getplumber/getplumber.io#77

Closes #92

- Add control/codes.go with 14 error codes (PLB-0101 to PLB-0501)
- Add Code and DocURL fields to all issue structs
- Display [PLB-XXXX] prefix and docs link in CLI output
- Add Codes column to summary table with docs footer
- Include error codes and doc links in MR comments

Closes getplumber#92
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.

[FEAT] Add error codes and documentation links to control findings (Popeye-style codes.md)

1 participant