Skip to content

Commit

Permalink
Explicitly treat Warnings as Errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryCordewener committed Jan 3, 2024
1 parent 7409ee1 commit 6bfbc20
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 35 deletions.
8 changes: 4 additions & 4 deletions TelnetNegotiationCore.TestClient/MockClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public MockClient(string ip, int port, ILogger? logger = null)
}
}

private async Task WriteToOutputStream(byte[] arg, StreamWriter writer) => await writer.BaseStream.WriteAsync(arg, 0, arg.Length);
private static async Task WriteToOutputStream(byte[] arg, StreamWriter writer) => await writer.BaseStream.WriteAsync(arg, CancellationToken.None);

public Task WriteBack(byte[] writeback, Encoding encoding)
public static Task WriteBack(byte[] writeback, Encoding encoding)
{
string str = encoding.GetString(writeback);
Console.WriteLine(str);
Expand All @@ -54,12 +54,12 @@ public Task SignalNAWS(int height, int width)

public void Handle(object? obj)
{
var client = (TcpClient)obj;
var client = (TcpClient)obj!;
int port = -1;

try
{
port = ((IPEndPoint)client.Client.RemoteEndPoint).Port;
port = ((IPEndPoint)client.Client.RemoteEndPoint!).Port;

using var stream = client.GetStream();
using var input = new StreamReader(stream);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -7,6 +7,14 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
Expand Down
65 changes: 35 additions & 30 deletions TelnetNegotiationCore/TelnetNegotiationCore.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Version>1.0.0</Version>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>Telnet Negotiation Core</Title>
Expand All @@ -16,36 +16,41 @@
<RepositoryType>git</RepositoryType>
<PackageTags>telnet</PackageTags>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("CHANGELOG.md"))</PackageReleaseNotes>
<Copyright>Copyright © TelnetNegotiationCore Contributors 2024-$([System.DateTime]::Now.ToString(yyyy))</Copyright>
</PropertyGroup>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("CHANGELOG.md"))</PackageReleaseNotes>
<Copyright>Copyright © TelnetNegotiationCore Contributors 2024-$([System.DateTime]::Now.ToString(yyyy))</Copyright>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<None Include="..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\Telnet.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<None Include="..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\Telnet.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
<ItemGroup>
<None Include="..\LICENSE" Pack="true" PackagePath="" />
<PackageReference Include="morelinq" Version="3.4.2" />
<PackageReference Include="OneOf" Version="3.0.255" />
<PackageReference Include="Serilog" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="stateless" Version="5.13.0" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="morelinq" Version="3.4.2" />
<PackageReference Include="OneOf" Version="3.0.255" />
<PackageReference Include="Serilog" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="stateless" Version="5.13.0" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
</ItemGroup>

</Project>

0 comments on commit 6bfbc20

Please sign in to comment.