Skip to content

Commit

Permalink
Move to Endjin.RecommendedPractices (#75)
Browse files Browse the repository at this point in the history
* Move to Endjin.RecommendedPractices

* Remove unneeded entries in csproj

Co-authored-by: Jonathan George <Jonathan.George@endjin.com>
  • Loading branch information
jongeorge1 and jongeorge1 authored Mar 12, 2020
1 parent 0332a9c commit e30019d
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 169 deletions.
10 changes: 10 additions & 0 deletions Solutions/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Note: this file was added to your solution as a result of one or more projects using the Endjin.RecommendedPractices.Build.Common NuGet package.
# You can edit this file (e.g., to remove these comments), and it will not be updated - the package just checks for its presence, and copies
# this file. If you don't want this file (but you want to use the NuGet package that puts it here), add this setting to all projects
# using Endjin.RecommendedPractices.Build.Common:
# <EndjinDisableCodeAnalysis>true</EndjinDisableCodeAnalysis>
# and then delete this file. That setting will prevent the package from recreating this file.

# Code style rules for enforcing the endjin house style
# See: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
[*.cs]
Expand Down Expand Up @@ -68,3 +75,6 @@ dotnet_style_qualification_for_field = true:suggestion
dotnet_style_qualification_for_method = true:suggestion
dotnet_style_qualification_for_property = true:suggestion
dotnet_style_qualification_for_event = true:suggestion

# Style - using
csharp_using_directive_placement = inside_namespace:warning
6 changes: 0 additions & 6 deletions Solutions/Common.GitHub.proj

This file was deleted.

39 changes: 0 additions & 39 deletions Solutions/Common.NetStandard_2_0.proj

This file was deleted.

23 changes: 0 additions & 23 deletions Solutions/Common.NuGet.proj

This file was deleted.

12 changes: 11 additions & 1 deletion Solutions/Corvus.Extensions.Specs/Corvus.Extensions.Specs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<RootNamespace>Corvus.Extensions.Specs</RootNamespace>
<!-- Disabling SA1204 because it prioritizes static/non-static over public/non-public, which doesn't fit very well
with bindings in SpecFlow.
Disabling SA1600, SA1602 (all public types and members to be documented) because test projects need to make lots of types
public for technical reasaons, but they are not meant for public consumption, so XML doc comments are only
appropriate if they aid understanding within the project.
-->
<NoWarn>SA0001;SA1204;SA1600;SA1602;CS1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Endjin.RecommendedPractices" Version="0.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
namespace Corvus.Extensions.Specs.EnumerableExtensionsFeatures
{
#region Using Directives
// <copyright file="EnumerableExtensionsSteps.cs" company="Endjin Limited">
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

namespace Corvus.Extensions.Specs.EnumerableExtensionsFeatures
{
using System;
using System.Collections.Generic;
using System.Linq;

using TechTalk.SpecFlow;

#endregion

[Binding]
public class EnumerableExtensionsSteps
{
Expand Down
13 changes: 13 additions & 0 deletions Solutions/Corvus.Extensions.Specs/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// <copyright file="GlobalSuppressions.cs" company="Endjin Limited">
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
"StyleCop.CSharp.OrderingRules",
"SA1210:Using directives should be ordered alphabetically by namespace",
Justification = "We need this until https://github.com/SpecFlowOSS/SpecFlow/issues/1828 is fixed")]

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
"StyleCop.CSharp.OrderingRules",
"SA1633:Using directives should be ordered alphabetically by namespace",
Justification = "We need this until https://github.com/SpecFlowOSS/SpecFlow/issues/1828 is fixed")]
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
namespace Corvus.Extensions.Specs.StringExtensionsFeature.Context
// <copyright file="ExampleEnum.cs" company="Endjin Limited">
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

