Skip to content

chore(purl): implement method to check PURL#5

Merged
agustingroh merged 1 commit intomainfrom
chore/add-check-purl-method
Feb 24, 2026
Merged

chore(purl): implement method to check PURL#5
agustingroh merged 1 commit intomainfrom
chore/add-check-purl-method

Conversation

@agustingroh
Copy link
Copy Markdown
Contributor

@agustingroh agustingroh commented Feb 23, 2026

Summary by CodeRabbit

  • New Features

    • Added PURL validation and existence checking capabilities in version 0.5.0.
    • Users can now query the projects table for entries matching a package URL by name and type.
  • Chores

    • Updated project configuration files and ignore rules.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 23, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1d3b1f and 85d6c92.

📒 Files selected for processing (7)
  • .gitignore
  • .idea/.gitignore
  • .idea/modules.xml
  • CHANGELOG.md
  • go.mod
  • pkg/models/projects.go
  • pkg/services/component.go

📝 Walkthrough

Walkthrough

This PR introduces PURL (Package URL) validation functionality by adding CheckPurlByNameType method in ProjectModel to query the projects table, and CheckPurl method in ComponentService to parse PURL strings and delegate validation. Additionally, the GetComponent method now prevents simultaneous version and requirement specification. Configuration files are updated with renamed module reference and adjusted IDE ignore rules.

Changes

Cohort / File(s) Summary
Configuration & IDE Files
.gitignore, .idea/.gitignore, .idea/modules.xml, go.mod
Updated .gitignore to track .DS_Store, removed IDE ignore rules from .idea/.gitignore, renamed module from go-scanoss-models.iml to go-models.iml, and removed blank line in go.mod.
Documentation
CHANGELOG.md
Added version 0.5.0 entry documenting two new features: CheckPurlByNameType in ProjectModel and CheckPurl in ComponentService.
PURL Validation Feature
pkg/models/projects.go, pkg/services/component.go
Implemented CheckPurlByNameType method that queries projects/mines tables for PURL matches by name and type; implemented CheckPurl method that parses PURL strings and delegates to model method; added validation guard in GetComponent to prevent simultaneous version and requirement specification.

Sequence Diagram

sequenceDiagram
    participant Client
    participant CS as ComponentService
    participant PM as ProjectModel
    participant DB as Database
    
    Client->>CS: CheckPurl(ctx, purlString)
    CS->>CS: Parse & validate PURL
    CS->>PM: CheckPurlByNameType(ctx, name, type)
    PM->>PM: Validate inputs
    PM->>DB: Query projects/mines join
    DB-->>PM: Count result
    PM-->>CS: Count, error
    CS-->>Client: Count, error
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A PURL takes flight through parsing lands,
Where ComponentService takes a stand,
To query projects with careful hands,
And validate what names demand—
New features hop, by SQL's command!

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/add-check-purl-method

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@scanoss-qg scanoss-qg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@agustingroh agustingroh force-pushed the chore/add-check-purl-method branch from e127877 to 85d6c92 Compare February 24, 2026 12:19
@agustingroh agustingroh merged commit 14f0d13 into main Feb 24, 2026
1 check passed
@agustingroh agustingroh deleted the chore/add-check-purl-method branch February 24, 2026 12:19
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.

2 participants