Fix logic to find start index for H3 headers in issue forms#58
Merged
edumserrano merged 1 commit intomainfrom Jul 17, 2023
Merged
Fix logic to find start index for H3 headers in issue forms#58edumserrano merged 1 commit intomainfrom
edumserrano merged 1 commit intomainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #58 +/- ##
==========================================
+ Coverage 91.22% 91.48% +0.26%
==========================================
Files 27 27
Lines 262 270 +8
Branches 23 24 +1
==========================================
+ Hits 239 247 +8
Misses 17 17
Partials 6 6
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The previous logic to find the start index of an H3 header used
string.IndexOfto find the first occurrence of the header value. The problem with this is that if the GitHub issue template contains labels that start with the same value then this logic will fail to properly identify all the the H3 headers.Consider this GitHub issue form template:
When a GitHub issue is created using the above template then the app would fail to parse the value for the label with id
nuget-id-2because it would do<github issue body>.indexOf("### What")and it would return the index for the label with idnuget-idbecause it also starts with### What.To fix this we still use
string.IndexOfbut we match on an entire line, meaning it has to have the header value followed by a new line character.