Skip to content

Return sha1_git checksum for all files as info #4425

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 2 commits into from
Jun 11, 2025
Merged

Conversation

AyanSinhaMahapatra
Copy link
Member

@AyanSinhaMahapatra AyanSinhaMahapatra commented Jun 11, 2025

Fixes #624

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

Reference: #624
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
@JonoYang
Copy link
Member

@AyanSinhaMahapatra getting some progressbar errors when running the *latest_from_pip tests:

FAILED tests/scancode/test_cli.py::test_scan_info_does_collect_info - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_info_does_collect_info_with_root - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_info_returns_full_root - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_info_returns_correct_full_root_with_single_file - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_info_returns_does_not_strip_root_with_single_file - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_package_option_detects_packages - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_copyright_option_detects_copyrights - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scanned_resource_no_attribute_emails - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_unwanted_log_warning_message - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_noinfo_license_copyrights_with_root - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_email_url_info - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_should_not_fail_on_faulty_pdf_or_pdfminer_bug_but_instead_keep_trucking_with_json - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_failing_scan_return_proper_exit_code_on_failure - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_should_not_fail_on_faulty_pdf_or_pdfminer_bug_but_instead_report_errors_and_keep_trucking_with_html - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_should_not_fail_on_faulty_pdf_or_pdfminer_bug_but_instead_report_errors_and_keep_trucking_with_html_app - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_works_with_multiple_processes - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_works_with_no_processes_non_threaded_mode - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_works_with_multiple_processes_and_timeouts - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_does_not_fail_when_scanning_unicode_files_and_paths_default - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_does_not_fail_when_scanning_unicode_test_files_from_express - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_can_handle_non_utf8_file_names_on_posix - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_can_handle_licenses_with_unicode_metadata - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_logs_errors_messages_not_verbosely_on_stderr - assert 'Some files failed to scan properly:' in 'Disabling multi-processing for debugging.\nSetup plugins...\nCollect file inventory...\nScan files for: emails with 0 process(es)...\nRemoving temporary files...done.\nTraceback (most recent call last):\n  File "/home/vsts/work/1/s/venv/bin/scancode", line 8, in <module>\n    sys.exit(scancode())\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/core.py", line 1442, in __call__\n    return self.main(*args, **kwargs)\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/commoncode/cliutils.py", line 73, in main\n    return click.Command.main(\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/core.py", line 1363, in main\n    rv = self.invoke(ctx)\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/core.py", line 1226, in invoke\n    return ctx.invoke(self.callback, **ctx.params)\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/core.py", line 794, in invoke\n    return callback(*args, **kwargs)\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/decorators.py", line 34, in new_func\n    return f(get_current_context(), *args, **kwargs)\n  File "/home/vsts/work/1/s/src/scancode/cli.py", line 487, in scancode\n    success, _results = run_scan(\n  File "/home/vsts/work/1/s/src/scancode/cli.py", line 944, in run_scan\n    scan_success = run_scanners(\n  File "/home/vsts/work/1/s/src/scancode/cli.py", line 1186, in run_scanners\n    scan_success = scan_codebase(\n  File "/home/vsts/work/1/s/src/scancode/cli.py", line 1285, in scan_codebase\n    scans.__enter__()\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/_termui_impl.py", line 118, in __enter__\n    self.render_progress()\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/commoncode/cliutils.py", line 199, in render_progress\n    if not self.is_hidden:\nAttributeError: \'EnhancedProgressBar\' object has no attribute \'is_hidden\'. Did you mean: \'hidden\'?'
FAILED tests/scancode/test_cli.py::test_scan_logs_errors_messages_not_verbosely_on_stderr_with_multiprocessing - assert 'Some files failed to scan properly:' in 'Setup plugins...\nCollect file inventory...\nScan files for: emails with 2 process(es)...\nRemoving temporary files...done.\nTraceback (most recent call last):\n  File "/home/vsts/work/1/s/venv/bin/scancode", line 8, in <module>\n    sys.exit(scancode())\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/core.py", line 1442, in __call__\n    return self.main(*args, **kwargs)\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/commoncode/cliutils.py", line 73, in main\n    return click.Command.main(\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/core.py", line 1363, in main\n    rv = self.invoke(ctx)\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/core.py", line 1226, in invoke\n    return ctx.invoke(self.callback, **ctx.params)\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/core.py", line 794, in invoke\n    return callback(*args, **kwargs)\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/decorators.py", line 34, in new_func\n    return f(get_current_context(), *args, **kwargs)\n  File "/home/vsts/work/1/s/src/scancode/cli.py", line 487, in scancode\n    success, _results = run_scan(\n  File "/home/vsts/work/1/s/src/scancode/cli.py", line 944, in run_scan\n    scan_success = run_scanners(\n  File "/home/vsts/work/1/s/src/scancode/cli.py", line 1186, in run_scanners\n    scan_success = scan_codebase(\n  File "/home/vsts/work/1/s/src/scancode/cli.py", line 1285, in scan_codebase\n    scans.__enter__()\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/click/_termui_impl.py", line 118, in __enter__\n    self.render_progress()\n  File "/home/vsts/work/1/s/venv/lib/python3.10/site-packages/commoncode/cliutils.py", line 199, in render_progress\n    if not self.is_hidden:\nAttributeError: \'EnhancedProgressBar\' object has no attribute \'is_hidden\'. Did you mean: \'hidden\'?'
FAILED tests/scancode/test_cli.py::test_scan_progress_display_is_not_damaged_with_long_file_names - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_does_scan_php_composer - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_does_scan_rpm - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_should_not_fail_with_low_max_in_memory_setting_when_ignoring_files - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_check_error_count - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_can_handle_weird_file_names - AttributeError: 'EnhancedProgressBar' object has no attribute 'is_hidden'. Did you mean: 'hidden'?
FAILED tests/scancode/test_cli.py::test_scan_keep_temp_files_keeps_files - AssertionError: assert 13 == 7
 +  where 13 = len([('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3', ['scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66', 'scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa'], []), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66', ['scancode-codebase-2025-06-11T124742.564042-fhj_zten'], []), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66/scancode-codebase-2025-06-11T124742.564042-fhj_zten', ['5a', 'a3', 'c1', '29'], []), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66/scancode-codebase-2025-06-11T124742.564042-fhj_zten/5a', [], ['d4cb24c11a8324035f75ce43c894c15a']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66/scancode-codebase-2025-06-11T124742.564042-fhj_zten/a3', [], ['3da7ba435698f69fcc203b625b989ea3']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66/scancode-codebase-2025-06-11T124742.564042-fhj_zten/c1', [], ['d97e5cc308f4d2b17e002ce16b0c40c1']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66/scancode-codebase-2025-06-11T124742.564042-fhj_zten/29', [], ['8fc07f590ea7620707f4b2aab16edd29']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa', ['scancode-codebase-2025-06-11T124745.295600-98fj4cie'], []), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa/scancode-codebase-2025-06-11T124745.295600-98fj4cie', ['5a', 'a3', 'c1', '29'], []), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa/scancode-codebase-2025-06-11T124745.295600-98fj4cie/5a', [], ['d4cb24c11a8324035f75ce43c894c15a']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa/scancode-codebase-2025-06-11T124745.295600-98fj4cie/a3', [], ['3da7ba435698f69fcc203b625b989ea3']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa/scancode-codebase-2025-06-11T124745.295600-98fj4cie/c1', [], ['d97e5cc308f4d2b17e002ce16b0c40c1']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa/scancode-codebase-2025-06-11T124745.295600-98fj4cie/29', [], ['8fc07f590ea7620707f4b2aab16edd29'])])
 +    where [('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3', ['scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66', 'scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa'], []), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66', ['scancode-codebase-2025-06-11T124742.564042-fhj_zten'], []), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66/scancode-codebase-2025-06-11T124742.564042-fhj_zten', ['5a', 'a3', 'c1', '29'], []), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66/scancode-codebase-2025-06-11T124742.564042-fhj_zten/5a', [], ['d4cb24c11a8324035f75ce43c894c15a']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66/scancode-codebase-2025-06-11T124742.564042-fhj_zten/a3', [], ['3da7ba435698f69fcc203b625b989ea3']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66/scancode-codebase-2025-06-11T124742.564042-fhj_zten/c1', [], ['d97e5cc308f4d2b17e002ce16b0c40c1']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-u78iqq66/scancode-codebase-2025-06-11T124742.564042-fhj_zten/29', [], ['8fc07f590ea7620707f4b2aab16edd29']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa', ['scancode-codebase-2025-06-11T124745.295600-98fj4cie'], []), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa/scancode-codebase-2025-06-11T124745.295600-98fj4cie', ['5a', 'a3', 'c1', '29'], []), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa/scancode-codebase-2025-06-11T124745.295600-98fj4cie/5a', [], ['d4cb24c11a8324035f75ce43c894c15a']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa/scancode-codebase-2025-06-11T124745.295600-98fj4cie/a3', [], ['3da7ba435698f69fcc203b625b989ea3']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa/scancode-codebase-2025-06-11T124745.295600-98fj4cie/c1', [], ['d97e5cc308f4d2b17e002ce16b0c40c1']), ('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3/scancode-tk-v32.3.2-32-gf2e7983be-ey9eleaa/scancode-codebase-2025-06-11T124745.295600-98fj4cie/29', [], ['8fc07f590ea7620707f4b2aab16edd29'])] = list(<generator object _walk at 0x7fa206fdc580>)
 +      where <generator object _walk at 0x7fa206fdc580> = <function walk at 0x7fa2341776d0>('/tmp/scancode-tk-tests -yfjkevta/5j_0rwm3')
 +        where <function walk at 0x7fa2341776d0> = os.walk
================== 31 failed, 42 passed, 3 warnings in 58.91s ==================

@AyanSinhaMahapatra
Copy link
Member Author

AyanSinhaMahapatra commented Jun 11, 2025

@JonoYang this was fixed in #4427, let me merge the changes too, all tests should pass then.

@JonoYang
Copy link
Member

@AyanSinhaMahapatra everything looks good now, thanks!

@JonoYang JonoYang merged commit 742b20c into develop Jun 11, 2025
43 checks passed
@JonoYang JonoYang deleted the add-git-sha1 branch June 11, 2025 23:11
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.

Add Git blob sha1 to checksums returned with info
2 participants