-
Notifications
You must be signed in to change notification settings - Fork 172
#3134 Update & Review Packages for git-repo-scanner #3316
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for docs-securecodebox ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
b8c2f6a to
4944747
Compare
|
Hi @Weltraumschaf , since this PR has been assigned to me, I wanted to clarify the expectations. Should I address the recommendations from @sonarqubecloud, or is my role primarily to review the changes and provide feedback? |
Hi @kart-u, thanks for submitting this PR. Your assignement does not mean more than that you work on this PR. We'll first need to review your PR. |
|
Thanks for clarifying! I’ll wait for your review before making any further updates. |
scanners/git-repo-scanner/scanner/git_repo_scanner/github_scanner.py
Outdated
Show resolved
Hide resolved
scanners/git-repo-scanner/scanner/git_repo_scanner/github_scanner.py
Outdated
Show resolved
Hide resolved
| if start_time and end_time and repo.pushed_at<start_time: | ||
| return True | ||
| elif start_time and not end_time and repo.pushed_at<start_time: | ||
| return True | ||
| elif end_time and not start_time and repo.pushed_at>end_time: | ||
| return True | ||
| else: | ||
| continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the first glance, these checks seem redundant to the ones in lines 121 til 130.
@malexmave you've wrote the intial code, can you help out here regarding the logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here _check_repo_is_in_time_frame this function is just for checking whether where repos are in correct timeframe or not
and these return True or False if else statements are checking for early exit
2926ec3 to
3edbed5
Compare
|
@twwd I’ve addressed your suggestions , could you please review again and let me know if I missed anything? |
Signed-off-by: kart-u <pandeykartik715@gmail.com>
7ec3092 to
0946448
Compare
Signed-off-by: kart-u <pandeykartik715@gmail.com>
|



Description
Issue
git-repo-scanneris a custom-written Python tool for scanning Git repositories.Solution
Updated Dpenedencies:
pytimeparse, which has been inactive since 2018.pytimeparsewith the actively maintainedpytimeparse2(fully compatible).Corrected Logical errors in
github_scanner.py_process_repos_pagemethod ingithub_scanner.pyhandling ofstart_timeandend_timewas wrong andbreakcondition was causing inclusion of unwanted repositories infindingswhenend_timeandstart_timeboth are present.start_timeandend_time.is_overflag to avoid further lookup when when we already out of timeframeAdded new more Test cases for all above code
git_repo_scanner_test.py(timeframe related test were absent added variety of those)main_test.pyfile for testing ofgit_repo_scanner.__main__.pyTesting Results
Unit Testing
Manual Testing
'''
cd ./scanners/git-repo-scanner/scanner/
python3 -m git_repo_scanner \
--git-type github \
--organization secureCodeBox\
--access-token $GITHUB_TOKEN \
--activity-since-duration "30d" \
--activity-until-duration "1d" \
--file-output github-results.json
'''
Closes #3134
Checklist