-
Notifications
You must be signed in to change notification settings - Fork 87
Add rm103 and validator test #5094
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
Open
itssapir
wants to merge
15
commits into
master
Choose a base branch
from
add-no-readme-validation-for-internal-scripts
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+88
−0
Open
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
026e989
Add rm118 and validator test
itssapir 13faf63
Add changelog file
itssapir 2cd7c98
ruff
itssapir f3902b1
ruff
itssapir b3e27e9
update validation config
itssapir df66cb9
Remove redundant Union and script checks
itssapir 0cfdc36
Update demisto_sdk/commands/validate/validators/RM_validators/RM118_n…
itssapir bb149f1
Merge branch 'master' into add-no-readme-validation-for-internal-scripts
itssapir 9129b69
ruff
itssapir ed72184
Code review fixes
itssapir 4ceaaba
Merge branch 'master' into add-no-readme-validation-for-internal-scripts
itssapir ba321ca
Fix changelog
itssapir a6ccf4f
Fix error code mismatch
itssapir 2d74704
Fix import
itssapir 9da4877
ruff
itssapir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,4 @@ | ||
| changes: | ||
| - description: Added RM118 to validate that internal scripts do not have a readme file. | ||
| type: internal | ||
| pr_number: 5094 |
This file contains hidden or 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 hidden or 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
36 changes: 36 additions & 0 deletions
36
demisto_sdk/commands/validate/validators/RM_validators/RM118_no_readme_internal_scripts.py
This file contains hidden or 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,36 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import Iterable, List | ||
|
|
||
| from demisto_sdk.commands.content_graph.objects.script import Script | ||
| from demisto_sdk.commands.content_graph.parsers.related_files import RelatedFileType | ||
| from demisto_sdk.commands.validate.validators.base_validator import ( | ||
| BaseValidator, | ||
| ValidationResult, | ||
| ) | ||
|
|
||
|
|
||
| class NoReadmeInternalScripts(BaseValidator[Script]): | ||
itssapir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| error_code = "RM118" | ||
| description = "Validates that there's no readme file for internal scripts." | ||
| rationale = "Internal scripts should not have a visible readme in xsoar.pan.dev." | ||
| error_message = "The script '{0}' is an internal script. Please remove the README.md file in the content item's directory." | ||
| related_field = "readme" | ||
| related_file_type = [RelatedFileType.README] | ||
|
|
||
| def obtain_invalid_content_items( | ||
| self, content_items: Iterable[Script] | ||
itssapir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) -> List[ValidationResult]: | ||
| return [ | ||
| ValidationResult( | ||
| validator=self, | ||
| message=self.error_message.format(content_item.name), | ||
| content_object=content_item, | ||
| ) | ||
| for content_item in content_items | ||
| if ( | ||
| getattr(content_item, "is_internal", False) | ||
| or getattr(content_item, "is_llm", False) | ||
itssapir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
| and content_item.readme.exist | ||
| ] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.