-
Notifications
You must be signed in to change notification settings - Fork 29
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
refactor(ruleset)!: improve match code efficiency and properly handle status #1255
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❌ Your project check has failed because the head coverage (56.61%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1255 +/- ##
==========================================
+ Coverage 56.55% 56.61% +0.06%
==========================================
Files 630 630
Lines 35710 35663 -47
==========================================
- Hits 20195 20190 -5
+ Misses 14828 14800 -28
+ Partials 687 673 -14
🚀 New features to boost your workflow:
|
@@ -30,7 +30,7 @@ func (c *client) Equal(other *client) bool { | |||
// New returns a Registry implementation that integrates | |||
// with GitHub or a GitHub Enterprise instance. | |||
// | |||
//nolint:revive // ignore returning unexported client | |||
|
|||
func New(ctx context.Context, address, token string) (*client, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
unexported-return: exported func New returns unexported type *github.client, which can be annoying to use (revive)
@@ -42,7 +42,7 @@ type ( | |||
|
|||
// New creates and returns a Vela service for integrating with settings in the database. | |||
// | |||
//nolint:revive // ignore returning unexported engine | |||
|
|||
func New(opts ...EngineOpt) (*engine, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
unexported-return: exported func New returns unexported type *settings.engine, which can be annoying to use (revive)
@@ -40,7 +40,7 @@ type ( | |||
|
|||
// New creates and returns a Vela service for integrating with steps in the database. | |||
// | |||
//nolint:revive // ignore returning unexported engine | |||
|
|||
func New(opts ...EngineOpt) (*engine, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
unexported-return: exported func New returns unexported type *step.engine, which can be annoying to use (revive)
@@ -40,7 +40,7 @@ type ( | |||
|
|||
// New creates and returns a Vela service for integrating with services in the database. | |||
// | |||
//nolint:revive // ignore returning unexported engine | |||
|
|||
func New(opts ...EngineOpt) (*engine, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
unexported-return: exported func New returns unexported type *service.engine, which can be annoying to use (revive)
@@ -42,7 +42,7 @@ type ( | |||
|
|||
// New creates and returns a Vela service for integrating with repos in the database. | |||
// | |||
//nolint:revive // ignore returning unexported engine | |||
|
|||
func New(opts ...EngineOpt) (*engine, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
unexported-return: exported func New returns unexported type *repo.engine, which can be annoying to use (revive)
@@ -53,7 +53,7 @@ type ( | |||
|
|||
// New creates and returns a Vela service for integrating with dashboards in the database. | |||
// | |||
//nolint:revive // ignore returning unexported engine | |||
|
|||
func New(opts ...EngineOpt) (*engine, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
unexported-return: exported func New returns unexported type *dashboard.engine, which can be annoying to use (revive)
@@ -59,7 +59,7 @@ type ( | |||
|
|||
// New returns a Secret implementation that integrates with a Vault secrets engine. | |||
// | |||
//nolint:revive // ignore returning unexported client | |||
|
|||
func New(opts ...ClientOpt) (*client, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
unexported-return: exported func New returns unexported type *vault.client, which can be annoying to use (revive)
@@ -74,7 +74,7 @@ type client struct { | |||
// New returns a SCM implementation that integrates with | |||
// a GitHub or a GitHub Enterprise instance. | |||
// | |||
//nolint:revive // ignore returning unexported client | |||
|
|||
func New(ctx context.Context, opts ...ClientOpt) (*client, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
unexported-return: exported func New returns unexported type *github.client, which can be annoying to use (revive)
@@ -238,7 +238,7 @@ func (c *client) ValidateGitHubApp(ctx context.Context) error { | |||
// | |||
// This function is intended for running tests only. | |||
// | |||
//nolint:revive // ignore returning unexported client | |||
|
|||
func NewTest(urls ...string) (*client, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
unexported-return: exported func NewTest returns unexported type *github.client, which can be annoying to use (revive)
@@ -55,7 +55,7 @@ type client struct { | |||
|
|||
// FromCLIContext returns a Pipeline implementation that integrates with the supported registries. | |||
// | |||
//nolint:revive // ignore returning unexported client | |||
|
|||
func FromCLIContext(ctx *cli.Context) (*client, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
unexported-return: exported func FromCLIContext returns unexported type *native.client, which can be annoying to use (revive)
The above does not purge. It only gets skipped when the worker handles skipping. The compiler should be corrected here and return
FALSE
when the above is calculated withrule data == push on main
for exampleFurther, I refactored the match code to be more efficient. I removed the unnecessary
Parallel
key, which will be addressed in a follow-up worker PR, which introduces stage status.Added some bench mark testing which is just there for fun right now, but I used it to confirm the improvements by comparing these changes to main. Improvement of about half a second, which definitely adds up over parsing thousands of rulesets.
Another thing I added was separation of
if
andunless
operators/matchers if defined. Otherwise, they'll inherit from theRuleset
like usual (non-breaking).