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 modified_lines predicate #71

Merged
merged 3 commits into from Apr 20, 2019
Merged

Add modified_lines predicate #71

merged 3 commits into from Apr 20, 2019

Conversation

bluekeyes
Copy link
Member

Allows enabling rules based on the number of lines added or deleted by a
pull request. Each property takes simple expression representing a
comparison and the predicate is satisfied if any expression is matched.

Fixes #70.

Allows enabling rules based on the number of lines added or deleted by a
pull request. Each property takes simple expression representing a
comparison and the predicate is satisfied if any expression is matched.
modified_lines:
additions: "> 100"
deletion: "> 100"
total: "> 200"
Copy link
Member

Choose a reason for hiding this comment

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

are all combinations of these 3 allowed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the code allows all combinations of the three, as there's a clear way to evaluate all of them and combine the result. That said, I'm not sure if there are any practical policies that would make use of all three in all combinations.

policy/predicate/file.go Outdated Show resolved Hide resolved
policy/predicate/file.go Outdated Show resolved Hide resolved
policy/predicate/file.go Show resolved Hide resolved
return false, "", err
}
if ok {
return true, "", nil
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably worth calling out in the README that the options are combined using logical or (and not all must be true).

Copy link
Member Author

Choose a reason for hiding this comment

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

The current comment says ... matches any of the listed conditions - do you think it needs to be more obvious?

ajlake and others added 2 commits April 19, 2019 16:48
Co-Authored-By: bluekeyes <bluekeyes@gmail.com>
Co-Authored-By: bluekeyes <bluekeyes@gmail.com>
@bluekeyes bluekeyes merged commit ba124bc into develop Apr 20, 2019
@bluekeyes bluekeyes deleted the bkeyes/modified-lines branch April 20, 2019 00:57
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.

FR: Add a min_lines_of_code predicate
3 participants