Skip to content
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

feat: add validation for secret block #126

Merged
merged 28 commits into from
Jan 11, 2021
Merged

feat: add validation for secret block #126

merged 28 commits into from
Jan 11, 2021

Conversation

kneal
Copy link

@kneal kneal commented Dec 30, 2020

This PR is part of the work with the new Yaml library:
go-vela/community#9

This PR implements linting guidelines for the secret block. The checked fields follow the standard set by the schema.json in the latest release.

@kneal kneal requested a review from a team as a code owner December 30, 2020 19:40
@kneal kneal self-assigned this Dec 30, 2020
@kneal kneal added the feature Indicates a new feature label Dec 30, 2020
@codecov
Copy link

codecov bot commented Dec 30, 2020

Codecov Report

Merging #126 (40d6adb) into master (2000583) will decrease coverage by 0.97%.
The diff coverage is 73.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #126      +/-   ##
==========================================
- Coverage   95.96%   94.98%   -0.98%     
==========================================
  Files          50       50              
  Lines        3147     3270     +123     
==========================================
+ Hits         3020     3106      +86     
- Misses         73       90      +17     
- Partials       54       74      +20     
Impacted Files Coverage Δ
yaml/stage.go 66.66% <0.00%> (+3.70%) ⬆️
yaml/build.go 47.82% <50.00%> (-2.18%) ⬇️
yaml/secret.go 80.00% <72.60%> (-13.75%) ⬇️
yaml/service.go 71.42% <100.00%> (-3.96%) ⬇️
yaml/step.go 72.60% <100.00%> (-4.41%) ⬇️

yaml/secret.go Outdated
return isInvalid, fmt.Errorf("failed compile: unable to annotate: %w", err)
}

// nolint:lll // ignore line length
Copy link

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
directive // nolint:lll // ignore line length is unused for linter lll (nolintlint)

Copy link
Collaborator

@wass3r wass3r Jan 7, 2021

Choose a reason for hiding this comment

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

this means the nolint directive is not needed here, afaik

yaml/step.go Outdated
"provided for step %s:\n%s\n ", step.Name, string(source)),
)
invalid = fmt.Errorf("%w: %s", invalid,
fmt.Errorf("no commands, environment, parameters, secrets or template provided for step %s:\n%s\n ", step.Name, string(source)))
Copy link

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
line is 132 characters (lll)

Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like we need a nolint here, or break up the line

jbrockopp
jbrockopp previously approved these changes Jan 6, 2021
Copy link
Contributor

@jbrockopp jbrockopp left a comment

Choose a reason for hiding this comment

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

LGTM

yaml/secret.go Outdated
return isInvalid, fmt.Errorf("failed compile: unable to annotate: %w", err)
}

// nolint:lll // ignore line length
Copy link
Collaborator

@wass3r wass3r Jan 7, 2021

Choose a reason for hiding this comment

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

this means the nolint directive is not needed here, afaik

yaml/step.go Outdated
"provided for step %s:\n%s\n ", step.Name, string(source)),
)
invalid = fmt.Errorf("%w: %s", invalid,
fmt.Errorf("no commands, environment, parameters, secrets or template provided for step %s:\n%s\n ", step.Name, string(source)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like we need a nolint here, or break up the line

Copy link
Contributor

@jbrockopp jbrockopp left a comment

Choose a reason for hiding this comment

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

LGTM

@kneal kneal merged commit cd87586 into master Jan 11, 2021
@kneal kneal deleted the pkg/yaml branch January 11, 2021 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Indicates a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants