Skip to content

fix(contrib): raise FileNotFoundError from ComponentBuilder.make_for_file() for a missing file - #1081

Merged
jkowalleck merged 1 commit into
CycloneDX:mainfrom
vaibhav4046:fix/make-for-file-not-found
Nov 26, 2026
Merged

jkowalleck merged 1 commit into
CycloneDX:mainfrom
vaibhav4046:fix/make-for-file-not-found

Conversation

@vaibhav4046

@vaibhav4046 vaibhav4046 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

ComponentBuilder.make_for_file() raised FileExistsError when the path does not exist, so callers catching FileNotFoundError missed it. It now raises FileNotFoundError. As noted on the issue, this is in the contrib area and not a breaking change. New tests in tests/test_contrib/test_component_builders.py cover the missing-file case (fails on main) and the existing-file case.

Resolves or fixes issue: #1076

AI Tool Disclosure

  • My contribution does not include any AI-generated content
  • My contribution includes AI-generated content, as disclosed below:
    • AI Tools: Instinct (AI assistant working on my behalf)
    • LLMs and versions: model name and version are not exposed to the assistant
    • Prompts: asked to fix this specific open issue with a minimal change and tests that fail before and pass after the fix

Affirmation

…a missing file

Closes CycloneDX#1076

Signed-off-by: Vaibhav Lalwani <vaibhav4046@users.noreply.github.com>
@vaibhav4046
vaibhav4046 requested a review from a team as a code owner November 25, 2026 16:30
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@jkowalleck jkowalleck changed the title fix: raise FileNotFoundError from ComponentBuilder.make_for_file for a missing file fix(contrib): raise FileNotFoundError from ComponentBuilder.make_for_file for a missing file Nov 25, 2026
@jkowalleck jkowalleck added bug Something isn't working contrib Contributed features not part of the core library. labels Nov 25, 2026
@jkowalleck jkowalleck changed the title fix(contrib): raise FileNotFoundError from ComponentBuilder.make_for_file for a missing file fix(contrib): raise FileNotFoundError from ComponentBuilder.make_for_file() for a missing file Nov 25, 2026
@jkowalleck jkowalleck changed the title fix(contrib): raise FileNotFoundError from ComponentBuilder.make_for_file() for a missing file fix(contrib): raise FileNotFoundError from ComponentBuilder.make_for_file() for a missing file Nov 25, 2026
@jkowalleck

Copy link
Copy Markdown
Member

@vaibhav4046 could you have your AI agent update the PR description according to our PR template?
see https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/.github/PULL_REQUEST_TEMPLATE.md

@vaibhav4046

Copy link
Copy Markdown
Contributor Author

Thanks for the approval. The PR description now follows the template, including the AI disclosure.

@jkowalleck
jkowalleck merged commit 3bc82a5 into CycloneDX:main Nov 26, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working contrib Contributed features not part of the core library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ComponentBuilder.make_for_file() raises FileExistsError instead of FileNotFoundError when file does not exist

2 participants