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

Basic support for twincat project types such as tsproj, plcproj, hmiproj #1669

Merged
merged 3 commits into from
Mar 3, 2025

Conversation

prabhu
Copy link
Collaborator

@prabhu prabhu commented Mar 3, 2025

Replaces #1660

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @prabhu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request introduces basic support for TwinCAT project types, including .tsproj, .plcproj, and .hmiproj. It achieves this by modifying the file matching patterns in lib/cli/index.js to include these new project types when searching for .NET projects. Additionally, it updates the PROJECT_TYPES.md documentation to reflect the added support and modifies the logic in lib/helpers/utils.js to correctly parse the project name and version from the new project types.

Highlights

  • Added support for TwinCAT project types: The pull request extends support to .tsproj, .plcproj, and .hmiproj project files, enabling the tool to analyze these project types.
  • Modified file matching patterns: The file matching patterns in lib/cli/index.js have been updated to include the new TwinCAT project types when searching for .NET projects.
  • Updated documentation: The PROJECT_TYPES.md file has been updated to document the newly supported TwinCAT project types.
  • Project name and version parsing: The logic in lib/helpers/utils.js has been modified to correctly parse the project name and version from the new project types, including handling cases where AssemblyName is not available and using Name instead.

Changelog

Click here to see the changelog
  • docs/PROJECT_TYPES.md
    • Added .tsproj, .plcproj, and .hmiproj to the list of supported project types for .NET (#C).
  • lib/cli/index.js
    • Modified the file matching pattern to include .tsproj, .plcproj, and .hmiproj files when searching for .NET projects.
    • Consolidated the file search logic for .NET project files into a single getAllFiles call with a wildcard pattern.
  • lib/helpers/utils.js
    • Added twincat, csproj, tsproj, vbproj, sln, fsproj, plcproj, hmiproj to the list of project type aliases.
    • Modified parseCsProjData function to correctly extract the project name from TwinCAT project files, using Name property if AssemblyName is not available.
    • Modified parseCsProjData function to correctly extract the project version from TwinCAT project files, using ProgramVersion or HmiVersion property if ProductVersion is not available.
    • Added logic to set the purl if OutputType is not available.
    • Added logic to extract AzureFunctionsVersion
  • types/lib/cli/index.d.ts.map
    • Updated type definitions to reflect changes in lib/cli/index.js.
  • types/lib/helpers/utils.d.ts.map
    • Updated type definitions to reflect changes in lib/helpers/utils.js.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A new project type appears,
TwinCAT, dispelling fears.
With tsproj, plcproj, hmiproj,
The SBOM's scope enjoys.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces basic support for several Twincat project types, enhancing the tool's ability to analyze .NET projects. The changes involve updating the documentation and modifying the code to recognize and process the new project types. Overall, the changes seem well-structured and address the issue effectively.

Merge Readiness

The pull request appears to be in good shape for merging. The changes are well-contained and address the specified goal of adding support for Twincat project types. Since no CRITICAL or HIGH severity issues were found, the pull request seems ready for merging, but as always, have others review and approve this code before merging. I am unable to directly approve the pull request.

@prabhu prabhu marked this pull request as ready for review March 3, 2025 14:52
Signed-off-by: Prabhu Subramanian <[email protected]>
@prabhu
Copy link
Collaborator Author

prabhu commented Mar 3, 2025

@gemini-code-assist any thoughts on the addition of a new repo test?

Copy link

Yes, I do have some thoughts on the addition of the new repo test.

It looks like you've added a new test case for TwinCAT_CNC projects, which is great for expanding the tool's capabilities. I've reviewed the changes and have a few comments:

  • Workflow File Update: The changes to .github/workflows/repotests.yml look good. The addition of the TwinCAT_CNC repository checkout and the corresponding test execution step seem correctly implemented.
  • Documentation Update: The update to docs/PROJECT_TYPES.md is also well done. Adding the new project types to the table helps users understand the tool's capabilities.
  • Code Modifications: The modifications to lib/cli/index.js and lib/helpers/utils.js seem appropriate for handling the new project types.

Overall, this is a valuable addition to the project. Thanks for your work!

@prabhu
Copy link
Collaborator Author

prabhu commented Mar 3, 2025

@gemini-code-assist, next time please wait until the pull request is marked as 'Ready for Review' before reviewing. When a PR is marked as draft, it's typically to inform the wider team of upcoming changes and prevent duplicate efforts. Reviewing draft PRs isn't a good use of anyone's time.

Copy link

You are absolutely correct, @prabhu. Thank you for pointing out my mistake. I will make sure to only review pull requests that are marked as 'Ready for Review' in the future. I apologize for the inconvenience.

@prabhu
Copy link
Collaborator Author

prabhu commented Mar 3, 2025

@Savo2610 Can you test this PR?

@prabhu prabhu merged commit c709305 into master Mar 3, 2025
28 of 30 checks passed
@prabhu prabhu deleted the feature/tsproj branch March 3, 2025 17:02
@Savo2610
Copy link

Savo2610 commented Mar 3, 2025

You are killer! Thank you so much! Will test this tomorrow.

@Savo2610
Copy link

Savo2610 commented Mar 7, 2025

TwinCAT_sample.zip
Unfortunately cdxgen for me still notices only the hmi packages and not the plc packages from the SamplePLC.plcproj file.
It would be nice to see tc2_standard 3.3.3.0, tc2_system 3.4.26.0 and tc3_module 3.3.21.0 in the generated bom.
Do you think there is an easy fix for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants