-
Notifications
You must be signed in to change notification settings - Fork 1
Release/v0.1.0 #61
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
Release/v0.1.0 #61
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more |
Add [SquiggleCop](https://github.com/MattKotsenas/SquiggleCop) to prevent unintended changes to Roslyn analyzers --------- Signed-off-by: Richard Murillo <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Adds `.globalconfig` to enable pattern matching Resolves #27
…trings (ECS0004) (#41) This pull request introduces a new Roslyn analyzer and code fix to enforce the use of interpolated strings instead of `string.Format`. This change addresses the recommendations outlined in Effective C#: 50 Specific Ways to Improve your C#. ## Rule Details ### Rule ID: ECS0004 **Title:** Replace string.Format with interpolated string **Category:** Style **Description:** This rule identifies instances of `string.Format` and suggests replacing them with C# interpolated strings for improved readability and reduced error potential.
Related: BillWagner/EffectiveCSharpAnalyzers#7 Closes #32 The problem addressed by this rule is the use of methods that should involve callback mechanisms without employing delegates for this purpose. Specifically, methods are being invoked directly without the use of delegate types such as `Predicate<T>`, `Action<T>`, or `Func<T>`, which are designed to handle callbacks in a type-safe and consistent manner.
Signed-off-by: Richard Murillo <[email protected]>
) This pull request introduces a new analyzer rule, ECS0008, which is designed to enforce the use of the null-conditional operator when invoking event handlers in C#. This practice helps prevent potential `NullReferenceExceptions`, improving the safety and robustness of the code. Key Features: - **Detection of Potential Violations**: The rule identifies patterns where an event handler is invoked without using the null-conditional operator (`?.Invoke`), such as direct invocations or invocations within an `if` statement checking for `null`. - **Automatic Code Fixes**: The code fix provider automatically replaces the identified pattern with the null-conditional operator, ensuring that the event handler is only invoked when it has subscribers. - **Comprehensive Coverage**: The rule handles cases where the event handler is checked directly and cases where it is first assigned to a local variable. Example Violation: ```csharp public class EventSource { private EventHandler<int> Updated; private int counter; public void RaiseUpdates() { counter++; if (Updated != null) Updated(this, counter); } } ``` Fixed code: ```csharp public class EventSource { private EventHandler<int> Updated; private int counter; public void RaiseUpdates() { counter++; Updated?.Invoke(this, counter); } } ```
The ECS1000 analyzer for `Span<T>` is not part of Effective C# and is removed
This pull request introduces a new Roslyn analyzer and associated code fix provider to enforce best practices for culture-specific string formatting in C#. The analyzer identifies cases where `FormattableString` or `string.Create` should be used instead of string for interpolated strings, depending on the target framework version. The code fix provider automatically suggests the appropriate replacement. ## Changes - Analyzer: `FormattableStringForCultureSpecificStringsAnalyzer` - Detects culture-specific string usage and recommends either `FormattableString`, `string.Create`, or `string.Format` based on the .NET version. - Code Fix Provider: `FormattableStringForCultureSpecificStringsCodeFixProvider` - Provides automated fixes based on the analyzer's recommendations. - Tests: Comprehensive unit tests covering various scenarios, including different .NET versions and complex string interpolation cases. This analyzer aligns modern C# and .NET practices, particularly Stephen Toub's guidance on using `string.Create` in .NET 6+
Signed-off-by: Richard Murillo <[email protected]>
## Changes - Update build matrix to use latest version of Ubuntu and Windows - Update release workflow to trigger when releases are published, edited, pre-released, or released - Move performance baseline forward - Update .NET SDK version to 8.0.400 - Move analyzer rules to shipped - Update numbering of analyzer rules to leave room for sub rules - Updated analyzer strings for title, message format, description to `LocalizableString` - Update `version.json` to use `0.1.0`
Signed-off-by: Richard Murillo <[email protected]>
Signed-off-by: Richard Murillo <[email protected]>
2062652
to
29add09
Compare
No description provided.