Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8ec1f6d
added agentix action to test tools
mayyagoldman Oct 15, 2025
f37b3ba
changelog
mayyagoldman Oct 15, 2025
cff1ecd
pre-commit
mayyagoldman Oct 15, 2025
c9448bd
Update demisto_sdk/commands/validate/tests/test_tools.py
mayyagoldman Oct 15, 2025
05096c2
pr comment
mayyagoldman Oct 15, 2025
e8a437d
Merge remote-tracking branch 'origin/CRTX-189927/action' into CRTX-18…
mayyagoldman Oct 15, 2025
5307947
pr comment
mayyagoldman Oct 15, 2025
57bc3d3
pre commit
mayyagoldman Oct 15, 2025
651c1da
https://github.com/demisto/demisto-sdk/pull/5088#discussion_r2432284348
mayyagoldman Oct 15, 2025
aa17797
kobys comments
mayyagoldman Oct 15, 2025
00a2c0d
pre commit
mayyagoldman Oct 15, 2025
8a92cd7
pre commit
mayyagoldman Oct 15, 2025
2903544
test path
mayyagoldman Oct 15, 2025
0884d8d
remove extra
mayyagoldman Oct 15, 2025
30e5c0a
ag105 seperate pr
mayyagoldman Oct 15, 2025
7734d3c
changelog
mayyagoldman Oct 15, 2025
2c69f32
Merge branch 'master' into CRTX-194111
mayyagoldman Oct 15, 2025
4c1da13
make path
mayyagoldman Oct 15, 2025
2b13f0d
Merge remote-tracking branch 'origin/CRTX-194111' into CRTX-194111
mayyagoldman Oct 15, 2025
8f6f982
make path
mayyagoldman Oct 15, 2025
8044874
make path
mayyagoldman Oct 15, 2025
5410f79
make path
mayyagoldman Oct 15, 2025
4e6d676
make path
mayyagoldman Oct 15, 2025
6a87455
fixes
mayyagoldman Oct 15, 2025
0c970f4
Merge branch 'CRTX-189927/action' into CRTX-194111
mayyagoldman Oct 15, 2025
83580a2
Merge branch 'master' into CRTX-189927/action
mayyagoldman Oct 15, 2025
c3d60b8
pre commit
mayyagoldman Oct 15, 2025
74a21ed
pre commit
mayyagoldman Oct 15, 2025
ec45f41
Merge branch 'CRTX-189927/action' into CRTX-194111
mayyagoldman Oct 15, 2025
0a4f193
Merge branch 'master' into CRTX-194111
mayyagoldman Oct 16, 2025
9414811
modifired etsts
mayyagoldman Oct 16, 2025
56c20ee
Merge remote-tracking branch 'origin/CRTX-194111' into CRTX-194111
mayyagoldman Oct 16, 2025
a725dc7
pre commit
mayyagoldman Oct 16, 2025
c3e085c
pre commit
mayyagoldman Oct 16, 2025
1f8891f
Merge branch 'master' into CRTX-194111
mayyagoldman Oct 21, 2025
384bd33
Merge branch 'master' into CRTX-194111
mayyagoldman Nov 2, 2025
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/5096.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- description: Added a new AG105 validation.
type: internal
pr_number: 5096
2 changes: 2 additions & 0 deletions demisto_sdk/commands/validate/sdk_validation_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ select = [
"AG101",
"AG102",
"AG103",
"AG105",
"DS100",
"DS101",
"DS105",
Expand Down Expand Up @@ -323,6 +324,7 @@ select = [
"AG101",
"AG102",
"AG103",
"AG105",
"PA100",
"PA101",
"PA102",
Expand Down
57 changes: 57 additions & 0 deletions demisto_sdk/commands/validate/tests/AG_validators_test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
from pathlib import Path

import pytest

from demisto_sdk.commands.content_graph.objects.agentix_action import AgentixAction
from demisto_sdk.commands.content_graph.objects.agentix_agent import AgentixAgent
from demisto_sdk.commands.content_graph.objects.script import Script
from demisto_sdk.commands.validate.tests.test_tools import create_agentix_action_object
from demisto_sdk.commands.validate.validators.AG_validators.AG100_is_forbidden_content_item import (
IsForbiddenContentItemValidator,
)
from demisto_sdk.commands.validate.validators.AG_validators.AG101_is_correct_mp import (
IsCorrectMPValidator,
)
from demisto_sdk.commands.validate.validators.AG_validators.AG105_is_display_name_valid import (
IsDisplayNameValidValidator,
)


def test_is_forbidden_content_item():
Expand Down Expand Up @@ -215,3 +221,54 @@ def test_is_correct_marketplace():
assert results[0].message == (
"The following Agentix related content item 'test' should have only marketplace 'platform'."
)


@pytest.mark.parametrize(
"content_items, expected_number_of_failures",
[
# Case 1: All valid AgentixAction displays
(
[
create_agentix_action_object(paths=["display"], values=["ValidName"]),
create_agentix_action_object(paths=["display"], values=["Valid_Name"]),
create_agentix_action_object(paths=["display"], values=["Valid-Name"]),
create_agentix_action_object(paths=["display"], values=["Valid Name"]),
create_agentix_action_object(paths=["display"], values=["A123"]),
create_agentix_action_object(paths=["display"], values=["A_1-2 3"]),
],
0,
),
# Case 2: One invalid (starts with digit), one valid
(
[
create_agentix_action_object(paths=["display"], values=["1Invalid"]),
create_agentix_action_object(paths=["display"], values=["ValidName"]),
],
1,
),
# Case 3: Invalid (contains forbidden character)
([create_agentix_action_object(paths=["display"], values=["Invalid!"])], 1),
# Case 4: Multiple invalid
(
[
create_agentix_action_object(paths=["display"], values=["1Invalid"]),
create_agentix_action_object(paths=["display"], values=["Invalid!"]),
create_agentix_action_object(paths=["display"], values=["ValidName"]),
],
2,
),
],
)
def test_IsDisplayNameValid_obtain_invalid_content_items(
content_items, expected_number_of_failures
):
"""
Given
- AgentixAction content_items with various display values.
When
- Calling the IsDisplayNameValid.obtain_invalid_content_items function.
Then
- Make sure the right amount of failure return.
"""
results = IsDisplayNameValidValidator().obtain_invalid_content_items(content_items)
assert len(results) == expected_number_of_failures
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from __future__ import annotations

import re
from typing import Iterable, List

from demisto_sdk.commands.content_graph.objects.agentix_action import AgentixAction
from demisto_sdk.commands.validate.validators.base_validator import (
BaseValidator,
ValidationResult,
)

ContentTypes = AgentixAction


class IsDisplayNameValidValidator(BaseValidator[ContentTypes]):
error_code = "AG105"
description = "AgentixAction display value must start with a letter (either lower or upper case) and contain only the following characters: lowercase letters, uppercase letters, digits, underscores, hyphens, spaces."
rationale = "Display names must be user-friendly and conform to standards."
error_message = "The following Agentix action display value is invalid: {0}. \n AgentixAction display value must start with a letter (either lower or upper case) and contain only the following characters: lowercase letters, uppercase letters, digits, underscores, hyphens, spaces."

related_field = "display"
is_auto_fixable = False

AGENTIX_ACTION_DISPLAY_NAME_PATTERN = re.compile(r"^[A-Za-z][A-Za-z0-9_\- ]*$")

def obtain_invalid_content_items(
self, content_items: Iterable[ContentTypes]
) -> List[ValidationResult]:
validation_results = []
for content_item in content_items:
display_name = getattr(content_item, "display_name", None)
if not display_name or not self.AGENTIX_ACTION_DISPLAY_NAME_PATTERN.match(
display_name
):
validation_results.append(
ValidationResult(
validator=self,
message=self.error_message.format(
display_name,
),
content_object=content_item,
)
)
return validation_results
Loading