Skip to content

Commit

Permalink
Treat warnings as errors for initial projects (#15019)
Browse files Browse the repository at this point in the history
* Treat warnings as errors for Umbraco.Cms, Umbraco.Cms.Api.Common and Umbraco.Cms.Api.Delivery projects.

* Treat warnings as errors for Umbraco.Cms.Imaging.ImageSharp and Umbraco.Cms.Imaging.ImageSharp2 projects

* Treat warnings as errors for Umbraco.Cms.Persistence.EFCore.Sqlite, Umbraco.Cms.Persistence.EFCore.SqlServer and Umbraco.Cms.StaticAssets

* Treat warnings as errors for Umbraco.Cms.Targets

* Treat warnings as errors for templates/Umbraco.Templates and Umbraco.JsonSchema

* More projects with warnings as errors.

* Reverted warnings as errors due to some file changes since the update.

* Remove unwanted tag

* Removed warnings as errors on TestData project

* Implement warnings as errors in props file, and exclude specific warnings where appropriate as per PR review suggestions.

* Reverted spaces

* Revert "Reverted spaces"

This reverts commit 3734c45.

* Update sdk version to fully support Umbraco.code 2.2.0 dependency on Microsoft.CodeAnalysis.CSharp.Workspaces 4.10.0

* Ignore PathToLongErrors for now in static assets

---------

Co-authored-by: Emma Garland <emma.garland@rocksolidknowledge.com>
Co-authored-by: Sven Geusens <sge@umbraco.dk>
  • Loading branch information
3 people authored Aug 27, 2024
1 parent 148d51b commit 98e9a30
Show file tree
Hide file tree
Showing 28 changed files with 90 additions and 26 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<NeutralLanguage>en-US</NeutralLanguage>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "8.0.300",
"rollForward": "latestFeature"
}
}
1 change: 0 additions & 1 deletion src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<Title>Umbraco CMS - API Common</Title>
<Description>Contains the bits and pieces that are shared between the Umbraco CMS APIs.</Description>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion src/Umbraco.Cms.Api.Delivery/Umbraco.Cms.Api.Delivery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
<Title>Umbraco CMS - Delivery API</Title>
<Description>Contains the presentation layer for the Umbraco CMS Delivery API.</Description>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: [ASP0019] use IHeaderDictionary.Append or the indexer to append or set headers and remove this override -->
<WarningsNotAsErrors>ASP0019</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Cms.Api.Common\Umbraco.Cms.Api.Common.csproj" />
<ProjectReference Include="..\Umbraco.Web.Common\Umbraco.Web.Common.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
<AssemblyName>Umbraco.Cms.Api.Management</AssemblyName>
<RootNamespace>Umbraco.Cms.Api.Management</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JsonPatch.Net" />
<PackageReference Include="Swashbuckle.AspNetCore" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<Title>Umbraco CMS - Imaging - ImageSharp</Title>
<Description>Adds imaging support using ImageSharp/ImageSharp.Web to Umbraco CMS.</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" />
<PackageReference Include="SixLabors.ImageSharp.Web" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<Title>Umbraco CMS - Imaging - ImageSharp 2</Title>
<Description>Adds imaging support using ImageSharp/ImageSharp.Web version 2 to Umbraco CMS.</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" VersionOverride="[2.1.9, 3)" />
<PackageReference Include="SixLabors.ImageSharp.Web" VersionOverride="[2.0.2, 3)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<Title>Umbraco CMS - Persistence - Entity Framework Core - SQL Server migrations</Title>
<Description>Adds support for Entity Framework Core SQL Server migrations to Umbraco CMS.</Description>
</PropertyGroup>

<ItemGroup>
<!-- Take top-level depedendency on Azure.Identity, because Microsoft.EntityFrameworkCore.SqlServer depends on a vulnerable version -->
<PackageReference Include="Azure.Identity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<Title>Umbraco CMS - Persistence - Entity Framework Core - SQLite migrations</Title>
<Description>Adds support for Entity Framework Core SQLite migrations to Umbraco CMS.</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
<Title>Umbraco CMS - Persistence - Entity Framework Core</Title>
<Description>Adds support for Entity Framework Core to Umbraco CMS.</Description>
</PropertyGroup>

