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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support regular expression #3

Merged
merged 9 commits into from Apr 5, 2021
Merged

Conversation

sachaos
Copy link
Contributor

@sachaos sachaos commented Apr 1, 2021

Changes

  • 馃巵 Support regular expression
  • Add a test for that.

Copy link
Owner

@julz julz left a comment

Choose a reason for hiding this comment

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

This looks awesome, thanks so much! Couple nits:

config.go Outdated
return nil
}

func (c Config) findRule(path string) *Rule {
Copy link
Owner

Choose a reason for hiding this comment

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

I'd make this and AliasFor use *Config too for consistency (see https://golang.org/doc/faq#methods_on_values_or_pointers)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for review.
I fixed at 6439bcc

config.go Outdated
return r.Regexp.ReplaceAllString(str, r.Alias), nil
}

return "", fmt.Errorf("mismatch rule")
Copy link
Owner

Choose a reason for hiding this comment

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

we can use errors.New here since there are no actual formatting instructions in the error string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed at 6c1a7d7

@julz julz merged commit a22c8f7 into julz:main Apr 5, 2021
@julz
Copy link
Owner

julz commented Apr 5, 2021

Thanks @sachaos this is really cool!

@sachaos
Copy link
Contributor Author

sachaos commented Apr 5, 2021

@julz Thank you!

I've created PR to golangci-lint to enable to use this feature in that.
golangci/golangci-lint#1899

@sachaos sachaos deleted the feature/support-regex branch April 6, 2021 02:59
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.

None yet

2 participants