-
-
Notifications
You must be signed in to change notification settings - Fork 567
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
Add new duration field to JSON output #1937 #1942
Conversation
@pombredanne Sorry for inconvenience, but i thought it was better to open a new clean pull request instead of fixing #1939 |
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.
Thank you! we are getting there...
See one comment inline.
We also need a few extra things:
- add at least one test
- add your name to the authors and changelog
- squash this in one commit and improve your commit message (See https://aboutcode.readthedocs.io/en/latest/aboutcode-docs/writing_good_commit_messages.html for help)
src/scancode/cli.py
Outdated
@@ -949,8 +949,11 @@ def echo_func(*_args, **_kwargs): | |||
codebase.counters['final:files_count'] = files_count | |||
codebase.counters['final:dirs_count'] = dirs_count | |||
codebase.counters['final:size_count'] = size_count | |||
|
|||
processing_end = time() |
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.
Why do you need an intermediate variable?
May be you could directly use time()
in https://github.com/nexB/scancode-toolkit/pull/1942/files#diff-1e37ecfb9a8c3fccd8ecdfb2ce51f591R956 ?
Codecov Report
@@ Coverage Diff @@
## develop #1942 +/- ##
===========================================
+ Coverage 78.93% 79.00% +0.06%
===========================================
Files 131 131
Lines 16946 16948 +2
===========================================
+ Hits 13376 13389 +13
+ Misses 3570 3559 -11
Continue to review full report at Codecov.
|
@pombredanne i did the required changes, hope they are ok :) |
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.
Thank you for addressing all my comments! I have a few extra ones inline and here.
For the commit message you could try this: (note the first line is less than 50 chars and note the use of the imperative style)
Add new duration field to JSON output #1937
This field contains the scan duration in seconds.
Reported-by: Armijn Hemel @armijnhemel
Signed-off-by: MankaranSingh <42907308+MankaranSingh@users.noreply.github.com>
src/scancode/cli.py
Outdated
@@ -1,4 +1,4 @@ | |||
# |
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.
Why this change?
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.
Must had been a typo.
with open(result_file) as result: | ||
headers = json.loads(result.read())['headers'] | ||
assert headers[0]['duration'] | ||
assert headers[0]['duration'] >= 0 |
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.
Excellent!
This field contains the scan duration in seconds. Reported-by: Armijn Hemel @armijnhemel Signed-off-by: MankaranSingh <42907308+MankaranSingh@users.noreply.github.com>
@pombredanne all the required changes done :) |
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.
All good!
Thank you++
Fixes #1937
Tasks
Run tests locally to check for errors.