Skip to content

Migrate to file-scoped namespaces#1549

Merged
JamieMagee merged 1 commit into
mainfrom
users/jamagee/file-scoped-namespaces
Nov 20, 2025
Merged

Migrate to file-scoped namespaces#1549
JamieMagee merged 1 commit into
mainfrom
users/jamagee/file-scoped-namespaces

Conversation

@JamieMagee

Copy link
Copy Markdown
Member

We performed this migration in #398, but this code was added later in #1425.

This also updates our documentation to show file-scoped namespaces.

See https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces

@codecov

codecov Bot commented Nov 19, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.2%. Comparing base (079b805) to head (f472971).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1549   +/-   ##
=====================================
  Coverage   90.2%   90.2%           
=====================================
  Files        423     423           
  Lines      35476   35476           
  Branches    2209    2209           
=====================================
  Hits       32021   32021           
  Misses      3001    3001           
  Partials     454     454           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 completes the migration to file-scoped namespaces (C# 10 feature) for code added after the initial migration in #398. The changes modernize the codebase syntax and improve readability by reducing nesting.

  • Migrates 6 source files in the Uv detector to file-scoped namespace syntax
  • Updates test file UvLockTests.cs to use file-scoped namespaces
  • Updates documentation to demonstrate file-scoped namespace pattern

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/Microsoft.ComponentDetection.Detectors.Tests/UvLockTests.cs Migrates test class from nested to file-scoped namespace
src/Microsoft.ComponentDetection.Detectors/uv/UvSource.cs Migrates source model class to file-scoped namespace
src/Microsoft.ComponentDetection.Detectors/uv/UvPackage.cs Migrates package model class to file-scoped namespace
src/Microsoft.ComponentDetection.Detectors/uv/UvLockComponentDetector.cs Migrates detector implementation to file-scoped namespace
src/Microsoft.ComponentDetection.Detectors/uv/UvLock.cs Migrates lock file parser to file-scoped namespace
src/Microsoft.ComponentDetection.Detectors/uv/UvDependency.cs Migrates dependency model class to file-scoped namespace
docs/creating-a-new-service.md Updates documentation examples to show file-scoped namespace syntax

Comment thread src/Microsoft.ComponentDetection.Detectors/uv/UvLock.cs
Comment thread src/Microsoft.ComponentDetection.Detectors/uv/UvLock.cs
Comment thread src/Microsoft.ComponentDetection.Detectors/uv/UvLock.cs
@JamieMagee JamieMagee enabled auto-merge (squash) November 19, 2025 23:37
@JamieMagee JamieMagee merged commit 1db2953 into main Nov 20, 2025
34 checks passed
@JamieMagee JamieMagee deleted the users/jamagee/file-scoped-namespaces branch November 20, 2025 19:08
@github-actions

Copy link
Copy Markdown

👋 Hi! It looks like you modified some files in the Detectors folder.
You may need to bump the detector versions if any of the following scenarios apply:

  • The detector detects more or fewer components than before
  • The detector generates different parent/child graph relationships than before
  • The detector generates different devDependencies values than before

If none of the above scenarios apply, feel free to ignore this comment 🙂

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.

3 participants