Skip to content

Commit

Permalink
CSharpier format
Browse files Browse the repository at this point in the history
  • Loading branch information
gstraccini[bot] committed Oct 26, 2024
1 parent bd38709 commit dd6df0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/commit_message_processor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

public class CommitMessageProcessor

Check warning on line 4 in src/commit_message_processor.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/commit_message_processor.cs#L4

Add a 'protected' constructor or the 'static' keyword to the class declaration.
{
private static readonly string semverPattern = @"\+semver:\s?(breaking|major|feature|minor|fix|patch|none|skip)";
private static readonly string semverPattern =
@"\+semver:\s?(breaking|major|feature|minor|fix|patch|none|skip)";

public static string ProcessCommitMessage(string originalMessage)

Check warning on line 9 in src/commit_message_processor.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/commit_message_processor.cs#L9

When using `System.Text.RegularExpressions` to process untrusted input, pass a timeout.
{
Expand Down Expand Up @@ -32,6 +33,6 @@ public static void Main(string[] args)
}
}

// Note: This is a basic implementation. In a real-world scenario,
// Note: This is a basic implementation. In a real-world scenario,
// you would integrate this into your commit handling workflow.
// Additionally, you would write unit tests to validate the behavior.
12 changes: 9 additions & 3 deletions tests/commit_message_processor_tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
public class CommitMessageProcessorTests
{
[Theory]
[InlineData("+semver: minor Initial commit with some features", "Initial commit with some features +semver: minor")]
[InlineData(
"+semver: minor Initial commit with some features",
"Initial commit with some features +semver: minor"
)]
[InlineData("Fixing bug +semver: patch", "Fixing bug +semver: patch")]
[InlineData("+semver: major Breaking changes introduced", "Breaking changes introduced +semver: major")]
[InlineData(
"+semver: major Breaking changes introduced",
"Breaking changes introduced +semver: major"
)]
[InlineData("Refactoring code +semver: none", "Refactoring code +semver: none")]
[InlineData("No version bump here", "No version bump here")]
public void TestProcessCommitMessage(string originalMessage, string expectedProcessedMessage)
Expand Down Expand Up @@ -43,5 +49,5 @@ public void TestProcessCommitMessageWithWhitespaceOnly()
}
}

// Note: This is a basic set of tests. In a real-world scenario,
// Note: This is a basic set of tests. In a real-world scenario,
// you would expand these tests to cover more edge cases and scenarios.

0 comments on commit dd6df0a

Please sign in to comment.