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

First Pull Request #1

Merged
merged 1 commit into from
May 11, 2024
Merged

First Pull Request #1

merged 1 commit into from
May 11, 2024

Conversation

nao1215
Copy link
Owner

@nao1215 nao1215 commented May 11, 2024

Summary by CodeRabbit

  • New Features
    • Introduced GitHub funding configuration and issue templates.
    • Added workflows for test coverage, linting, and unit testing.
    • Enhanced CSV package with reading, validation, and decoding methods.
    • Implemented security policy and code of conduct guidelines.
    • Improved error handling and validation in the CSV package.
    • Added test scenarios and validation functionalities for CSV parsing.
    • Implemented configuration options for CSV struct and tag parsing.
    • Added validators for different column types in CSV files.

Copy link

coderabbitai bot commented May 11, 2024

Warning

Rate Limit Exceeded

@nao1215 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 3 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 416f0f8 and 3fb69fc.

Walkthrough

The changes revamp a CSV project owned by nao1215 on GitHub, introducing new configurations, templates for bug reports and task descriptions, workflows for testing and linting, updated linting settings, security policies, and Makefile enhancements.

Changes

File Summary
.all-contributorsrc Introduces project configuration and contributor details.
.github/FUNDING.yml, .github/dependabot.yml Setup GitHub funding and dependency update configurations.
.github/ISSUE_TEMPLATE/bug_report.md, .github/ISSUE_TEMPLATE/issue.md Added templates for bug reports and task descriptions.
.github/workflows/coverge.yml, .github/workflows/multi_platform_ut.yml, .github/workflows/reviewdog.yml Introduced workflows for test coverage, multi-platform unit tests, and linting.
.gitignore Added coverage.* to the .gitignore file.
.golangci.yml Updated linting configuration for Go code.
.octocov.yml Added settings for code coverage reporting using OctoCov.
CODE_OF_CONDUCT.md, SECURITY.md Updated files with guidelines and security policies.
Makefile Added functionalities for a CSV application.
README.md, csv.go, csv_test.go, errors.go, example_test.go, option.go, parser.go, parser_test.go, tag.go, validation.go, validation_test.go Introduced and updated files related to CSV processing and validation.

Poem

Within the code's intricate dance,
The rabbit leaps with a chance,
Bugs squashed, tests align,
A CSV project, now divine. 🐇📦


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

parser.go Outdated
validatorList := make(validators, 0, len(tagList))

for _, t := range tagList {
switch true {

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
switchTrue: replace 'switch true {}' with 'switch {}' (gocritic)

validation.go Outdated

// equalValidator is a struct that contains the validation rules for an equal column.
type equalValidator struct {
threshhold float64

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
threshhold is a misspelling of threshold (misspell)

validation.go Outdated
}

// newEqualValidator returns a new equalValidator.
func newEqualValidator(threshhold float64) *equalValidator {

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
threshhold is a misspelling of threshold (misspell)

validation.go Outdated

// newEqualValidator returns a new equalValidator.
func newEqualValidator(threshhold float64) *equalValidator {
return &equalValidator{threshhold: threshhold}

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
threshhold is a misspelling of threshold (misspell)

)

// tagValue is the struct tag value.
type tagValue string

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
type tagValue is unused (unused)

}
})

}

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
unnecessary trailing newline (whitespace)

}

fieldValue := structValue.Field(index)
switch fieldValue.Kind() {

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
missing cases in switch of type reflect.Kind: reflect.Invalid, reflect.Bool, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128, reflect.Array, reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Pointer|reflect.Ptr, reflect.Slice, reflect.Struct, reflect.UnsafePointer (exhaustive)

}

