Skip to content

Add version inference for C# projects#145

Merged
ncalteen merged 1 commit intomainfrom
ncalteen/csharp
Oct 20, 2025
Merged

Add version inference for C# projects#145
ncalteen merged 1 commit intomainfrom
ncalteen/csharp

Conversation

@ncalteen
Copy link
Copy Markdown
Contributor

  • Added support for inferring version from C# project files (.csproj).
  • Updated README to include C# as a supported language with its manifest file.
  • Added valid and invalid C# project file examples for testing.
  • Bumped package version to 2.6.0.

- Added support for inferring version from C# project files (.csproj).
- Updated README to include C# as a supported language with its manifest file.
- Added valid and invalid C# project file examples for testing.
- Bumped package version to 2.6.0.
@ncalteen ncalteen self-assigned this Oct 20, 2025
@ncalteen ncalteen requested a review from a team as a code owner October 20, 2025 16:06
Copilot AI review requested due to automatic review settings October 20, 2025 16:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds C# project file support to the version inference system by implementing parsing logic for .csproj files. The implementation introduces an extension-based parser alongside the existing filename-based parser to handle manifest files that may have different names but share the same extension.

Key Changes:

  • Implemented XML parsing for .csproj files to extract version information from Project.PropertyGroup.Version
  • Introduced extensionParser map to support extension-based manifest file parsing
  • Added comprehensive test coverage for both valid and invalid C# project files

Reviewed Changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/version.ts Added extensionParser map with .csproj support and fallback logic to check extension-based parsers
package.json Bumped version from 2.5.0 to 2.6.0
__tests__/version.test.ts Added test cases for valid and invalid C# project file version inference
__fixtures__/valid/csharp/example.csproj Created valid C# project file fixture with version 1.2.3-alpha.4+build.5
__fixtures__/invalid/csharp/example.csproj Created invalid C# project file fixture without version property
README.md Added C# with <project>.csproj to supported languages table

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link
Copy Markdown

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 5 0 0 0.05s
✅ JSON jsonlint 9 0 0 0.28s
✅ JSON prettier 9 0 0 1.09s
✅ JSON v8r 9 0 0 14.15s
✅ MARKDOWN markdownlint 1 0 0 0.91s
✅ REPOSITORY gitleaks yes no no 1.16s
✅ REPOSITORY git_diff yes no no 0.08s
✅ REPOSITORY grype yes no no 41.21s
✅ REPOSITORY secretlint yes no no 1.52s
✅ REPOSITORY syft yes no no 9.01s
✅ REPOSITORY trivy-sbom yes no no 5.08s
✅ REPOSITORY trufflehog yes no no 23.28s
✅ TYPESCRIPT prettier 14 0 0 1.82s
✅ XML xmllint 2 0 0 0.03s
✅ YAML prettier 19 0 0 1.26s
✅ YAML v8r 19 0 0 11.76s
✅ YAML yamllint 19 0 0 0.81s

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.1.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,JSON_JSONLINT,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_GRYPE,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,TYPESCRIPT_PRETTIER,XML_XMLLINT,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security

@ncalteen ncalteen merged commit 5b8bb08 into main Oct 20, 2025
6 checks passed
@ncalteen ncalteen deleted the ncalteen/csharp branch October 20, 2025 16:08
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