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

'str' object has no attribute 'path' #11

Open
yegor256 opened this issue Feb 20, 2025 · 1 comment
Open

'str' object has no attribute 'path' #11

yegor256 opened this issue Feb 20, 2025 · 1 comment

Comments

@yegor256
Copy link

This is my YAML config:

name: scancode
'on':
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
jobs:
  scancode:
    timeout-minutes: 15
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v4
        with:
          path: scancode-inputs
      - uses: aboutcode-org/scancode-action@alpha
        with:
          inputs-path: scancode-inputs
          pipelines: "scan_codebase"
          output-formats: "json xlsx spdx cyclonedx"

I'm getting this:

INFO Run[c911c374-3a49-4ba8-a580-6332d024d1dd] Enter `execute_pipeline_task` Run.pk=c911c374-3a49-4ba8-a580-6332d024d1dd
INFO Run[c911c374-3a49-4ba8-a580-6332d024d1dd] Run pipeline: "scan_codebase" on project: "scancode-action"
INFO Scan 127 codebase resources with scan_for_package_data
INFO Starting ProcessPoolExecutor with 3 max_workers
Start the scan_codebase pipeline execution...
INFO Project scancode-action assemble_packages:
INFO   Processing: pom.xml
INFO   Package data: pkg:maven/com.jcabi.incubator/[email protected]
INFO   Selected package handler: MavenPomXmlHandler
INFO     Processing item: Package(type='maven', namespace='com.jcabi.incubator', name='xembly', version='1.0-SNAPSHOT', datasource_id='maven_pom')
INFO Run[c911c374-3a49-4ba8-a580-6332d024d1dd] Update Run instance with exitcode, output, and end_date
CommandError: Error during scan_codebase execution:
'str' object has no attribute 'path'

Traceback:
  File "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/aboutcode/pipeline/__init__.py", line 199, in execute
    step(self)
  File "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/scanpipe/pipelines/scan_codebase.py", line 63, in scan_for_application_packages
    scancode.scan_for_application_packages(self.project, progress_logger=self.log)
  File "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/scanpipe/pipes/scancode.py", line 436, in scan_for_application_packages
    assemble_packages(project=project)
  File "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/scanpipe/pipes/scancode.py", line 493, in assemble_packages
    for item in items:
  File "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/packagedcode/maven.py", line 94, in assemble
    yield from MavenPomXmlHandlerMixin.assemble(package_data, resource, codebase)
  File "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/packagedcode/models.py", line 1185, in assemble
    cls.assign_package_to_resources(
  File "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/packagedcode/maven.py", line 294, in assign_package_to_resources
    return models.DatafileHandler.assign_package_to_resources(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/packagedcode/models.py", line 1224, in assign_package_to_resources
    if resource.path.endswith("-extract"):
       ^^^^^^^^^^^^^

Full story is here: https://github.com/yegor256/xembly/actions/runs/13442374348/job/37559683755

@tdruez
Copy link
Contributor

tdruez commented Feb 20, 2025

@yegor256 That's a bug in the package assembly code when the codebase is directly at the root of the input/ directory.
We'll work on a fix on the ScanCode.io side.

In the meantime, you can try the following as a workaround:

name: scancode
'on':
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
jobs:
  scancode:
    timeout-minutes: 15
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v4
        with:
          path: scancode-inputs/checkout
      - uses: aboutcode-org/scancode-action@alpha
        with:
          inputs-path: scancode-inputs
          pipelines: "scan_codebase"
          output-formats: "json xlsx spdx cyclonedx"

The only change is path: scancode-inputs/checkout.

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

No branches or pull requests

2 participants