Skip to content

Conversation

askpt
Copy link
Member

@askpt askpt commented Apr 24, 2025

This PR

This pull request introduces a significant refactor to the codebase by converting all namespace declarations to file-scoped namespaces and updating the .editorconfig to enforce this style. Additionally, it simplifies the structure of multiple files by removing unnecessary closing braces for namespace blocks.

Namespace Refactoring:

  • Converted all namespace declarations in the src/OpenFeature directory to file-scoped namespaces for consistency and improved readability. This change affects multiple files, including Api.cs, Constants.cs, Error/*.cs, EventExecutor.cs, and Extension/*.cs. [1] [2] [3] [4] [5]R1, [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19]

Code Style Enforcement:

  • Updated .editorconfig to include a new rule (csharp_style_namespace_declarations = file_scoped:warning) to enforce the use of file-scoped namespaces.

Simplification of Code Structure:

Related Issues

Fixes #447

Notes

I ran the dotnet format OpenFeature.sln to clean up the code. As you can imagine, this generates a big diff. I would advise enabling Hide Whitespace to review this PR, since it will show the conversion from nested to file namespaces.

askpt added 2 commits April 24, 2025 17:29
- Simplified structure of test classes in StructureTests, TestImplementations, TestUtilsTest, and ValueTests by removing unnecessary nested classes and aligning formatting.
- Enhanced test methods with consistent naming conventions and streamlined assertions.
- Ensured all test methods are properly annotated with [Fact] attributes for clarity.
- Improved exception handling in tests to ensure expected behavior is clearly defined.

Signed-off-by: André Silva <[email protected]>
Copy link

codecov bot commented Apr 24, 2025

Codecov Report

Attention: Patch coverage is 92.51523% with 86 lines in your changes missing coverage. Please review.

Project coverage is 86.47%. Comparing base (4795685) to head (a384ffe).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/OpenFeature/EventExecutor.cs 86.81% 13 Missing and 11 partials ⚠️
...c/OpenFeature/Model/TrackingEventDetailsBuilder.cs 60.86% 18 Missing ⚠️
src/OpenFeature/Api.cs 88.99% 7 Missing and 5 partials ⚠️
src/OpenFeature/OpenFeatureClient.cs 95.00% 2 Missing and 5 partials ⚠️
src/OpenFeature/ProviderRepository.cs 94.33% 5 Missing and 1 partial ⚠️
src/OpenFeature/Hooks/LoggingHook.cs 95.00% 0 Missing and 4 partials ⚠️
src/OpenFeature/Model/EvaluationContextBuilder.cs 91.11% 4 Missing ⚠️
src/OpenFeature/Model/StructureBuilder.cs 90.47% 4 Missing ⚠️
src/OpenFeature/Model/Value.cs 94.73% 0 Missing and 2 partials ⚠️
src/OpenFeature/FeatureProvider.cs 90.90% 1 Missing ⚠️
... and 4 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #453   +/-   ##
=======================================
  Coverage   86.47%   86.47%           
=======================================
  Files          42       42           
  Lines        1671     1671           
  Branches      177      177           
=======================================
  Hits         1445     1445           
  Misses        187      187           
  Partials       39       39           

☔ 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.

@askpt askpt marked this pull request as ready for review April 24, 2025 16:36
@askpt askpt requested a review from a team as a code owner April 24, 2025 16:36
Copy link
Contributor

@kylejuliandev kylejuliandev left a comment

Choose a reason for hiding this comment

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

LGTM! The diff in GitHub was pretty terrible so I ended up using VS to check

@askpt
Copy link
Member Author

askpt commented Apr 24, 2025

LGTM! The diff in GitHub was pretty terrible so I ended up using VS to check

Most of the time I click on this setting

https://i0.wp.com/user-images.githubusercontent.com/2503052/137387087-91cc8458-9e11-44a9-8da0-f48251ec452c.gif?ssl=1

Copy link
Member

@beeme1mr beeme1mr left a comment

Choose a reason for hiding this comment

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

The diff caused Chrome to lock up for a while but eventually I made it through the review!

@askpt
Copy link
Member Author

askpt commented Apr 24, 2025

The diff caused Chrome to lock up for a while but eventually I made it through the review!

"I broke @beeme1mr Chrome." Achievement unlocked 🍻

@askpt askpt added this pull request to the merge queue Apr 24, 2025
Merged via the queue into main with commit 1e74a04 Apr 24, 2025
18 of 19 checks passed
@beeme1mr beeme1mr deleted the askpt/issue447 branch April 24, 2025 19:09
github-merge-queue bot pushed a commit that referenced this pull request Apr 28, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.5.0](v2.4.0...v2.5.0)
(2025-04-25)


### ✨ New Features

* Add support for hook data.
([#387](#387))
([4563512](4563512))


### 🧹 Chore

* add NuGet auditing
([#454](#454))
([42ab536](42ab536))
* Change file scoped namespaces and cleanup job
([#453](#453))
([1e74a04](1e74a04))
* **deps:** update codecov/codecov-action action to v5.4.2
([#432](#432))
([c692ec2](c692ec2))
* **deps:** update github/codeql-action digest to 28deaed
([#446](#446))
([dfecd0c](dfecd0c))
* **deps:** update spec digest to 18cde17
([#395](#395))
([5608dfb](5608dfb))
* **deps:** update spec digest to 2ba05d8
([#452](#452))
([eb688c4](eb688c4))
* **deps:** update spec digest to 36944c6
([#450](#450))
([e162169](e162169))
* **deps:** update spec digest to d27e000
([#455](#455))
([e0ec8ca](e0ec8ca))
* packages read in release please
([1acc00f](1acc00f))
* update release permissions
([d0bf40b](d0bf40b))
* **workflows:** Add permissions for contents and pull-requests
([#439](#439))
([568722a](568722a))


### 📚 Documentation

* update documentation on SetProviderAsync
([#449](#449))
([858b286](858b286))
* Update README with spec version
([#437](#437))
([7318b81](7318b81)),
closes [#204](#204)


### 🔄 Refactoring

* InMemoryProvider throwing when types mismatched
([#442](#442))
([8ecf50d](8ecf50d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: OpenFeature Bot <[email protected]>
WeihanLi pushed a commit to WeihanLi/openfeature-dotnet-sdk that referenced this pull request May 14, 2025
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR
<!-- add the description of the PR here -->

This pull request introduces a significant refactor to the codebase by
converting all namespace declarations to file-scoped namespaces and
updating the `.editorconfig` to enforce this style. Additionally, it
simplifies the structure of multiple files by removing unnecessary
closing braces for namespace blocks.

### Namespace Refactoring:
* Converted all namespace declarations in the `src/OpenFeature`
directory to file-scoped namespaces for consistency and improved
readability. This change affects multiple files, including `Api.cs`,
`Constants.cs`, `Error/*.cs`, `EventExecutor.cs`, and `Extension/*.cs`.
[[1]](diffhunk://#diff-dc150fbd3b7be797470374ee7e38c7ab8a31eb9b6b7a52345e05114c2d32a15eL12-R13)
[[2]](diffhunk://#diff-b0112a803c4d4783b4b829626b4970801bda0de261d9887d3d5f5de30eb49d4fL1-L9)
[[3]](diffhunk://#diff-08c95bef1c40daf926c6da5657e9333d4481a1e76b03c8749b87e58d9c711af3L3-R4)
[[4]](diffhunk://#diff-95f94f0d86864094b6a4ed191b7a08bc306c6b2f21eb061b7de319aa9fa19e3fL1-R2)
[[5]](diffhunk://#diff-591e2f16844f704f064cbe31b7427e66c6f816f421a970fc7ad6fe1ad3c4c220L1-R2)R1,
[[6]](diffhunk://#diff-04e7c0ae5d31a3d10742b06dd413c512ee002ce27ce7b3b39cca79598c381a68L3-R4)
[[7]](diffhunk://#diff-0c85dcfcfa3c97d37ee0ba4394ca6958a14c013ee0940aaea09cefd2686bf41fL1-R2)
[[8]](diffhunk://#diff-a7a382f3d0da52015d1b9e03802692a86c61e7b57580747f31fae37d8dcc5cd6L4-R5)
[[9]](diffhunk://#diff-b9fdde9b61e62d7c474069ea5fc2a43d123ab86d93cb9a6d0673254a64536722L5-R6)
[[10]](diffhunk://#diff-bb4aadb03ea44e3b6b74b83f12b2b1a258e13836bcf815f996addcd5537a478fL5-R6)
[[11]](diffhunk://#diff-89efe60a8b640cc303a38e5b01bc27ad40599e364ff2654a57b7e42138056cdaL5-R6)
[[12]](diffhunk://#diff-7a8cbfba7673f1b69d3d927f60eb4ab0aa548403a118fad9eb43b9a22875dc02L5-R6)
[[13]](diffhunk://#diff-48ae8447bc31a75ecf4bba768a7b68244fbbc9dd5480db9114d9c74fb10fe2efL5-R6)
[[14]](diffhunk://#diff-9a3b5bf7bf3351a6161fc6dd75830bfbaab7aca730cf3f0ae6cd120a76b2f1b1L5-R6)
[[15]](diffhunk://#diff-c4388b2e7252e2e3ac0967dbfdd4647a924cdfc54da229667a0db3613b243a7eL5-R6)
[[16]](diffhunk://#diff-44c88ae43caf99ee733ec911fa85454a96c57d07fc57d2fadd44e12cd7d31cd4L5-R6)
[[17]](diffhunk://#diff-f563baadcf750bb66efaea76d7ec4783320e6efdc45c468effb531c948a2292cL10-R11)
[[18]](diffhunk://#diff-f94bf65f426e13a14f798a8db21a5c9dd3306f5941bde1aba79af3e41421bfc0L5-R6)
[[19]](diffhunk://#diff-484832cfacaa02b6872a26cf5202843e96e0125281deca5798974879d9d609a0L3-R4)

### Code Style Enforcement:
* Updated `.editorconfig` to include a new rule
(`csharp_style_namespace_declarations = file_scoped:warning`) to enforce
the use of file-scoped namespaces.

### Simplification of Code Structure:
* Removed unnecessary closing braces for namespace blocks in all
affected files, as they are no longer required with file-scoped
namespaces. This change simplifies the code and reduces visual clutter.
[[1]](diffhunk://#diff-dc150fbd3b7be797470374ee7e38c7ab8a31eb9b6b7a52345e05114c2d32a15eL369)
[[2]](diffhunk://#diff-b0112a803c4d4783b4b829626b4970801bda0de261d9887d3d5f5de30eb49d4fL1-L9)
[[3]](diffhunk://#diff-08c95bef1c40daf926c6da5657e9333d4481a1e76b03c8749b87e58d9c711af3L56)
[[4]](diffhunk://#diff-95f94f0d86864094b6a4ed191b7a08bc306c6b2f21eb061b7de319aa9fa19e3fL25)
[[5]](diffhunk://#diff-591e2f16844f704f064cbe31b7427e66c6f816f421a970fc7ad6fe1ad3c4c220L28)
[[6]](diffhunk://#diff-04e7c0ae5d31a3d10742b06dd413c512ee002ce27ce7b3b39cca79598c381a68L36)
[[7]](diffhunk://#diff-0c85dcfcfa3c97d37ee0ba4394ca6958a14c013ee0940aaea09cefd2686bf41fL50)
[[8]](diffhunk://#diff-a7a382f3d0da52015d1b9e03802692a86c61e7b57580747f31fae37d8dcc5cd6L29)
[[9]](diffhunk://#diff-b9fdde9b61e62d7c474069ea5fc2a43d123ab86d93cb9a6d0673254a64536722L23)
[[10]](diffhunk://#diff-bb4aadb03ea44e3b6b74b83f12b2b1a258e13836bcf815f996addcd5537a478fL23)
[[11]](diffhunk://#diff-89efe60a8b640cc303a38e5b01bc27ad40599e364ff2654a57b7e42138056cdaL23)
[[12]](diffhunk://#diff-7a8cbfba7673f1b69d3d927f60eb4ab0aa548403a118fad9eb43b9a22875dc02L23)
[[13]](diffhunk://#diff-48ae8447bc31a75ecf4bba768a7b68244fbbc9dd5480db9114d9c74fb10fe2efL23)
[[14]](diffhunk://#diff-9a3b5bf7bf3351a6161fc6dd75830bfbaab7aca730cf3f0ae6cd120a76b2f1b1L23)
[[15]](diffhunk://#diff-c4388b2e7252e2e3ac0967dbfdd4647a924cdfc54da229667a0db3613b243a7eL23)
[[16]](diffhunk://#diff-44c88ae43caf99ee733ec911fa85454a96c57d07fc57d2fadd44e12cd7d31cd4L23)
[[17]](diffhunk://#diff-f563baadcf750bb66efaea76d7ec4783320e6efdc45c468effb531c948a2292cL356)
[[18]](diffhunk://#diff-f94bf65f426e13a14f798a8db21a5c9dd3306f5941bde1aba79af3e41421bfc0L16)
[[19]](diffhunk://#diff-484832cfacaa02b6872a26cf5202843e96e0125281deca5798974879d9d609a0L13)

### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->

Fixes open-feature#447

### Notes
<!-- any additional notes for this PR -->

I ran the `dotnet format OpenFeature.sln` to clean up the code. As you
can imagine, this generates a big diff. I would advise enabling `Hide
Whitespace` to review this PR, since it will show the conversion from
nested to file namespaces.

---------

Signed-off-by: André Silva <[email protected]>
Signed-off-by: Weihan Li <[email protected]>
WeihanLi pushed a commit to WeihanLi/openfeature-dotnet-sdk that referenced this pull request May 14, 2025
🤖 I have created a release *beep* *boop*
---

##
[2.5.0](open-feature/dotnet-sdk@v2.4.0...v2.5.0)
(2025-04-25)

### ✨ New Features

* Add support for hook data.
([open-feature#387](open-feature#387))
([4563512](open-feature@4563512))

### 🧹 Chore

* add NuGet auditing
([open-feature#454](open-feature#454))
([42ab536](open-feature@42ab536))
* Change file scoped namespaces and cleanup job
([open-feature#453](open-feature#453))
([1e74a04](open-feature@1e74a04))
* **deps:** update codecov/codecov-action action to v5.4.2
([open-feature#432](open-feature#432))
([c692ec2](open-feature@c692ec2))
* **deps:** update github/codeql-action digest to 28deaed
([open-feature#446](open-feature#446))
([dfecd0c](open-feature@dfecd0c))
* **deps:** update spec digest to 18cde17
([open-feature#395](open-feature#395))
([5608dfb](open-feature@5608dfb))
* **deps:** update spec digest to 2ba05d8
([open-feature#452](open-feature#452))
([eb688c4](open-feature@eb688c4))
* **deps:** update spec digest to 36944c6
([open-feature#450](open-feature#450))
([e162169](open-feature@e162169))
* **deps:** update spec digest to d27e000
([open-feature#455](open-feature#455))
([e0ec8ca](open-feature@e0ec8ca))
* packages read in release please
([1acc00f](open-feature@1acc00f))
* update release permissions
([d0bf40b](open-feature@d0bf40b))
* **workflows:** Add permissions for contents and pull-requests
([open-feature#439](open-feature#439))
([568722a](open-feature@568722a))

### 📚 Documentation

* update documentation on SetProviderAsync
([open-feature#449](open-feature#449))
([858b286](open-feature@858b286))
* Update README with spec version
([open-feature#437](open-feature#437))
([7318b81](open-feature@7318b81)),
closes [open-feature#204](open-feature#204)

### 🔄 Refactoring

* InMemoryProvider throwing when types mismatched
([open-feature#442](open-feature#442))
([8ecf50d](open-feature@8ecf50d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: OpenFeature Bot <[email protected]>
Signed-off-by: Weihan Li <[email protected]>
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.

Normalize namespace rules
3 participants