Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Adding shellcheck to openverse-api #922

Merged
merged 17 commits into from
Oct 4, 2022

Conversation

MustkimKhatik
Copy link
Contributor

@MustkimKhatik MustkimKhatik commented Sep 16, 2022

Adding shell check to openverse-api repo

Signed-off-by: MustkimKhatik <83959074+MustkimKhatik@users.noreply.github.com>
@MustkimKhatik MustkimKhatik requested a review from a team as a code owner September 16, 2022 07:23
@openverse-bot openverse-bot added the 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work label Sep 16, 2022
@krysal
Copy link
Member

krysal commented Sep 16, 2022

@MustkimKhatik Could you edit your comment to fill the Pull Request template? Thanks!

@MustkimKhatik
Copy link
Contributor Author

@MustkimKhatik Could you edit your comment to fill the Pull Request template? Thanks!

Sure.

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

ShellCheck has reported several changes that need to be made for the lint check to pass.

.pre-commit-config.yaml Outdated Show resolved Hide resolved
@MustkimKhatik
Copy link
Contributor Author

Sure @dhruvkb I'll do it

@dhruvkb
Copy link
Member

dhruvkb commented Sep 23, 2022

@MustkimKhatik there are still some lint changes needed. Do you need help fixing those?

@MustkimKhatik
Copy link
Contributor Author

@MustkimKhatik there are still some lint changes needed. Do you need help fixing those?

Yes @dhruvkb , I'll do them by myself as I got the time

syntax correction in run_test.sh
Some corrections in run_test
some corrections in run_test
syntax correction in ingestion_sever/run_test.sh
syntax correction in update_mocks.sh
syntax correction in run_test.sh
syntax correction in load_sample.sh
@MustkimKhatik
Copy link
Contributor Author

hey @dhruvkb, can you look into the error it detecting?

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

Good to go from my end 👍! Feel free to work on something else while we wait for a second approval.

@MustkimKhatik
Copy link
Contributor Author

Good to go from my end 👍! Feel free to work on something else while we wait for a second approval.

Okay sure! Thanks for helping me out with it.

@AetherUnbound AetherUnbound added 🟩 priority: low Low priority and doesn't need to be rushed ✨ goal: improvement Improvement to an existing user-facing feature 🤖 aspect: dx Concerns developers' experience with the codebase and removed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Oct 4, 2022
Comment on lines 23 to 25
printf "%s:-) All tests passed${endcol}\n" "${green}"
else
printf "${red}:'( Some tests did not pass${endcol}\n"
printf "\n\n%s:'( Some tests did not pass${endcol}\n" "${red}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, why were these changes made? Was that part of the spellcheck? I'm now seeing different output (this should be the color green):
image

Copy link
Member

@dhruvkb dhruvkb Oct 4, 2022

Choose a reason for hiding this comment

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

IIRC it was a ShellCheck recommendation to use %s, I'll look into it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep it was ShellCheck recommendation, and I guess ANSI color code declared was wrong, instead of red="\e[31m" it should be red="\e[41m" and for green instead of green="\e[32m" it should be green="\e[42m". something mentioned here

Copy link
Member

Choose a reason for hiding this comment

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

@MustkimKhatik the color codes were correct, the issue was that %s escapes the ANSI code which makes them lose their effect. Using %b instead fixes the issue as seen in b9b21bd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MustkimKhatik the color codes were correct, the issue was that %s escapes the ANSI code which makes them lose their effect. Using %b instead fixes the issue as seen in b9b21bd.

Oh alright, that must clear all the things 🙌

Copy link
Contributor

Choose a reason for hiding this comment

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

That fixed it for me, thanks @dhruvkb!

Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

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

Thank you for the changes @MustkimKhatik! This worked great locally

@AetherUnbound AetherUnbound merged commit 043b319 into WordPress:main Oct 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🤖 aspect: dx Concerns developers' experience with the codebase ✨ goal: improvement Improvement to an existing user-facing feature 🟩 priority: low Low priority and doesn't need to be rushed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants