-
Notifications
You must be signed in to change notification settings - Fork 472
Targeted custom-lint cleanup: append byte conversion, context propagation, error wrapping, and param-count reduction #43938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3ee0abc
dbb63fe
efdf30a
a66bfcf
e9103ad
6b00cf9
f6e6097
7b95ca7
aeb940c
b5df84e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,14 @@ type frontmatterParseResult struct { | |
| redirectTarget string | ||
| } | ||
|
|
||
| type frontmatterReadError struct { | ||
| message string | ||
| } | ||
|
|
||
| func (e frontmatterReadError) Error() string { | ||
| return e.message | ||
| } | ||
|
|
||
| func (c *Compiler) validateEngineBeforeSchema( | ||
| cleanPath string, | ||
| content []byte, | ||
|
|
@@ -84,8 +92,8 @@ func (c *Compiler) parseFrontmatterSection(markdownPath string) (*frontmatterPar | |
| content, err := os.ReadFile(cleanPath) | ||
| if err != nil { | ||
| orchestratorFrontmatterLog.Printf("Failed to read file: %s, error: %v", cleanPath, err) | ||
| // Intentionally not wrapping to avoid exposing internal path details | ||
| return nil, fmt.Errorf("failed to read file: %v", err) //nolint:errorlint // intentionally not wrapping to avoid exposing os.PathError | ||
| // Keep the user-facing message while avoiding exposure of os.PathError internals. | ||
| return nil, fmt.Errorf("failed to read file: %w", frontmatterReadError{message: err.Error()}) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/codebase-design] `frontmatterReadError` is a value type (not a pointer), has no exported fields, and is not accessible outside this package — so callers can never do `errors.As(err, &frontmatterReadError{})` to discriminate read failures from parse failures. The wrapping via `%w` satisfies the linter, but the wrapped sentinel adds no practical information over the raw error string. 💡 Alternative to considerIf the goal is lint compliance without an intermediate sentinel, a simple return nil, fmt.Errorf("failed to read file: %s", err.Error())If @copilot please address this.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The That's the intended behaviour (hiding @copilot please address this. |
||
| } | ||
| contentString := string(content) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.