-
Notifications
You must be signed in to change notification settings - Fork 1.6k
chore: migrate to Primary constructors and collection expressions #532
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
chore: migrate to Primary constructors and collection expressions #532
Conversation
There was a problem hiding this 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 modernizes the codebase by migrating to C# 12 primary constructors and collection expressions, replacing traditional constructors and array initialization syntax with their more concise modern equivalents.
- Replaces traditional constructors with primary constructor syntax
- Updates array initializations from
new[] { }
syntax to collection expressions[ ]
- Converts constructor parameter assignments to property initializers
Reviewed Changes
Copilot reviewed 75 out of 75 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
Utilities.Tests/Extensions/MatrixExtensionsTests.cs | Updates test data arrays to use collection expressions |
DataStructures/UnrolledList/UnrolledLinkedListNode.cs | Converts to primary constructor with property initializers |
DataStructures/UnrolledList/UnrolledLinkedList.cs | Migrates to primary constructor pattern |
DataStructures/SortedList.cs | Updates constructor to primary constructor syntax |
DataStructures/SegmentTrees/SegmentTreeUpdate.cs | Converts to primary constructor pattern |
DataStructures/ScapegoatTree/Node.cs | Migrates to primary constructor with property initializers |
DataStructures/RedBlackTree/RedBlackTreeNode.cs | Updates to primary constructor pattern |
DataStructures/LinkedList/SkipList/SkipListNode.cs | Converts to primary constructor syntax |
DataStructures/LinkedList/SinglyLinkedList/SinglyLinkedListNode.cs | Migrates to primary constructor pattern |
DataStructures/LinkedList/DoublyLinkedList/DoublyLinkedListNode.cs | Updates to primary constructor syntax |
DataStructures/Heap/PairingHeap/PairingNodeComparer.cs | Converts to primary constructor pattern |
DataStructures/Heap/PairingHeap/PairingHeapNode.cs | Migrates to primary constructor syntax |
DataStructures/Heap/PairingHeap/PairingHeap.cs | Updates to primary constructor pattern |
DataStructures/Hashing/Entry.cs | Converts to primary constructor syntax |
DataStructures/Cache/LruCache.cs | Migrates to primary constructor pattern |
DataStructures/Cache/LfuCache.cs | Updates to primary constructor syntax |
DataStructures/BitArray.cs | Converts array initialization to collection expression |
DataStructures/BinarySearchTree/BinarySearchTreeNode.cs | Migrates to primary constructor pattern |
DataStructures/AVLTree/AVLTreeNode.cs | Updates to primary constructor syntax |
DataStructures/AATree/AATreeNode.cs | Converts to primary constructor pattern |
DataStructures/AATree/AATree.cs | Migrates to primary constructor syntax |
Various test files | Updates test arrays to use collection expressions |
Algorithm files | Migrates classes to primary constructors and updates array initializations |
Comments suppressed due to low confidence (2)
DataStructures/AATree/AATree.cs:1
- [nitpick] The parameterless constructor is redundant since it only sets the comparer to the default value. Consider creating a second primary constructor that uses Comparer.Default as the default parameter value instead of maintaining two constructors.
using System;
DataStructures/SortedList.cs:1
- [nitpick] The parameterless constructor is inconsistent with the primary constructor pattern used elsewhere in this PR. Consider removing this constructor and using a default parameter value in the primary constructor instead.
using System.Collections;
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #532 +/- ##
==========================================
+ Coverage 95.22% 96.61% +1.38%
==========================================
Files 274 274
Lines 10910 10835 -75
Branches 1535 1535
==========================================
+ Hits 10389 10468 +79
+ Misses 397 232 -165
- Partials 124 135 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…odebase Add tests for `AStar` and related classes to validate A* algorithm functionality.
Looks good, but please fix Codacy issues before I can merge |
I think the remaining medium is more of a false positive than anything else, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Moving the solution to using Primary constructors and collection expressions as per issue #520