<ItemGroup>
<PropertyGroup>
<!-- TODO: [IDE0270] Simplify null checks, [CS0108] resolve hiding inherited members, [CS1998] remove async or make method synchronous,
and remove this override -->
<WarningsNotAsErrors>IDE0270,CS0108,CS1998</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<!-- Take top-level depedendency on Azure.Identity, because Microsoft.EntityFrameworkCore.SqlServer depends on a vulnerable version -->
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
<Title>Umbraco CMS - Persistence - SQL Server</Title>
<Description>Adds support for SQL Server to Umbraco CMS.</Description>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: [SA1405] Simplify null checks, [SA1121] resolve hiding inherited members, [SA1117] remove async or make method synchronous,
[IDE1006] fix naming rule violation, [CS0618] handle member obsolete appropriately, [IDE0270] simplify null check, [IDE0057] simplify substring,
[IDE0054] use compound assignment, [CSO618] use NVARCARMAX, [IDE0048] add parenthesis for clarity, [CS1574] resolve ML comment cref attribute and remove this override -->
<WarningsNotAsErrors>SA1405,SA1121,SA1117,SA1116,IDE1006,CS0618,IDE0270,IDE0057,IDE0054,CSO618,IDE0048,CS1574</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<!-- Take top-level depedendency on Azure.Identity, because NPoco.SqlServer depends on a vulnerable version -->
<PackageReference Include="Azure.Identity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
<Title>Umbraco CMS - Persistence - SQLite</Title>
<Description>Adds support for SQLite to Umbraco CMS.</Description>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: [CS0114] Resolve hiding inherited members and remove this override -->
<WarningsNotAsErrors>CS0114</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" />
</ItemGroup>
Expand Down
7 changes: 6 additions & 1 deletion src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
<StaticWebAssetBasePath>/</StaticWebAssetBasePath>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: [NU5123] Rename files so path is shorter -->
<WarningsNotAsErrors>NU5123</WarningsNotAsErrors>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<ProjectReference Include="..\Umbraco.Cms.Api.Management\Umbraco.Cms.Api.Management.csproj" />
Expand Down Expand Up @@ -66,4 +71,4 @@
</ItemGroup>
<RemoveDir Directories="@(LoginDirectories)" />
</Target>
</Project>
</Project>
6 changes: 5 additions & 1 deletion src/Umbraco.Cms.Targets/Umbraco.Cms.Targets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: [IDE0270] Simplify null checks, [CS0108] resolve hiding inherited members, [CS1998] remove async or make method synchronous,
and remove this override -->
<WarningsNotAsErrors>IDE0270,CS0108,CS1998</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Cms.Api.Delivery\Umbraco.Cms.Api.Delivery.csproj" />
<ProjectReference Include="..\Umbraco.Cms.StaticAssets\Umbraco.Cms.StaticAssets.csproj" />
Expand Down
1 change: 0 additions & 1 deletion src/Umbraco.Cms/Umbraco.Cms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Umbraco.Cms.Targets\Umbraco.Cms.Targets.csproj" />
<ProjectReference Include="..\Umbraco.Cms.Imaging.ImageSharp\Umbraco.Cms.Imaging.ImageSharp.csproj" />
Expand Down
5 changes: 4 additions & 1 deletion src/Umbraco.Core/Umbraco.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<Description>Contains the core assembly needed to run Umbraco CMS.</Description>
<RootNamespace>Umbraco.Cms.Core</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" />
Expand Down
5 changes: 4 additions & 1 deletion src/Umbraco.Examine.Lucene/Umbraco.Examine.Lucene.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<Description>Adds Examine searching support using Lucene to Umbraco CMS.</Description>
<RootNamespace>Umbraco.Cms.Infrastructure.Examine</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: [CS0618] Handle member obsolete appropriately and remove this override -->
<WarningsNotAsErrors>CS0618</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Examine" />
<!-- Take top-level depedendency on System.Security.Cryptography.Xml, because Examine depends on a vulnerable version -->
Expand Down
5 changes: 4 additions & 1 deletion src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<Description>Contains the infrastructure assembly needed to run Umbraco CMS.</Description>
<RootNamespace>Umbraco.Cms.Infrastructure</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>$(DefineConstants);TRACE_SCOPES</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<Description>Contains the published cache assembly needed to run Umbraco CMS.</Description>
<RootNamespace>Umbraco.Cms.Infrastructure.PublishedCache</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Umbraco.CSharpTest.Net.Collections" />
<PackageReference Include="MessagePack" />
Expand Down
5 changes: 4 additions & 1 deletion src/Umbraco.Web.Common/Umbraco.Web.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<Description>Contains the web assembly needed to run Umbraco CMS.</Description>
<RootNamespace>Umbraco.Cms.Web.Common</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<EnablePackageValidation>false</EnablePackageValidation>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: [SA1119] Correct unnecessary parenthesis and remove this override -->
<WarningsNotAsErrors>SA1119</WarningsNotAsErrors>
</PropertyGroup>
<Import Project="..\Umbraco.Cms.Targets\buildTransitive\Umbraco.Cms.Targets.props" />
<Import Project="..\Umbraco.Cms.Targets\buildTransitive\Umbraco.Cms.Targets.targets" />
<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion src/Umbraco.Web.Website/Umbraco.Web.Website.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<Description>Contains the website assembly needed to run the frontend of Umbraco CMS.</Description>
<RootNamespace>Umbraco.Cms.Web.Website</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Web.Common\Umbraco.Web.Common.csproj" />
</ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions tests/Umbraco.TestData/Umbraco.TestData.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- TODO: [CS0618] handle member obsolete appropriately, [IDE1006] fix naming rule violation,
[IDE0057] simplify substring and remove this override -->
<WarningsNotAsErrors>CS0618,IDE1006,IDE0057</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bogus" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" />
Expand Down
5 changes: 4 additions & 1 deletion tests/Umbraco.Tests.Common/Umbraco.Tests.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
<IsPackable>true</IsPackable>
<EnablePackageValidation>$(BaseEnablePackageValidation)</EnablePackageValidation>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoFixture.AutoMoq" />
<PackageReference Include="Moq" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
<EnablePackageValidation>$(BaseEnablePackageValidation)</EnablePackageValidation>
<NoWarn>NU5100</NoWarn>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bogus" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
Expand Down
5 changes: 4 additions & 1 deletion tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<IsPackable>false</IsPackable>
<EnablePackageValidation>false</EnablePackageValidation>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NUnit3TestAdapter" />
Expand Down
5 changes: 4 additions & 1 deletion tools/Umbraco.JsonSchema/Umbraco.JsonSchema.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
<IsPackable>false</IsPackable>
<EnablePackageValidation>false</EnablePackageValidation>
</PropertyGroup>

<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" VersionOverride="2.9.1" />
<PackageReference Include="NJsonSchema" VersionOverride="11.0.2" />
Expand Down

0 comments on commit 98e9a30

Please sign in to comment.