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

Apply default docs edit rules to installation docs #2211

Merged
merged 4 commits into from
Jul 19, 2024

Conversation

guineveresaenger
Copy link
Contributor

Adds default doc edit rules plus a few more installation-doc specific edit rules to the plain docs parser functionality.

Fixes #2208

@guineveresaenger guineveresaenger requested review from a team and iwahbe July 19, 2024 21:36
@iwahbe iwahbe changed the title Guin/default doc edit rules Apply default docs edit rules to installation docs Jul 19, 2024
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 good to me, but CI is failing.

Comment on lines +30 to +34
contentBytes, err := applyEditRules([]byte(contentStr), docFile)
if err != nil {
return nil, err
}
return contentBytes, nil
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
contentBytes, err := applyEditRules([]byte(contentStr), docFile)
if err != nil {
return nil, err
}
return contentBytes, nil
return applyEditRules([]byte(contentStr), docFile)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in next PRs I'll be adding more here so I'll need the contentBytes for the next transformation 😅

Comment on lines 100 to 120
// Obtain default edit rules for documentation files
edits := defaultEditRules()

// Additional edit rules for installation files
installationFileEdits := editRules{
// Replace all "T/terraform" with "P/pulumi"
reReplace(`Terraform`, `Pulumi`),
reReplace(`terraform`, `pulumi`),
// Replace all "H/hashicorp" strings
reReplace(`Hashicorp`, `Pulumi`),
reReplace(`hashicorp`, `pulumi`),
// Reformat certain headers
reReplace(`The following arguments are supported`,
`The following configuration inputs are supported`),
reReplace(`Argument Reference`,
`Configuration Reference`),
reReplace(`block contains the following arguments`,
`input has the following nested fields`),
}

edits = append(edits, installationFileEdits...)
Copy link
Member

Choose a reason for hiding this comment

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

I think the shorter version reads better.

Suggested change
// Obtain default edit rules for documentation files
edits := defaultEditRules()
// Additional edit rules for installation files
installationFileEdits := editRules{
// Replace all "T/terraform" with "P/pulumi"
reReplace(`Terraform`, `Pulumi`),
reReplace(`terraform`, `pulumi`),
// Replace all "H/hashicorp" strings
reReplace(`Hashicorp`, `Pulumi`),
reReplace(`hashicorp`, `pulumi`),
// Reformat certain headers
reReplace(`The following arguments are supported`,
`The following configuration inputs are supported`),
reReplace(`Argument Reference`,
`Configuration Reference`),
reReplace(`block contains the following arguments`,
`input has the following nested fields`),
}
edits = append(edits, installationFileEdits...)
edits := append(defaultEditRules(),
// Replace all "T/terraform" with "P/pulumi"
reReplace(`Terraform`, `Pulumi`),
reReplace(`terraform`, `pulumi`),
// Replace all "H/hashicorp" strings
reReplace(`Hashicorp`, `Pulumi`),
reReplace(`hashicorp`, `pulumi`),
// Reformat certain headers
reReplace(`The following arguments are supported`,
`The following configuration inputs are supported`),
reReplace(`Argument Reference`,
`Configuration Reference`),
reReplace(`block contains the following arguments`,
`input has the following nested fields`),
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

works for me!

@guineveresaenger guineveresaenger force-pushed the guin/default-doc-edit-rules branch from d15f94b to c956c49 Compare July 19, 2024 21:48
@guineveresaenger guineveresaenger enabled auto-merge (squash) July 19, 2024 21:48
Copy link

codecov bot commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 69.69697% with 10 lines in your changes missing coverage. Please review.

Project coverage is 60.61%. Comparing base (99938e1) to head (c956c49).
Report is 2 commits behind head on master.

Files Patch % Lines
pkg/tfgen/installation_docs.go 69.69% 9 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2211      +/-   ##
==========================================
+ Coverage   60.59%   60.61%   +0.01%     
==========================================
  Files         356      356              
  Lines       46338    46368      +30     
==========================================
+ Hits        28079    28105      +26     
- Misses      16701    16705       +4     
  Partials     1558     1558              

☔ 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.

LGTM

@guineveresaenger guineveresaenger merged commit 59ab72c into master Jul 19, 2024
11 checks passed
@guineveresaenger guineveresaenger deleted the guin/default-doc-edit-rules branch July 19, 2024 23:12
@mjeffryes mjeffryes added this to the 0.107 milestone Jul 24, 2024
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v3.88.0.

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.

Installation instructions: Apply default doc edit rules and edit certain headers
4 participants