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

feat: empty string warning #36

Closed
wants to merge 8 commits into from

Conversation

Keyrxng
Copy link
Member

@Keyrxng Keyrxng commented Mar 18, 2024

Resolves #31

  • Identifies empty strings and posts a comment onto the pull request
  • updates that comment when changes are made
  • removes it once all are fixed

QA: ubq-testing/bot-ai#31

Copy link
Contributor

github-actions bot commented Mar 18, 2024

Lines Statements Branches Functions
Coverage: 80%
80% (4/5) 100% (0/0) 66.66% (2/3)

JUnit

Tests Skipped Failures Errors Time
1 0 💤 0 ❌ 0 🔥 2.692s ⏱️
Coverage Report (80%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files8010066.6680 
   main.ts8010066.66809

@Keyrxng
Copy link
Member Author

Keyrxng commented Mar 18, 2024

This was a mistake, meant to open it against my own dev branch and I don't have the option to close as unplanned lmao

@gentlementlegen gentlementlegen marked this pull request as draft March 18, 2024 01:50
@gentlementlegen
Copy link
Member

@Keyrxng Just use this pull request as the final one, I converted it to a draft in the meantime.

@Keyrxng Keyrxng marked this pull request as ready for review March 21, 2024 11:10
@Keyrxng
Copy link
Member Author

Keyrxng commented Mar 21, 2024

@FernandVEYRIER ready when you are mate

@ubiquibot-continuous-deploys
Copy link

ubiquibot-continuous-deploys bot commented Mar 21, 2024

@Keyrxng
Copy link
Member Author

Keyrxng commented Mar 25, 2024

id: find_empty_strings
run: |
# Find empty strings and mark them explicitly
output=$(grep -Rn --include=\*.ts "''\|\"\"" --exclude-dir={node_modules,dist,out,tests} . || true)
Copy link
Member

Choose a reason for hiding this comment

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

You forgot about double back tick ``

Copy link
Member Author

@Keyrxng Keyrxng Mar 25, 2024

Choose a reason for hiding this comment

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

fucksake I wish I had seen this earlier but as I said before, me and bash not so great but I'm no quitter 😂

Took me way longer than I wanted it to, it's not 100% perfect neither but it's ~90-95% accurate (my shortcomings relating to bash scripting is the reason why I haven't got it 100%, scripting syntax and sanitization proving tough trying to capture every variation I could (.tsx being the main point of failure re: {""} but in tsx terms that's common syntax so I wasn't sure to even capture that but I did anyway)

  • add empty strings ubq-testing/bot-ai#46

  • seeing as it's a commit comment it's tied to each commit so if "" is used in commit 1 and not resolved in commit 2 then commit 3 will retain the comment symbol but will not receive a comment as the change happened two commits ago, only once "" are removed will the comment symbol disappear. (the 2nd last commit is proof of this, having an comment symbol but no actual comment)

  • it's diffed from incoming commit > most recent, the reason why is because if "" is used in commit 1 and unresolved in commit 2 then every single commit following will receive a comment (spamming if there are multiple) but it won't be tied to any file because the change is in commit 1 so it's just clutter and noise)

  • As for implementing an ignore switch, the wf runs on a push to PR so, it only checks for empty strings that are being pushed into the PR not ones that existed prior (unless edited). Disabling prior to running would be .env or secret based wouldn't it on a per repo basis? I can't think of how to disable it any other way of the top of my head

@rndquu
Copy link
Member

rndquu commented May 28, 2024

@Keyrxng Check this PR and this commit that assigns js variables empty strings.

The expected behaviour is that Empty string annotations should've been added, right?

@Keyrxng
Copy link
Member Author

Keyrxng commented May 29, 2024

strange

it's identified the empty strings and their location and the GitHub UI is showing two comments but the comments are nowhere to be seen... any ideas why that might be off the top of your head? I'll see if I can debug the issue. I see it missed the one in static/main all together.

image

image

@rndquu
Copy link
Member

rndquu commented May 29, 2024

any ideas why that might be off the top of your head?

Hard to say what went wrong

@ubiquibot ubiquibot bot closed this Jun 4, 2024
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.

Empty String "" Code Review Warning Annotation
4 participants