Skip to content

Commit

Permalink
Merge pull request stephenhaunts#1 from stephenhaunts/main
Browse files Browse the repository at this point in the history
Merging upstream
  • Loading branch information
aaron-bond committed Jul 24, 2020
2 parents f0540c1 + 67032e8 commit f5188a8
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -34,3 +34,7 @@ ProfanityFilter/ProfanityFilter/bin/Release/netstandard2.1/
ProfanityFilter/.idea/.idea.ProfanityFilter/.idea/

ProfanityFilter/.idea/.idea.ProfanityFilter/

ProfanityFilter/ProfanityFilter/bin/Release/netstandard2.0/

ProfanityFilter/ProfanityFilter/Properties/PublishProfiles/
18 changes: 18 additions & 0 deletions ProfanityFilter.Tests.Unit/ProfanityTests.cs
Expand Up @@ -880,5 +880,23 @@ public void ContainsProfanityReturnsFalseWhenProfanityDoesNotExist()

Assert.IsFalse(result);
}

[TestMethod]
public void ContainsProfanityReturnsFalseWhenProfanityIsAaa()
{
var filter = new ProfanityFilter();
var result = filter.ContainsProfanity("aaa");

Assert.IsFalse(result);
}

[TestMethod]
public void ContainsProfanityReturnsTrueWhenProfanityIsADollarDollar()
{
var filter = new ProfanityFilter();
var result = filter.ContainsProfanity("a$$");

Assert.IsTrue(result);
}
}
}
2 changes: 1 addition & 1 deletion ProfanityFilter/ProfanityFilter/ProfanityFilter.cs
Expand Up @@ -272,7 +272,7 @@ public bool ContainsProfanity(string term)
return false;
}

Regex regex = new Regex(string.Format(@"(?:{0})", string.Join("|", potentialProfanities), RegexOptions.IgnoreCase));
Regex regex = new Regex(string.Format(@"(?:{0})", string.Join("|", potentialProfanities).Replace("$", "\\$"), RegexOptions.IgnoreCase));

foreach (Match profanity in regex.Matches(term))
{
Expand Down
2 changes: 1 addition & 1 deletion ProfanityFilter/ProfanityFilter/ProfanityFilter.csproj
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<PackOnBuild>true</PackOnBuild>
<PackageId>Profanity.Detector</PackageId>
<PackageVersion>0.1.5</PackageVersion>
<PackageVersion>0.1.7</PackageVersion>
<Authors>Stephen Haunts</Authors>
<NeutralLanguage>en</NeutralLanguage>
<PackageLicenseUrl>https://github.com/stephenhaunts/ProfanityDetector/blob/master/LICENSE</PackageLicenseUrl>
Expand Down

This file was deleted.

Binary file not shown.
Binary file not shown.
10 changes: 7 additions & 3 deletions README.md
Expand Up @@ -18,6 +18,10 @@ In this readme I will cover the following:

# Release notes

0.1.7 : Contains a community contributed bug fix to a regular expression.

0.1.6 : Contains a community contribution to add a new method, ContainsProfanity, that will check for a profanity without the Scunthorpe checking.

0.1.5 : Update API to remove references to a white list and instead rename it to an allow list. If you install this newget package you will need to update the method class references for the white list. No functionality has changed.

0.1.4 : Fixed issues #5 and #6
Expand All @@ -27,13 +31,13 @@ In this readme I will cover the following:

If you do not wish to download or clone this repository, then you can consume the profanity detector via [Nuget](https://www.nuget.org/packages/Profanity.Detector/).

To install via the package manager use the command (assuming version 0.1.5 of the library)
To install via the package manager use the command (assuming version 0.1.7 of the library)

Install-Package Profanity.Detector -Version 0.1.5
Install-Package Profanity.Detector -Version 0.1.7

Or via the command line

dotnet add package Profanity.Detector --version 0.1.5
dotnet add package Profanity.Detector --version 0.1.7

# Example Usage

Expand Down

0 comments on commit f5188a8

Please sign in to comment.