-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Github diff markdown formatting does not work properly for embedded YAML content #1899
Comments
is this still happening with |
Hello, @jamengual, Diff looks much better with Thanks! |
are you using ? |
Yes, we have env var ATLANTIS_ENABLE_DIFF_MARKDOWN_FORMAT set to true |
this one is hard to fix since you could have anything on that yaml. I think there is always going to be some discrepancies |
Any idea why If you drop it like: - diffKeywordRegex := regexp.MustCompile(`(?m)^( +)([-+~]\s)(.*)(\s=\s|\s->\s|<<|\{|\(known after apply\)|\[)(.*)`)
+ diffKeywordRegex := regexp.MustCompile(`(?m)^( +)([-+~]\s)(.*)(\s=\s|\s->\s|<<|\{|\(known after apply\))(.*)`) The diff becomes correct (https://go.dev/play/p/uTH9ogZJcCe). Note: test |
no idea, that was added a while ago
…On Tue, Sep 27, 2022 at 12:12 AM Dmytro Yurovskykh ***@***.***> wrote:
Any idea why [ was added to the regex -
https://github.com/runatlantis/atlantis/blob/master/server/events/models/models.go#L387
?
If you drop it like:
- diffKeywordRegex := regexp.MustCompile(`(?m)^( +)([-+~]\s)(.*)(\s=\s|\s->\s|<<|\{|\(known after apply\)|\[)(.*)`)+ diffKeywordRegex := regexp.MustCompile(`(?m)^( +)([-+~]\s)(.*)(\s=\s|\s->\s|<<|\{|\(known after apply\))(.*)`)
The diff becomes correct. Note: test
TestRenderProjectResultsWithEnableDiffMarkdownFormat passes with ^ change
too.
—
Reply to this email directly, view it on GitHub
<#1899 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3ERF6BGLOOW2OLCSYSKDWAKM7FANCNFSM5IB62SRA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
you can send a PR if you think that is a better regex.
On Tue, Sep 27, 2022 at 12:25 AM Pepe (Jose) Amengual <
***@***.***> wrote:
… no idea, that was added a while ago
On Tue, Sep 27, 2022 at 12:12 AM Dmytro Yurovskykh <
***@***.***> wrote:
> Any idea why [ was added to the regex -
> https://github.com/runatlantis/atlantis/blob/master/server/events/models/models.go#L387
> ?
>
> If you drop it like:
>
> - diffKeywordRegex := regexp.MustCompile(`(?m)^( +)([-+~]\s)(.*)(\s=\s|\s->\s|<<|\{|\(known after apply\)|\[)(.*)`)+ diffKeywordRegex := regexp.MustCompile(`(?m)^( +)([-+~]\s)(.*)(\s=\s|\s->\s|<<|\{|\(known after apply\))(.*)`)
>
> The diff becomes correct. Note: test
> TestRenderProjectResultsWithEnableDiffMarkdownFormat passes with ^
> change too.
>
> —
> Reply to this email directly, view it on GitHub
> <#1899 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAQ3ERF6BGLOOW2OLCSYSKDWAKM7FANCNFSM5IB62SRA>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
Sure, I've asked an engineer from my team to work on the PR. |
no, I tried that before and I can only assign to people on the maintainer
group, sorry
…On Tue, Sept 27, 2022, 5:33 a.m. VladimirSt-TPE ***@***.***> wrote:
Could you assign the issue to me?
—
Reply to this email directly, view it on GitHub
<#1899 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3ERANSB4MZ5UTHTP7MITWALSQLANCNFSM5IB62SRA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I think I added it to catch situations where the change is like
so it'd catch the |
@pauloconnor If you are aware of other patterns to be covered/tested, please, let @VladimirSt-XP know and he will try adding it to his #2551 |
We probably need a test for the It would help if we commented the regex too so each significant character has a reason for being there. |
Does the github diff markdown work now for embedded YAML content ? @dyurovskykh-tivo @pauloconnor |
@nitrocode It should work for anything covered in tests but I am not sure it covers everything. Consider adding more tests to cover more use cases. |
Sorry, my question was more for the lack of functionality described in the original post above and not the tests themselves. Is the markdown formatting working properly now in the latest atlantis for embedded YAML? or should we keep this open? What are the other edge cases? |
ah, I think this should be fixed by #2551 |
Community Note
Overview of the Issue
Github diff markdown formatter (added with #1751) does not work properly for embedded YAML content because it incorrectly treats hyphen
-
symbol, used to denote an array element in YAML, as diff removal.Reproduction Steps
Example of Terraform code:
GitHub comment created by Atlantis:
GitHub comment source:
Logs
Not available.
Environment details
The text was updated successfully, but these errors were encountered: