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

trim whitespace from comments before parsing #2287

Merged
merged 1 commit into from
Jun 22, 2022

Conversation

dominicbarnes
Copy link
Contributor

@dominicbarnes dominicbarnes commented Jun 2, 2022

I ran into a minor UX issue when copy-pasting a command for Atlantis. It looks like Github added an extra line before and after my comment, causing my comment to be silently ignored, after which I thought the apply was just hanging.

Based on the code comments around this, it looks like the intent was to at least allow trailing whitespace for this reason, so I reasoned it might be ok to allow leading whitespace as well. This change just trims whitespace from the left and right of the comment before parsing it, in an attempt to make things a little more flexible. I've added test cases for both leading whitespace and whitespace on both sides, in addition to the trailing whitespace test cases from before.

It's possible that blindling trimming whitespace could be problematic, so I'm open-minded to tightening this up if desired. This is my first contribution, so just learning the ropes here.

@dominicbarnes dominicbarnes requested a review from a team as a code owner June 2, 2022 00:20
@jamengual jamengual added provider/github bug Something isn't working labels Jun 7, 2022
Copy link
Contributor

@jamengual jamengual left a comment

Choose a reason for hiding this comment

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

LGTM

@jamengual
Copy link
Contributor

thanks for the contribution @dominicbarnes , could you pull from master to fix the failed tests?

@jamengual jamengual added the waiting-on-response Waiting for a response from the user label Jun 10, 2022
@dominicbarnes
Copy link
Contributor Author

Sorry about the delay, I'll do that right now.

@dominicbarnes
Copy link
Contributor Author

@jamengual looks like tests pass!

@jamengual jamengual merged commit 5da6962 into runatlantis:master Jun 22, 2022
@dominicbarnes dominicbarnes deleted the comment-trim-input branch June 22, 2022 18:56
krrrr38 pushed a commit to krrrr38/atlantis that referenced this pull request Dec 16, 2022
@nitrocode nitrocode added this to the v0.19.5 milestone Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working provider/github waiting-on-response Waiting for a response from the user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants