8000 use error_code to do "is_signed_tag" check to avoid language issue by Lee-W · Pull Request #543 · commitizen-tools/commitizen · GitHub
[go: up one dir, main page]

Skip to content

use error_code to do "is_signed_tag" check to avoid language issue #543

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

Merged
merged 1 commit into from
Aug 7, 2022

Conversation

Lee-W
Copy link
Member
@Lee-W Lee-W commented Aug 2, 2022

Description

as title

Checklist

  • Add test cases to all the changes you introduce
  • Run ./scripts/format and ./scripts/test locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

pass all the test cases even when LC_ALL is set to non-English

Steps to Test This Pull Request

  1. export LC_ALL=zh_TW.UTF-8
  2. ./script/test

Additional context

#542

@Lee-W Lee-W requested a review from woile August 2, 2022 15:36
@codecov
Copy link
codecov bot commented Aug 2, 2022

Codecov Report

Merging #543 (ae5a98e) into master (37505ef) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #543      +/-   ##
==========================================
+ Coverage   98.26%   98.32%   +0.05%     
==========================================
  Files          39       39              
  Lines        1556     1551       -5     
==========================================
- Hits         1529     1525       -4     
+ Misses         27       26       -1     
Flag Coverage Δ
unittests 98.32% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
commitizen/__version__.py 100.00% <100.00%> (ø)
commitizen/git.py 100.00% <100.00%> (ø)
commitizen/changelog.py 100.00% <0.00%> (+0.56%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@woile
Copy link
Member
woile commented Aug 2, 2022

I wonder if there's a language agnostic way of doing this, instead of forcing english into the equation 🤔

@bhelgs
Copy link
Contributor
bhelgs commented Aug 2, 2022

@woile

I wonder if there's a language agnostic way of doing this, instead of forcing english into the equation 🤔

  • git tag -a testtag
  • git tag -v testtag || echo $?

The above exit code is 1... so it appears the exit code is 1 for annotated tag and 0 for signed tag.

@bhelgs
Copy link
Contributor
bhelgs commented Aug 3, 2022

side note, tmp_commitizen_project_with_gpg is creating a key every time the unit tests run. I wonder if there is a way to make them temporary.

@Lee-W Lee-W mentioned this pull request Aug 3, 2022
4 tasks
@Lee-W
Copy link
Member Author
Lee-W commented Aug 3, 2022

side note, tmp_commitizen_project_with_gpg is creating a key every time the unit tests run. I wonder if there is a way to make them temporary.

Maybe we could use a context manager to remove the created key after running testing?

@gpongelli
Copy link
Contributor
gpongelli commented Aug 5, 2022

@woile

I wonder if there's a language agnostic way of doing this, instead of forcing english into the equation 🤔

* `git tag -a testtag`

* `git tag -v testtag || echo $?`

The above exit code is 1... so it appears the exit code is 1 for annotated tag and 0 for signed tag.

or also link git verify-tag <tagname> (that also print things to stdout) and then echo $? :

  • 0 means signed tag
  • 1 means not signed

Sorry but I did not investigate further when I created that branch.

@Lee-W
Copy link
Member Author
Lee-W commented Aug 7, 2022

Thanks @bhelgs and @gpongelli ! Let me update the code with the methods you provided!

@Lee-W
Copy link
Member Author
Lee-W commented Aug 7, 2022

@woile I think this one is now ready to be reviewed 🎉

@Lee-W Lee-W changed the title set LC_ALL to en_US.UTF-8 before checking signed tag use error_code to do "is_signed_tag" check to avoid language issue Aug 7, 2022
@gpongelli
Copy link
Contributor

side note, tmp_commitizen_project_with_gpg is creating a key every time the unit tests run. I wonder if there is a way to make them temporary.

Maybe we could use a context manager to remove the created key after running testing?

PR #547 handles this ;-)

@woile woile merged commit 78f3472 into master Aug 7, 2022
@woile woile deleted the 542 branch August 7, 2022 06:44
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.

4 participants
0