-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50157e2
commit 103c420
Showing
3 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from src.common.logger import info | ||
from src.controls.control import Control, ControlResult | ||
|
||
|
||
class LinearHistoryControl(Control): | ||
ALLOWED_MERGE_METHOD = ['ff'] | ||
ALLOWED_SQUASH_OPTIONS = ['default_on', 'always'] | ||
|
||
def get_name(self): | ||
return "1.1.13 Ensure linear history is required (Manual)" | ||
|
||
def validate(self, gl_group_project, gl_project) -> ControlResult: | ||
info(f"Project name: {gl_project.name} - Performing check {self.get_name()}") | ||
|
||
merge_method = gl_project.merge_method | ||
merge_method_passed = merge_method in self.ALLOWED_MERGE_METHOD # only fast-forward | ||
|
||
squash_option = gl_project.squash_option | ||
squash_option_passed = squash_option in self.ALLOWED_SQUASH_OPTIONS | ||
|
||
if merge_method_passed and squash_option_passed: | ||
return ControlResult(self.get_name(), True, "") | ||
else: | ||
return ControlResult(self.get_name(), False, | ||
f"Merge method: {merge_method} allowed {self.ALLOWED_MERGE_METHOD}\n" + | ||
f"Squash options: {squash_option}\nallowed: {self.ALLOWED_SQUASH_OPTIONS}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters