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: verify --from and --to parameters to be valid git pointer #248

Merged
merged 4 commits into from
Mar 30, 2022

Conversation

denisab85
Copy link
Contributor

What does this pull request contains

The 'from' and 'to' parameters will be verified to be valid git commits

  • Added for new features.
  • Changed for changes in existing functionality.
  • Deprecated for soon-to-be removed features.
  • Removed for now removed features.
  • Fixed for any bug fixes.
  • Security in case of vulnerabilities.

Explain your changes


Does this close any currently open issues?


closes #

  • Jest test to check the fix is applied are added.

Any particular element to being able to test locally


Any other comments?


Where has this been tested?


Operating System:

yarn version:

node version:

git version:

sfdx version:

sgd plugin version:

@codecov
Copy link

codecov bot commented Feb 22, 2022

Codecov Report

Merging #248 (fa3dd68) into main (f028375) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #248   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines          614       621    +7     
=========================================
+ Hits           614       621    +7     
Impacted Files Coverage Δ
src/utils/childProcessUtils.js 100.00% <100.00%> (ø)
src/utils/cliHelper.js 100.00% <100.00%> (ø)
src/utils/gitConstants.js 100.00% <100.00%> (ø)
src/utils/repoSetup.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f028375...fa3dd68. Read the comment docs.

Copy link
Owner

@scolladon scolladon left a comment

Choose a reason for hiding this comment

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

Nice contribution, thanks

I have a few remarks
and also it requires unit test for the case where to and from are a git sha and not a git sha
I can help on that, just give access to the repo if you want me to write the tests

src/main.js Outdated Show resolved Hide resolved
src/utils/cliHelper.js Outdated Show resolved Hide resolved
@scolladon
Copy link
Owner

Thanks for this contribution @denisab85 !

We currently do not have this kind of usage issue reported but I consider it a nice way to tell the user what is wrong early.
Do you have encounter an issue while trying to use the plugin with a non git sha pointer ?

@denisab85
Copy link
Contributor Author

Thanks for this contribution @denisab85 !

We currently do not have this kind of usage issue reported but I consider it a nice way to tell the user what is wrong early. Do you have encounter an issue while trying to use the plugin with a non git sha pointer ?

A colleague of mine faced this issue when trying to use a shortened sha.

@scolladon scolladon changed the title feat: 'from' and 'to' will be verified to be valid git commits feat: verify --from and --to parameters to be valid git pointer Feb 23, 2022
@scolladon
Copy link
Owner

scolladon commented Feb 24, 2022

@denisab85 we have merged a big PR with a new way to deal with IO.
We now no longer use Sync method
In this PR the code uses spawnSync it will need to be written using async/await and spawn.
You can look at the method _getStreamContent in the repoSetup.js file to know how to do it. You could even refactor and extract it in its own file instead of duplicating the code
There is plenty exemple in the code on how to test it and how to mock child_process.spawn, feel free to ask any questions I'll be there to help, we could even find some times to pair if you'd like

@denisab85
Copy link
Contributor Author

@denisab85 we have merged a big PR with a new way to deal with IO.
We now no longer use Sync method

Thanks for letting me know. I merged in from upstream.
I'll try to deal with it myself. Will let you know if I need help.

@scolladon
Copy link
Owner

Hi @denisab85

Could you give me access to your fork ?
I would like to contribute

@denisab85
Copy link
Contributor Author

denisab85 commented Mar 9, 2022 via email

@scolladon
Copy link
Owner

Hi @denisab85 !

Thanks for giving me access
No problem at all ! I'll contribute a little when I have time (probably next week)
Sorry to ear that about your difficulty to concentrate, I totally understand... Weird and most difficult time...

Take care buddy

@scolladon
Copy link
Owner

@mehdisfdc this one will require in depth smoke testing.
It should not block the user from using the plugin because of a false negative commit check.
It would stop the CLI execution and cause a usage regression

Copy link
Owner

@scolladon scolladon left a comment

Choose a reason for hiding this comment

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

LGTM

scolladon
scolladon previously approved these changes Mar 28, 2022
Copy link
Owner

@scolladon scolladon left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@mehdicherf mehdicherf left a comment

Choose a reason for hiding this comment

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

LGTM

@codeclimate
Copy link

codeclimate bot commented Mar 30, 2022

Code Climate has analyzed commit fa3dd68 and detected 0 issues on this pull request.

View more on Code Climate.

@scolladon scolladon merged commit 6c8accc into scolladon:main Mar 30, 2022
@scolladon scolladon deleted the feature/validate_commit_sha branch March 30, 2022 13:55
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.

3 participants