elem := rv.Elem()
switch elem.Kind() {

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
missing cases in switch of type reflect.Kind: reflect.Invalid, reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128, reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Pointer|reflect.Ptr, reflect.String, reflect.Struct, reflect.UnsafePointer (exhaustive)

parser.go Outdated

for i := 0; i < structType.NumField(); i++ {
fieldName := structType.Field(i).Name
header = append(header, column(fieldName))

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
SA4010: this result of append is never used, except maybe in other appends (staticcheck)

// The strutSlicePointer is a pointer to structure slice where validation rules are set in struct tags.
//
// Example:
func (c *CSV) Decode(structSlicePointer any) []error {

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
ST1016: methods on the same type should have the same receiver name (seen 1x "csv", 2x "c") (stylecheck)

validation.go Outdated

// equalValidator is a struct that contains the validation rules for an equal column.
type equalValidator struct {
threshhold float64

Choose a reason for hiding this comment

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

[misspell] reported by reviewdog 🐶
"threshhold" is a misspelling of "threshold"

validation.go Outdated
}

// newEqualValidator returns a new equalValidator.
func newEqualValidator(threshhold float64) *equalValidator {

Choose a reason for hiding this comment

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

[misspell] reported by reviewdog 🐶
"threshhold" is a misspelling of "threshold"

validation.go Outdated

// newEqualValidator returns a new equalValidator.
func newEqualValidator(threshhold float64) *equalValidator {
return &equalValidator{threshhold: threshhold}

Choose a reason for hiding this comment

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

[misspell] reported by reviewdog 🐶
"threshhold" is a misspelling of "threshold"

validation.go Outdated

// newEqualValidator returns a new equalValidator.
func newEqualValidator(threshhold float64) *equalValidator {
return &equalValidator{threshhold: threshhold}

Choose a reason for hiding this comment

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

[misspell] reported by reviewdog 🐶
"threshhold" is a misspelling of "threshold"

validation.go Outdated
return &equalValidator{threshhold: threshhold}
}

// Do validates the target is equal to the threshhold.

Choose a reason for hiding this comment

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

[misspell] reported by reviewdog 🐶
"threshhold" is a misspelling of "threshold"

validation.go Outdated

// lessThanEqualValidator is a struct that contains the validation rules for a less than or equal column.
type lessThanEqualValidator struct {
threshhold float64

Choose a reason for hiding this comment

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

[misspell] reported by reviewdog 🐶
"threshhold" is a misspelling of "threshold"

validation.go Outdated
}

// newLessThanEqualValidator returns a new lessThanEqualValidator.
func newLessThanEqualValidator(threshhold float64) *lessThanEqualValidator {

Choose a reason for hiding this comment

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

[misspell] reported by reviewdog 🐶
"threshhold" is a misspelling of "threshold"

validation.go Outdated

// newLessThanEqualValidator returns a new lessThanEqualValidator.
func newLessThanEqualValidator(threshhold float64) *lessThanEqualValidator {
return &lessThanEqualValidator{threshhold: threshhold}

Choose a reason for hiding this comment

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

[misspell] reported by reviewdog 🐶
"threshhold" is a misspelling of "threshold"

validation.go Outdated

// newLessThanEqualValidator returns a new lessThanEqualValidator.
func newLessThanEqualValidator(threshhold float64) *lessThanEqualValidator {
return &lessThanEqualValidator{threshhold: threshhold}

Choose a reason for hiding this comment

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

[misspell] reported by reviewdog 🐶
"threshhold" is a misspelling of "threshold"

validation.go Outdated
return &lessThanEqualValidator{threshhold: threshhold}
}

// Do validates the target is less than or equal to the threshhold.

Choose a reason for hiding this comment

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

[misspell] reported by reviewdog 🐶
"threshhold" is a misspelling of "threshold"

This comment has been minimized.

@@ -0,0 +1,145 @@
// Package csv returns which columns have syntax errors on a per-line basis when reading CSV.

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
: # github.com/nao1215/csv [github.com/nao1215/csv.test]

parser.go Outdated
if err != nil {
return err
}
csv.ruleSet = ruleSet

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
undefined: csv (typecheck)

"bytes"
"fmt"

"github.com/nao1215/csv"

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
could not import github.com/nao1215/csv (-: # github.com/nao1215/csv [github.com/nao1215/csv.test]

parser.go Outdated
if err != nil {
return err
}
csv.ruleSet = ruleSet

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
undefined: csv) (typecheck)

This comment has been minimized.

Copy link

Code Metrics Report

Coverage Test Execution Time
80.9% 1s

Code coverage of files in pull request scope (80.9%)

Files Coverage
csv.go 71.7%
option.go 100.0%
parser.go 79.4%
tag.go 100.0%
validation.go 85.9%

Reported by octocov

}

fieldValue := structValue.Field(index)
switch fieldValue.Kind() {

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
missing cases in switch of type reflect.Kind: reflect.Invalid, reflect.Bool, reflect.Uintptr, reflect.Complex64, reflect.Complex128, reflect.Array, reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Pointer|reflect.Ptr, reflect.Slice, reflect.Struct, reflect.UnsafePointer (exhaustive)

@nao1215 nao1215 merged commit 236bd50 into main May 11, 2024
16 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.

1 participant