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

Changed isSilent to lower case #4728

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/4728.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- description: Changed the isSilent key to be lower case.
type: fix
pr_number: 4728
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ def validate_readme_exists(self, validate_all: bool = False):
path_split = file_path.split(os.sep)
file_type = find_type(self.file_path, _dict=self.current_file, file_type="yml")
if file_type == FileType.PLAYBOOK:
if self.current_file.get("isSilent"):
if self.current_file.get("issilent"):
return True
to_replace = os.path.splitext(path_split[-1])[-1]
readme_path = file_path.replace(to_replace, "_README.md")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def are_release_notes_complete(self):
):
try:
_dict, file_type = get_dict_from_file(file)
if _dict.get("isSilent"):
if _dict.get("issilent"):
continue
except Exception:
pass
Expand Down
2 changes: 1 addition & 1 deletion demisto_sdk/commands/common/schemas/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ mapping:
type: bool
deprecated:
type: bool
isSilent:
issilent:
type: bool
starttaskid:
type: str
Expand Down
2 changes: 1 addition & 1 deletion demisto_sdk/commands/common/schemas/trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mapping:
description:
type: str
required: true
isSilent:
issilent:
type: bool
suggestion_reason:
type: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ def version(self) -> int:

@property
def is_silent(self) -> bool:
return get_value(self.json_data, "isSilent", False)
return get_value(self.json_data, "issilent", False)
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def deprecated(self) -> bool:

@property
def is_silent(self) -> bool:
return get_value(self.yml_data, "isSilent", False)
return get_value(self.yml_data, "issilent", False)

@property
def description(self) -> Optional[str]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,4 @@ class StrictPlaybook(BaseStrictModel):
tests: Optional[List[str]] = None
role_name: Optional[List[str]] = Field(None, alias="rolename")
marketplaces: Optional[List[MarketplaceVersions]] = None
is_silent: Optional[bool] = Field(alias="isSilent")
is_silent: Optional[bool] = Field(alias="issilent")
18 changes: 9 additions & 9 deletions demisto_sdk/commands/validate/tests/PB_validators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1409,14 +1409,14 @@ def test_MarketplaceKeysHaveDefaultValidator(
def test_IsSilentPlaybookValidator(name, id, is_silent, result_len):
"""
Given:
case 1: isSilent = False, and name/id do not contain silent prefix.
case 2: isSilent = True, and name/id contain silent prefix.
case 3: isSilent = True, name contain and id do not contain silent prefix.
case 4: isSilent = True, id contain and name do not contain silent prefix.
case 5: isSilent = False, and name/id contain silent prefix.
case 6: isSilent = False, name contain and id do not contain silent prefix.
case 7: isSilent = False, id contain and name do not contain silent prefix.
case 8: isSilent = True, and name/id do not contain silent prefix.
case 1: issilent = False, and name/id do not contain silent prefix.
case 2: issilent = True, and name/id contain silent prefix.
case 3: issilent = True, name contain and id do not contain silent prefix.
case 4: issilent = True, id contain and name do not contain silent prefix.
case 5: issilent = False, and name/id contain silent prefix.
case 6: issilent = False, name contain and id do not contain silent prefix.
case 7: issilent = False, id contain and name do not contain silent prefix.
case 8: issilent = True, and name/id do not contain silent prefix.

When:
- calling IsSilentPlaybookValidator.obtain_invalid_content_items.
Expand All @@ -1427,7 +1427,7 @@ def test_IsSilentPlaybookValidator(name, id, is_silent, result_len):
playbook = create_playbook_object()
playbook.data["id"] = id
playbook.data["name"] = name
playbook.data["isSilent"] = is_silent
playbook.data["issilent"] = is_silent

invalid_content_items = IsSilentPlaybookValidator().obtain_invalid_content_items(
[playbook]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

class IsSilentPlaybookValidator(BaseValidator[ContentTypes]):
error_code = "PB130"
description = "Validate that the name and ID of a silent-Playbook contain the silent prefix and include the field isSilent: true"
rationale = "In silent-Playbook the name and ID prefix should be silent and also include the field isSilent: true"
error_message = "Silent-Playbook should have silent as a prefix in the name and ID, as well as the field isSilent: true, one of them is missing."
description = "Validate that the name and ID of a silent-Playbook contain the silent prefix and include the field issilent: true"
rationale = "In silent-Playbook the name and ID prefix should be silent and also include the field issilent: true"
error_message = "Silent-Playbook should have silent as a prefix in the name and ID, as well as the field issilent: true, one of them is missing."
related_field = ""
is_auto_fixable = False

Expand All @@ -30,14 +30,14 @@ def obtain_invalid_content_items(
)
for content_item in content_items
if (
content_item.data.get("isSilent")
content_item.data.get("issilent")
or any(
content_item.data.get(key, "").startswith("silent")
for key in ["name", "id"]
)
)
and not (
content_item.data.get("isSilent")
content_item.data.get("issilent")
and all(
content_item.data.get(key, "").startswith("silent")
for key in ["name", "id"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class IsSilentPlaybookRelationshipsValidator(BaseValidator[ContentTypes]):
error_message = (
"The {} is silent, but does not correspond to a silent {} in the pack."
)
related_field = "isSilent"
related_field = "issilent"
is_auto_fixable = False

def obtain_invalid_content_items(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class NoReadmeForSilentPlaybook(BaseValidator[ContentTypes]):
description = "A silent playbook is not allowed to have a README file."
rationale = "To ensure that silent playbooks do not appears in the documentation."
error_message = "A silent playbook is not allowed to have a README file."
related_field = "isSilent"
related_field = "issilent"
is_auto_fixable = False

def obtain_invalid_content_items(
Expand Down
2 changes: 1 addition & 1 deletion demisto_sdk/scripts/tests/validate_deleted_files_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_get_forbidden_deleted_files_deleting_silent_playbook(git_repo: Repo):
pack = git_repo.create_pack("Test")
silent_playbook = pack.create_playbook("name")

silent_playbook.yml.update({"isSilent": "true"})
silent_playbook.yml.update({"issilent": "true"})

git_repo.git_util.commit_files("create pack and silent playbook")
git_repo.git_util.repo.git.checkout("-b", "delete_playbook")
Expand Down
2 changes: 1 addition & 1 deletion demisto_sdk/scripts/validate_deleted_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def is_file_allowed_to_be_deleted_by_file_type(file_path: Path) -> bool:

def check_if_content_item_is_silent(file_dict):
if isinstance(file_dict, dict):
if file_dict.get("isSilent"):
if file_dict.get("issilent"):
return True
return False

Expand Down
Loading