Skip to content

Commit

Permalink
Remove "git" from swear words lists
Browse files Browse the repository at this point in the history
  • Loading branch information
IEvangelist committed Feb 22, 2024
1 parent 5246bdc commit deca60d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/ProfanityFilter.Action/ProfanityProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ _ when (context.Action ?? "").StartsWith("__run") => true,
if (manualProfaneWords is { Length: > 0 })
{
filters.Add(new(
SourceName: "ManualProfaneWords.raw",
SourceName: $"ManualProfaneWords.raw({manualProfaneWords.Length})",
ProfaneWords: manualProfaneWords.ToFrozenSet()));
}

if (customProfaneWords is { Length: > 0 })
{
filters.Add(new(
SourceName: "CustomProfaneWords.url",
SourceName: $"CustomProfaneWords.url({customProfaneWords.Length})",
ProfaneWords: customProfaneWords.ToFrozenSet()));
}

Expand All @@ -178,6 +178,7 @@ private async ValueTask<FiltrationResult> ApplyProfanityFilterAsync(
{
AdditionalFilterSources = additionalFilters
});

var bodyResult = await TryApplyFilterAsync(
body, parameters: new(replacementStrategy, FilterTarget.Body)
{
Expand Down
1 change: 0 additions & 1 deletion src/ProfanityFilter.Services/Data/BritishSwearWords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ fucking cunt
fucktard
gash
ginger
git
gob shite
goddam
gorblimey
Expand Down
1 change: 0 additions & 1 deletion src/ProfanityFilter.Services/Data/GoogleBannedWords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,6 @@ gippo
girl on
girl on top
girls gone wild
git
glans
goatcx
goatse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,65 @@ public async Task FilterProfanityAsyncWithManualProfaneWords_ReturnsExpectedResu
Assert.True(result.IsFiltered);
}

[Fact]
public async Task FilterProfanityAsyncDoesNotReportFalseNegative()
{
var input = """
## Purpose
<!-- Describe the intention of the changes being proposed. What problem does it solve or functionality does it add? -->
* ...
## Does this introduce a breaking change?
<!-- Mark one with an "x". -->
```
[ ] Yes
[ ] No
```
## Pull Request Type
What kind of change does this Pull Request introduce?
<!-- Please check the one that applies to this PR using "x". -->
```
[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:
```
## How to Test
* Get the code
```
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
```
* Test the code
<!-- Add steps to run the tests suite and/or manually test -->
```
```
## What to Check
Verify that the following are valid
* ...
## Other Information
<!-- Add any other helpful information that may be needed here. -->
""";

// Act
var result = await _sut.FilterProfanityAsync(input,
new(ReplacementStrategy.MiddleAsterisk, FilterTarget.Body));

// Assert
Assert.False(result.IsFiltered);
}

[Fact]
public async Task FilterProfanityAsyncWithMiddleAsterisk_ReturnsMultiStep_Result()
{
Expand Down

0 comments on commit deca60d

Please sign in to comment.