namespace Corvus.Extensions.Specs.StringExtensionsFeature.Context
{
internal enum ExampleEnum
{
First,
Second,
Third
Third,
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
namespace Corvus.Extensions.Specs.StringExtensionsFeature
// <copyright file="StringExtensionsSteps.cs" company="Endjin Limited">
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

namespace Corvus.Extensions.Specs.StringExtensionsFeature
{
using Corvus.Extensions;
using Corvus.Extensions.Specs.StringExtensionsFeature.Context;
using System;
using System.IO;
using System.Text;
using TechTalk.SpecFlow;
using Corvus.Extensions;
using Corvus.Extensions.Specs.StringExtensionsFeature.Context;
using NUnit.Framework;
using TechTalk.SpecFlow;

[Binding]
public class StringExtensionsSteps
Expand Down Expand Up @@ -139,6 +143,7 @@ private T GetRequiredResult<T>()
{
throw new InvalidOperationException("The result was null, but this test requires a non-null value");
}

return this.context.Get<T>("Result");
}

Expand All @@ -149,6 +154,7 @@ private T GetRequiredResult<T>()
{
return default;
}

return this.context.Get<T>("Result");
}

Expand All @@ -158,6 +164,7 @@ private string GetRequiredSubject()
{
throw new InvalidOperationException("The subject was null, but this test requires a non-null value");
}

return this.context.Get<string>("Subject");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace Corvus.Extensions.SpecsTaskExtensionsFeatures.Context
// <copyright file="SimpleChild.cs" company="Endjin Limited">
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

namespace Corvus.Extensions.SpecsTaskExtensionsFeatures.Context
{
internal class SimpleChild : SimpleParent
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace Corvus.Extensions.SpecsTaskExtensionsFeatures.Context
// <copyright file="SimpleParent.cs" company="Endjin Limited">
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

namespace Corvus.Extensions.SpecsTaskExtensionsFeatures.Context
{
internal class SimpleParent
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace Corvus.Extensions.SpecsTaskExtensionsFeatures
// <copyright file="TaskExtensionsFeatureSteps.cs" company="Endjin Limited">
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

namespace Corvus.Extensions.SpecsTaskExtensionsFeatures
{
using System;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace Corvus.Extensions.Specs.TraversalExtensionsFeature
// <copyright file="TraversalExtensionsSteps.cs" company="Endjin Limited">
// Copyright (c) Endjin Limited. All rights reserved.
// </copyright>

namespace Corvus.Extensions.Specs.TraversalExtensionsFeature
{
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -27,6 +31,7 @@ public void GivenTheFollowingCollections(Table table)
{
result.Add(collection.Select(r => r["Value"]).ToList());
}

this.context.Add("Collections", result);
}

Expand All @@ -39,6 +44,7 @@ public void GivenTheFollowingDictionaries(Table table)
{
result.Add(dictionary.Select(r => new { v = int.Parse(r["Value"]), k = int.Parse(r["Key"]) }).ToDictionary(key => key.k, value => value.v));
}

this.context.Add("Dictionaries", result);
}

Expand All @@ -51,6 +57,7 @@ public void GivenTheFollowingIntegerCollections(Table table)
{
result.Add(collection.Select(r => int.Parse(r["Value"])).ToList());
}

this.context.Add("Collections", result);
}

Expand Down Expand Up @@ -211,7 +218,11 @@ public async Task WhenIEnumerateCollectionWithForeachasyncAddToAnotherCollection
var c1 = (IEnumerable<string>)collections[index - 1];
var result = new List<string>();
collections.Add(result);
await c1.ForEachAsync(i => { result.Add(i); return Task.CompletedTask; }).ConfigureAwait(false);
await c1.ForEachAsync(i =>
{
result.Add(i);
return Task.CompletedTask;
}).ConfigureAwait(false);
}

[When("I enumerate collection (.*) with foreachasync with no action")]
Expand Down Expand Up @@ -317,7 +328,11 @@ public async Task WhenIEnumerateCollectionWithForeachfailendasyncAddToAnotherCol
var c1 = (IEnumerable<string>)collections[index - 1];
var result = new List<string>();
collections.Add(result);
await c1.ForEachFailEndAsync(i => { result.Add(i); return Task.CompletedTask; }).ConfigureAwait(false);
await c1.ForEachFailEndAsync(i =>
{
result.Add(i);
return Task.CompletedTask;
}).ConfigureAwait(false);
}

[When("I enumerate collection (.*) with foreachfailendasync with a failing action")]
Expand Down Expand Up @@ -412,10 +427,6 @@ public void WhenIMergeDictionaryWithDictionary(int index1, int index2)
d2.Merge(d1);
}

private void Nop()
{
}

[Then("the result should be true")]
public void ThenTheResultShouldBeTrue()
{
Expand All @@ -434,5 +445,9 @@ public void ThenAnArgumentOutOfRangeExceptionShouldBeThrown()
Assert.IsTrue(this.context.ContainsKey("Exception"));
Assert.IsNotNull(this.context.Get<ArgumentOutOfRangeException>("Exception"));
}

private void Nop()
{
}
}
}
12 changes: 0 additions & 12 deletions Solutions/Corvus.Extensions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DevOps", "DevOps", "{D29CAB
..\azure-pipelines.yml = ..\azure-pipelines.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2DB710C0-A7C2-45AC-9C84-3B2105D833EA}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Common.GitHub.proj = Common.GitHub.proj
Common.NetStandard_2_0.proj = Common.NetStandard_2_0.proj
Common.NuGet.proj = Common.NuGet.proj
Directory.build.props = Directory.build.props
Directory.build.targets = Directory.build.targets
stylecop.json = stylecop.json
StyleCop.ruleset = StyleCop.ruleset
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
8 changes: 6 additions & 2 deletions Solutions/Corvus.Extensions/Corvus.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable>
<RootNamespace></RootNamespace>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -13,9 +14,11 @@
<NeutralLanguage>en-GB</NeutralLanguage>
</PropertyGroup>

<Import Project="..\Common.NetStandard_2_0.proj" />

<ItemGroup>
<PackageReference Include="Endjin.RecommendedPractices" Version="0.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Interactive" Version="3.2.0" />
</ItemGroup>

Expand All @@ -41,6 +44,7 @@
<EmbeddedResource Update="Corvus\Extensions\ExceptionMessages.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>ExceptionMessages.Designer.cs</LastGenOutput>
<CustomToolNamespace>Corvus.Extensions</CustomToolNamespace>
</EmbeddedResource>
<EmbeddedResource Update="Endjin\Extensions\ExceptionMessages.resx">
<Generator>ResXFileCodeGenerator</Generator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Corvus.Extensions
using System.IO;
using System.Linq;
using System.Text;
using Corvus.Extensions;

/// <summary>
/// Extension methods for strings.
Expand Down
Loading

0 comments on commit e30019d

Please sign in to comment.