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

Add lint job to CI #477

Merged
merged 1 commit into from
Oct 28, 2024
Merged

Add lint job to CI #477

merged 1 commit into from
Oct 28, 2024

Conversation

shuheiktgw
Copy link
Collaborator

SSIA. I believe it would be great if we have basic linters running in the CI.

Before submitting your PR, please confirm the following.

  • Describe the purpose for which you created this PR.
  • Create test code that corresponds to the modification

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 78.94%. Comparing base (3a90d71) to head (239b83c).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #477      +/-   ##
==========================================
+ Coverage   78.78%   78.94%   +0.16%     
==========================================
  Files          13       13              
  Lines        4007     3995      -12     
==========================================
- Hits         3157     3154       -3     
+ Misses        591      582       -9     
  Partials      259      259              

@@ -476,15 +476,6 @@ func (d *Decoder) getArrayNode(node ast.Node) (ast.ArrayNode, error) {
return arrayNode, nil
}

func (d *Decoder) fileToNode(f *ast.File) ast.Node {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unused

@@ -1623,13 +1614,13 @@ func (d *Decoder) readersUnderDir(dir string) ([]io.Reader, error) {

func (d *Decoder) readersUnderDirRecursive(dir string) ([]io.Reader, error) {
readers := []io.Reader{}
if err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should we check the err here? 🤔

if !d.isYAMLFile(path) {
return nil
}
reader, err := d.fileToReader(path)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It shadows the outer err variable.

@@ -2152,16 +2152,16 @@ func Example_DisallowUnknownField() {

const src = `---
simple: string
complecated: string
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

misspell keeps trying to fix it so I renamed it

@@ -110,13 +110,6 @@ func (c *context) nextToken() *token.Token {
return c.tokens[c.idx+1]
}

func (c *context) afterNextToken() *token.Token {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unused

@@ -470,7 +470,6 @@ func (s *Scanner) scanComment(ctx *Context) (tk *token.Token, pos int) {
ctx.addOriginBuf('#')
ctx.progress(1) // skip '#' character
for idx, c := range ctx.src[ctx.idx:] {
pos = idx + 1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The original assignment to the pos is unnecessary since it should be overwritten eventually below

@@ -588,7 +587,6 @@ func (s *Scanner) scanLiteralHeader(ctx *Context) (pos int, err error) {
ctx.literalOpt = opt
return
}
break
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This "break" is unnecessary because it's at the end of the switch statement. I wonder if it was actually meant to be placed below to break out of the for loop 🤔

Copy link
Owner

@goccy goccy left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@goccy goccy merged commit 8ad318c into goccy:master Oct 28, 2024
18 checks passed
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.

3 participants