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

Do not fail conversion of non-HCL fenced markdown snippets #1842

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Apr 4, 2024

Fix #1839

The documentation pipeline was looking for Markdown code-fenced blocks. In the case where they specify terraform or hcl
as the language, it is clear that they should be converted. However the unmarked blocks may be carrying code that needs
to be converted or else they can be carrying text that needs to be displayed with a fixed font.

This change introduces a regex-based guess that allows non-Terraform code snippets to pass through as-is.

Fixes the following AWS build warnings (107-118 total, getting numbers a bit mixed up):

   1 warning: failed to convert HCL for #/types/aws:autoscaling/GroupMixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements:GroupMixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements/acceleratorManufacturers to csharp: <nil>: unexpected HCL snippet in Convert;

The documentation pipeline was looking for Markdown code-fenced blocks. In the case where they specify terraform or hcl
as the language, it is clear that they should be converted. However the unmarked blocks may be carrying code that needs
to be converted or else they can be carrying text that needs to be displayed with a fixed font.

This change introduces a regex-based guess that allows non-Terraform code snippets to pass through as-is.

Fixes the following AWS build warnings (107 total):

```
   1 warning: failed to convert HCL for #/types/aws:autoscaling/GroupMixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements:GroupMixedInstancesPolicyLaunchTemplateOverrideInstanceRequirements/acceleratorManufacturers to csharp: <nil>: unexpected HCL snippet in Convert;
```
Copy link

codecov bot commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 55.55556% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 60.37%. Comparing base (0441ef3) to head (37596be).

Files Patch % Lines
pkg/tfgen/docs.go 62.50% 3 Missing ⚠️
pkg/tfgen/convert_cli.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1842      +/-   ##
==========================================
- Coverage   60.82%   60.37%   -0.45%     
==========================================
  Files         303      310       +7     
  Lines       42426    42809     +383     
==========================================
+ Hits        25804    25846      +42     
- Misses      15149    15500     +351     
+ Partials     1473     1463      -10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me.

@t0yv0 t0yv0 merged commit 88fafd0 into master Apr 4, 2024
10 checks passed
@t0yv0 t0yv0 deleted the t0yv0/fix-1839 branch April 4, 2024 17:54
Copy link
Contributor

@guineveresaenger guineveresaenger left a comment

Choose a reason for hiding this comment

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

Nice refinement! Thank you.

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.

AWS build warning: unexpected HCL snippet in Convert (x118)
3 participants