Skip to content

chore: add pre-commit config, add gh action #111

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

matiasdaloia
Copy link
Contributor

@matiasdaloia matiasdaloia commented Mar 24, 2025

Summary by CodeRabbit

  • New Features

    • Introduced an automated code scanning workflow that runs on pushes, pull requests, and can be triggered manually.
    • Integrated additional pre-commit checks to further enhance code quality.
    • Added a configuration for managing the software bill of materials (BOM).
  • Documentation

    • Updated the project instructions to include a clear setup guide for pre-commit hooks.
  • Chores

    • Adjusted version control settings to ensure key configuration files remain tracked.

@matiasdaloia matiasdaloia self-assigned this Mar 24, 2025
@matiasdaloia matiasdaloia requested a review from eeisegn March 24, 2025 13:53
Copy link

coderabbitai bot commented Mar 24, 2025

Walkthrough

The changes add a new GitHub Actions workflow to automate SCANOSS code scans on pull requests, pushes, or manual triggers. Updates include a modification in the .gitignore to track scanoss.json, a new pre-commit hook configuration for scanning undeclared code, an updated README section detailing pre-commit setup, and a new scanoss.json configuration file for BOM management.

Changes

File(s) Change Summary
.github/workflows/scanoss.yml Introduces a new GitHub Actions workflow for SCANOSS code scanning. The workflow runs on PRs, pushes, and manual dispatch events using Ubuntu, checks out the code, and executes the scanoss/code-scan-action with specified inputs.
.gitignore Updates the file to include an exception (!scanoss.json), ensuring that the scanoss.json file is tracked by Git.
.pre-commit-config.yaml Adds a new pre-commit hook repository from https://github.com/scanoss/pre-commit-hooks at revision v0.2.0 and integrates the scanoss-check-undeclared-code hook.
README.md Introduces a "Pre-commit Setup" section with instructions to install and configure pre-commit hooks using pip3 install pre-commit and pre-commit install.
scanoss.json Adds a new JSON configuration file for BOM management. It defines settings with skip patterns and size settings, along with inclusion and removal arrays for managing package data.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub
    participant Checkout
    participant SCANOSS

    User->>GitHub: Trigger event (PR, push, manual dispatch)
    GitHub->>Checkout: Checkout repository code
    Checkout-->>GitHub: Provide source code
    GitHub->>SCANOSS: Execute SCANOSS code scan with inputs (policy, API URL, API key)
    SCANOSS-->>GitHub: Return scan results
    GitHub->>User: Update pull request/checks with results
Loading
sequenceDiagram
    participant Developer
    participant Git
    participant PreCommit
    participant scanossHook

    Developer->>Git: Initiate commit
    Git->>PreCommit: Run pre-commit hooks
    PreCommit->>scanossHook: Execute scanoss-check-undeclared-code hook
    scanossHook-->>PreCommit: Return check result (pass/fail)
    PreCommit-->>Git: Report pre-commit status
    Git->>Developer: Commit completed (if checks pass)
Loading

Poem

I'm a hopping rabbit with glee in my heart,
A new workflow and hooks have played their part.
GitHub scans code with a rhythm so fine,
Pre-commit checks make the code align.
With scanoss.json and settings anew,
I dance with joy — a rabbit's breakthrough! 🥕🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 040fbbe and affeffd.

📒 Files selected for processing (5)
  • .github/workflows/scanoss.yml (1 hunks)
  • .gitignore (1 hunks)
  • .pre-commit-config.yaml (1 hunks)
  • README.md (1 hunks)
  • scanoss.json (1 hunks)
🔇 Additional comments (5)
.gitignore (1)

34-34: Ensure Configuration is Tracked
The addition of !scanoss.json on line 34 clearly marks the SCANOSS configuration file to be tracked by Git. This prevents accidental exclusion of a key configuration file for BOM management.

.pre-commit-config.yaml (1)

7-11: New SCANOSS Pre-commit Hook Added
The repository for the SCANOSS pre-commit hooks (https://github.com/scanoss/pre-commit-hooks at revision v0.2.0) along with the hook scanoss-check-undeclared-code has been added correctly. This extension will help in enforcing undeclared code checks during commits.

README.md (1)

42-50: Clear Pre-commit Setup Documentation
The added "Pre-commit Setup" section provides concise and clear instructions for installing and setting up pre-commit hooks, which enhances developer onboarding and consistency in code quality checks.

scanoss.json (1)

1-33: Well-Structured BOM Configuration File
The new scanoss.json file is well-organized with clearly defined "settings" and "bom" sections. The inclusion of packages in the "include" array and the precise mappings in the "remove" array are clear. Please ensure that these entries remain updated with any future BOM management requirements.

.github/workflows/scanoss.yml (1)

1-31: Robust SCANOSS GitHub Actions Workflow
The new workflow file for SCANOSS code scanning is configured appropriately—it triggers on pull requests, pushes (across all branches), and manual dispatch. The job steps (checkout and running the SCANOSS code scan action) are set up correctly with the proper inputs (including the API URL and API key from secrets).


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

SCANOSS SCAN Completed 🚀

  • Components detected: 11
  • Licenses detected: 4
  • Policies: ✅ 1 pass (1 total)

View more details on SCANOSS Action Summary

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.

1 participant