fairdataihub / codefair-app

Your coding assistant to make research software reusable without breaking a sweat!
https://codefair.io
MIT License
7 stars 2 forks source link

refactor: ♻️ Custom License Support #94

Closed slugb0t closed 3 weeks ago

slugb0t commented 3 weeks ago

Summary by Sourcery

Enhancements:

fairdataihub-bot[bot] commented 3 weeks ago

Thank you for submitting this pull request! We appreciate your contribution to the project. Before we can merge it, we need to review the changes you've made to ensure they align with our code standards and meet the requirements of the project. We'll get back to you as soon as we can with feedback. Thanks again!

sourcery-ai[bot] commented 3 weeks ago

Reviewer's Guide by Sourcery

This PR implements custom license support with significant changes to how licenses are validated, displayed, and handled in the system. The main changes include improved license validation logic, updated UI components to handle custom licenses, and new API endpoints for managing custom license titles. The implementation also adds restrictions for Zenodo publishing when using custom licenses.

Sequence diagram for updating issue with custom license

sequenceDiagram
    participant User
    participant Bot
    participant Database
    participant Zenodo

    User->>Bot: Request to update issue with custom license
    Bot->>Database: Fetch licenseRequest, codeMetadata, cwlValidation
    Database-->>Bot: Return license details
    Bot->>Bot: Check license, citation, codemeta, cwl
    Bot->>Bot: Render issue body with license details
    Bot->>Zenodo: Attempt to publish with custom license
    Zenodo-->>Bot: Error due to custom license
    Bot->>User: Notify about custom license restriction

Updated class diagram for license validation

classDiagram
    class LicenseRequest {
        +String license_id
        +String license_content
        +String custom_license_title
    }
    class LicenseValidator {
        +validateLicense(licenseRequest, existingLicense)
    }
    class LicenseHandler {
        +createLicense(context, owner, repo, license)
        +applyLicenseTemplate(subjects, licenseId, existingLicense)
    }
    LicenseRequest <|-- LicenseValidator
    LicenseValidator <|-- LicenseHandler
    note for LicenseValidator "Handles validation of custom licenses"

File-Level Changes

Change Details Files
Enhanced license validation logic with improved handling of custom licenses
  • Added more robust license content decoding with error handling
  • Updated NOASSERTION handling logic to better handle custom licenses
  • Improved validation flow to maintain existing custom license information
bot/license/index.js
Updated UI to support custom license workflow
  • Added warning tag for custom license limitations
  • Disabled Zenodo publishing button when using custom licenses
  • Updated license warning messages to be more informative
  • Added custom license title display in the dashboard
ui/pages/dashboard/[owner]/[repo]/index.vue
ui/pages/dashboard/[owner]/[repo]/release/zenodo.vue
ui/pages/dashboard/[owner]/[repo]/edit/license.vue
Added new API endpoint for custom license title management
  • Created new PUT endpoint for updating custom license titles
  • Implemented authorization checks and validation
  • Added dashboard re-rendering functionality
ui/server/api/[owner]/[repo]/license/custom_title.put.ts
Enhanced dashboard rendering and issue management
  • Added support for custom license flag in issue rendering
  • Implemented dashboard re-rendering command handling
  • Updated issue templates for custom license scenarios
bot/index.js
bot/utils/renderer/index.js
bot/archival/index.js

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
fairdataihub-bot[bot] commented 3 weeks ago

Thanks for making updates to your pull request. Our team will take a look and provide feedback as soon as possible. Please wait for any GitHub Actions to complete before editing your pull request. If you have any additional questions or concerns, feel free to let us know. Thank you for your contributions!

what-the-diff[bot] commented 3 weeks ago

PR Summary

fairdataihub-bot[bot] commented 3 weeks ago

Thanks for closing this pull request! If you have any further questions, please feel free to open a new issue. We are always happy to help!