Skip to content

Commit

Permalink
Changing root namespace so it isn't the same as the class name to fix s…
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdunlop committed Jan 8, 2021
1 parent 28ea41a commit 78c9cb0
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 76 deletions.
6 changes: 3 additions & 3 deletions ProfanityFilter.Tests.Unit/AllowListTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ProfanityFilter;
using ProfanityFilter.Interfaces;
using ProfanityDetector;
using ProfanityDetector.Interfaces;

namespace ProfanityFilter.Tests.Unit
namespace ProfanityDetector.Tests.Unit
{
[TestClass]
public class AllowListTests
Expand Down
4 changes: 2 additions & 2 deletions ProfanityFilter.Tests.Unit/ProfanityBaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ProfanityFilter.Interfaces;
using ProfanityDetector.Interfaces;

namespace ProfanityFilter.Tests.Unit
namespace ProfanityDetector.Tests.Unit
{
[TestClass]
public class ProfanityBaseTests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>

<IsPackable>false</IsPackable>
<ReleaseVersion>0.1.2</ReleaseVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<NoStdLib>true</NoStdLib>
<WarningsNotAsErrors></WarningsNotAsErrors>
<Optimize>true</Optimize>
<NoStdLib>true</NoStdLib>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ProfanityFilter\ProfanityFilter\ProfanityFilter.csproj" />
</ItemGroup>
<ItemGroup>
<None Remove=".DS_Store" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>

<IsPackable>false</IsPackable>
<ReleaseVersion>0.1.2</ReleaseVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<NoStdLib>true</NoStdLib>
<WarningsNotAsErrors></WarningsNotAsErrors>
<Optimize>true</Optimize>
<NoStdLib>true</NoStdLib>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ProfanityFilter\ProfanityFilter\ProfanityDetector.csproj" />
</ItemGroup>
<ItemGroup>
<None Remove=".DS_Store" />
</ItemGroup>
</Project>
15 changes: 11 additions & 4 deletions ProfanityFilter/ProfanityFilter.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProfanityFilter", "ProfanityFilter\ProfanityFilter.csproj", "{8067C4ED-6D76-417C-A22D-BD748ED0424C}"
# Visual Studio Version 16
VisualStudioVersion = 16.0.30309.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProfanityDetector", "ProfanityFilter\ProfanityDetector.csproj", "{8067C4ED-6D76-417C-A22D-BD748ED0424C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProfanityFilter.Tests.Unit", "..\ProfanityFilter.Tests.Unit\ProfanityFilter.Tests.Unit.csproj", "{4B6BFD9A-3AC0-4705-AAB6-24C688E98B8D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProfanityDetector.Tests.Unit", "..\ProfanityFilter.Tests.Unit\ProfanityDetector.Tests.Unit.csproj", "{4B6BFD9A-3AC0-4705-AAB6-24C688E98B8D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -20,6 +21,12 @@ Global
{4B6BFD9A-3AC0-4705-AAB6-24C688E98B8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B6BFD9A-3AC0-4705-AAB6-24C688E98B8D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EC293009-F0E4-4A39-9DAD-04B1AF6BE537}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
version = 0.1.2
EndGlobalSection
Expand Down
4 changes: 2 additions & 2 deletions ProfanityFilter/ProfanityFilter/AllowList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using ProfanityFilter.Interfaces;
using ProfanityDetector.Interfaces;

namespace ProfanityFilter
namespace ProfanityDetector
{
public class AllowList : IAllowList
{
Expand Down
2 changes: 1 addition & 1 deletion ProfanityFilter/ProfanityFilter/Interfaces/IAllowList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System;
using System.Collections.ObjectModel;

namespace ProfanityFilter.Interfaces
namespace ProfanityDetector.Interfaces
{
public interface IAllowList
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace ProfanityFilter.Interfaces
namespace ProfanityDetector.Interfaces
{
public interface IProfanityFilter
{
Expand Down
2 changes: 1 addition & 1 deletion ProfanityFilter/ProfanityFilter/ProfanityBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Collections.Generic;
using System.Globalization;

namespace ProfanityFilter
namespace ProfanityDetector
{
public partial class ProfanityBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackOnBuild>true</PackOnBuild>
<PackageId>Profanity.Detector</PackageId>
<PackageVersion>0.1.8</PackageVersion>
<Authors>Stephen Haunts</Authors>
<NeutralLanguage>en</NeutralLanguage>
<PackageLicenseUrl>https://github.com/stephenhaunts/ProfanityDetector/blob/master/LICENSE</PackageLicenseUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Owners>Stephen Haunts</Owners>
<PackageProjectUrl>https://github.com/stephenhaunts/ProfanityDetector</PackageProjectUrl>
<PackageTags>Profanity Filter, Profanity Detector</PackageTags>
<Title>Profanity Detector</Title>
<Description>Profanity Filter used to detect or censor text in an application. You can use the inbuilt profanity list, or load up your organizations custom list.</Description>
<ReleaseVersion>0.1.2</ReleaseVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Optimize>false</Optimize>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackOnBuild>true</PackOnBuild>
<PackageId>Profanity.Detector</PackageId>
<PackageVersion>0.1.8</PackageVersion>
<Authors>Stephen Haunts</Authors>
<NeutralLanguage>en</NeutralLanguage>
<PackageLicenseUrl>https://github.com/stephenhaunts/ProfanityDetector/blob/master/LICENSE</PackageLicenseUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Owners>Stephen Haunts</Owners>
<PackageProjectUrl>https://github.com/stephenhaunts/ProfanityDetector</PackageProjectUrl>
<PackageTags>Profanity Filter, Profanity Detector</PackageTags>
<Title>Profanity Detector</Title>
<Description>Profanity Filter used to detect or censor text in an application. You can use the inbuilt profanity list, or load up your organizations custom list.</Description>
<ReleaseVersion>0.1.2</ReleaseVersion>
<AssemblyName>ProfanityDetector</AssemblyName>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Optimize>false</Optimize>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
</ItemGroup>
</Project>
7 changes: 3 additions & 4 deletions ProfanityFilter/ProfanityFilter/ProfanityFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using ProfanityFilter.Interfaces;
using ProfanityDetector.Interfaces;

namespace ProfanityFilter
namespace ProfanityDetector
{
/// <summary>
///
Expand Down Expand Up @@ -276,8 +276,7 @@ public bool ContainsProfanity(string term)

foreach (Match profanity in regex.Matches(term))
{
// if any matches are found and aren't in the allowed list, we can return true here without checking further
if (!AllowList.Contains(profanity.Value.ToLower(CultureInfo.InvariantCulture)))
if (IsProfanity(profanity.Value))
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion ProfanityFilter/ProfanityFilter/ProfanityList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
namespace ProfanityFilter
namespace ProfanityDetector
{
/// <summary>
/// This class contains the profanity list.
Expand Down

0 comments on commit 78c9cb0

Please sign in to comment.