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

Fix Generate Docs Missing Argument Descriptions #4320

Merged

Conversation

kgal-pan
Copy link
Contributor

@kgal-pan kgal-pan commented Jun 3, 2024

Related Issues

fixes:https://jira-dc.paloaltonetworks.com/browse/CIAC-10587

Description

When generating an integration documentation where the integration YML had a command with missing argument descriptions, the SDK would crash:

INFO:demisto-sdk:[red]Error: 'NoneType' object has no attribute 'replace'[/red]
--- Logging error ---
Traceback (most recent call last):
  File "/home/runner/.local/share/virtualenvs/actions-adXIK6GM/lib/python3.8/site-packages/demisto_sdk/commands/init/contribution_converter.py", line 496, in convert_contribution_to_pack
    generated_readmes = self.generate_readmes_for_new_content_pack(
  File "/home/runner/.local/share/virtualenvs/actions-adXIK6GM/lib/python3.8/site-packages/demisto_sdk/commands/init/contribution_converter.py", line 401, in generate_readmes_for_new_content_pack
    readme = self.generate_readme_for_pack_content_item(
  File "/home/runner/.local/share/virtualenvs/actions-adXIK6GM/lib/python3.8/site-packages/demisto_sdk/commands/init/contribution_converter.py", line 362, in generate_readme_for_pack_content_item
    generate_integration_doc(
  File "/home/runner/.local/share/virtualenvs/actions-adXIK6GM/lib/python3.8/site-packages/demisto_sdk/commands/generate_docs/generate_integration_doc.py", line 585, in generate_integration_doc
    ) = generate_commands_section(
  File "/home/runner/.local/share/virtualenvs/actions-adXIK6GM/lib/python3.8/site-packages/demisto_sdk/commands/generate_docs/generate_integration_doc.py", line 858, in generate_commands_section
    cmd_section, cmd_errors = generate_single_command_section(
  File "/home/runner/.local/share/virtualenvs/actions-adXIK6GM/lib/python3.8/site-packages/demisto_sdk/commands/generate_docs/generate_integration_doc.py", line 952, in generate_single_command_section
    string_escape_md(argument_description, True, True),
  File "/home/runner/.local/share/virtualenvs/actions-adXIK6GM/lib/python3.8/site-packages/demisto_sdk/commands/generate_docs/common.py", line 214, in string_escape_md
    st = html.escape(st, quote=False)
  File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/html/__init__.py", line 19, in escape
    s = s.replace("&", "&") # Must be done first!
AttributeError: 'NoneType' object has no attribute 'replace'

Seen in demisto/content#34659 and demisto/content#34400.

This PR sets a default value (empty string) when the description field is missing.

@kgal-pan kgal-pan requested a review from RotemAmit June 3, 2024 08:33
Copy link

github-actions bot commented Jun 3, 2024

Changelog(s) in markdown:

  • Fix an issue in gen-docs when integration commands arguments are missing descriptions. #4320

Copy link
Contributor

@RotemAmit RotemAmit left a comment

Choose a reason for hiding this comment

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

Nice work!

.changelog/4320.yml Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Jun 3, 2024

Changelog(s) in markdown:

  • Fix an issue in generate-docs when integration commands arguments are missing descriptions. #4320

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.

2 participants