Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
More StyleCop fixes
Browse files Browse the repository at this point in the history
As is customary, VS eventually decided to find a bunch more issues after it already reported a clean slate. This fixes the next batch.
  • Loading branch information
AArnott committed Oct 9, 2016
1 parent 1212ddc commit 7bc098c
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 31 deletions.
3 changes: 1 addition & 2 deletions src/GitLink.Tests/ApprovalTestsConfig.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ApprovalTestsConfig.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved.
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


using ApprovalTests.Reporters;

[assembly: UseReporter(typeof(DiffReporter))]
10 changes: 10 additions & 0 deletions src/GitLink.Tests/GitLink.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\..\bin\Debug\GitLink.Tests\GitLink.Tests.XML</DocumentationFile>
<NoWarn>CS1591</NoWarn>
<CodeAnalysisRuleSet>GitLink.Tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -35,6 +38,9 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\..\bin\Release\GitLink.Tests\GitLink.Tests.XML</DocumentationFile>
<NoWarn>CS1591</NoWarn>
<CodeAnalysisRuleSet>GitLink.Tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Build" />
Expand Down Expand Up @@ -85,6 +91,10 @@
</Content>
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="..\GitLink\stylecop.json">
<Link>stylecop.json</Link>
</AdditionalFiles>
<None Include="GitLink.Tests.ruleset" />
<None Include="project.json" />
</ItemGroup>
<Choose>
Expand Down
78 changes: 78 additions & 0 deletions src/GitLink.Tests/GitLink.Tests.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Microsoft Managed Recommended Rules" Description="These rules focus on the most critical problems in your code, including potential security holes, application crashes, and other important logic and design errors. It is recommended to include this rule set in any custom rule set you create for your projects." ToolsVersion="10.0">
<Localization ResourceAssembly="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.dll" ResourceBaseName="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.Localized">
<Name Resource="MinimumRecommendedRules_Name" />
<Description Resource="MinimumRecommendedRules_Description" />
</Localization>
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1001" Action="Warning" />
<Rule Id="CA1009" Action="Warning" />
<Rule Id="CA1016" Action="Warning" />
<Rule Id="CA1033" Action="Warning" />
<Rule Id="CA1049" Action="Warning" />
<Rule Id="CA1060" Action="Warning" />
<Rule Id="CA1061" Action="Warning" />
<Rule Id="CA1063" Action="Warning" />
<Rule Id="CA1065" Action="Warning" />
<Rule Id="CA1301" Action="Warning" />
<Rule Id="CA1400" Action="Warning" />
<Rule Id="CA1401" Action="Warning" />
<Rule Id="CA1403" Action="Warning" />
<Rule Id="CA1404" Action="Warning" />
<Rule Id="CA1405" Action="Warning" />
<Rule Id="CA1410" Action="Warning" />
<Rule Id="CA1415" Action="Warning" />
<Rule Id="CA1821" Action="Warning" />
<Rule Id="CA1900" Action="Warning" />
<Rule Id="CA1901" Action="Warning" />
<Rule Id="CA2002" Action="Warning" />
<Rule Id="CA2100" Action="Warning" />
<Rule Id="CA2101" Action="Warning" />
<Rule Id="CA2108" Action="Warning" />
<Rule Id="CA2111" Action="Warning" />
<Rule Id="CA2112" Action="Warning" />
<Rule Id="CA2114" Action="Warning" />
<Rule Id="CA2116" Action="Warning" />
<Rule Id="CA2117" Action="Warning" />
<Rule Id="CA2122" Action="Warning" />
<Rule Id="CA2123" Action="Warning" />
<Rule Id="CA2124" Action="Warning" />
<Rule Id="CA2126" Action="Warning" />
<Rule Id="CA2131" Action="Warning" />
<Rule Id="CA2132" Action="Warning" />
<Rule Id="CA2133" Action="Warning" />
<Rule Id="CA2134" Action="Warning" />
<Rule Id="CA2137" Action="Warning" />
<Rule Id="CA2138" Action="Warning" />
<Rule Id="CA2140" Action="Warning" />
<Rule Id="CA2141" Action="Warning" />
<Rule Id="CA2146" Action="Warning" />
<Rule Id="CA2147" Action="Warning" />
<Rule Id="CA2149" Action="Warning" />
<Rule Id="CA2200" Action="Warning" />
<Rule Id="CA2202" Action="Warning" />
<Rule Id="CA2207" Action="Warning" />
<Rule Id="CA2212" Action="Warning" />
<Rule Id="CA2213" Action="Warning" />
<Rule Id="CA2214" Action="Warning" />
<Rule Id="CA2216" Action="Warning" />
<Rule Id="CA2220" Action="Warning" />
<Rule Id="CA2229" Action="Warning" />
<Rule Id="CA2231" Action="Warning" />
<Rule Id="CA2232" Action="Warning" />
<Rule Id="CA2235" Action="Warning" />
<Rule Id="CA2236" Action="Warning" />
<Rule Id="CA2237" Action="Warning" />
<Rule Id="CA2238" Action="Warning" />
<Rule Id="CA2240" Action="Warning" />
<Rule Id="CA2241" Action="Warning" />
<Rule Id="CA2242" Action="Warning" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1101" Action="Hidden" />
<Rule Id="SA1600" Action="Hidden" />
<Rule Id="SA1601" Action="Hidden" />
<Rule Id="SA1602" Action="Hidden" />
<Rule Id="SA1133" Action="Hidden" />
</Rules>
</RuleSet>
5 changes: 2 additions & 3 deletions src/GitLink.Tests/GlobalInitialization.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GlobalInitialization.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved.
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


using Catel.Logging;
using NUnit.Framework;

[SetUpFixture]
public class GlobalInitialization
{
//[SetUp]
////[SetUp]
public static void SetUp()
{
#if DEBUG
Expand Down
5 changes: 2 additions & 3 deletions src/GitLink.Tests/IntegrationTests/BitBucketIntegration.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GitHubIntegration.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved.
// <copyright file="BitBucketIntegration.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


namespace GitLink.Tests.IntegrationTests
{
using NUnit.Framework;
Expand Down
3 changes: 1 addition & 2 deletions src/GitLink.Tests/IntegrationTests/GitHubIntegration.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GitHubIntegration.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved.
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


namespace GitLink.Tests.IntegrationTests
{
using NUnit.Framework;
Expand Down
3 changes: 1 addition & 2 deletions src/GitLink.Tests/IntegrationTests/IntegrationTestBase.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IntegrationTestBase.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved.
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


namespace GitLink.Tests.IntegrationTests
{
using System;
Expand Down
2 changes: 1 addition & 1 deletion src/GitLink.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved.
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

Expand Down
3 changes: 1 addition & 2 deletions src/GitLink.Tests/Providers/BitBucketProviderFacts.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BitBucketProviderFacts.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved.
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


namespace GitLink.Tests.Providers
{
using GitLink.Providers;
Expand Down
8 changes: 7 additions & 1 deletion src/GitLink.Tests/Providers/CustomRawUrlProviderFacts.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
namespace GitLink.Tests.Providers
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CustomRawUrlProviderFacts.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace GitLink.Tests.Providers
{
using GitLink.Providers;
using NUnit.Framework;
Expand Down
27 changes: 16 additions & 11 deletions src/GitLink.Tests/Providers/CustomUrlProviderFacts.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
namespace GitLink.Tests.Providers
// <copyright file="CustomUrlProviderFacts.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>

namespace GitLink.Tests.Providers
{
using GitLink.Providers;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GitLink.Providers;
using NUnit.Framework;

public class CustomUrlProviderFacts
{
private const string correctUrl = "https://bitbucket.intra.company.com/projects/aaa/repos/a/browse/{filename}?at={revision}&raw";
private const string CorrectUrl = "https://bitbucket.intra.company.com/projects/aaa/repos/a/browse/{filename}?at={revision}&raw";

[TestFixture]
public class TheInitialization
{
[TestCase(correctUrl, true)]
[TestCase(CorrectUrl, true)]
[TestCase("https://example.com/repo", false)]
[TestCase("https://bitbucket.intra.company.com/projects/aaa/repos/a/browse/{filename}?raw", true)]
[TestCase("gopher://example.com/repo", false)]
Expand All @@ -34,7 +39,7 @@ public class TheGitHubProviderProperties
public void ReturnsNullCompany()
{
var provider = new CustomUrlProvider();
provider.Initialize(correctUrl);
provider.Initialize(CorrectUrl);

Assert.IsNull(provider.CompanyName);
}
Expand All @@ -43,7 +48,7 @@ public void ReturnsNullCompany()
public void ReturnsNullCompanyUrl()
{
var provider = new CustomUrlProvider();
provider.Initialize(correctUrl);
provider.Initialize(CorrectUrl);

Assert.IsNull(provider.CompanyUrl);
}
Expand All @@ -52,7 +57,7 @@ public void ReturnsNullCompanyUrl()
public void ReturnsNullProject()
{
var provider = new CustomUrlProvider();
provider.Initialize(correctUrl);
provider.Initialize(CorrectUrl);

Assert.IsNull(provider.ProjectName);
}
Expand All @@ -61,7 +66,7 @@ public void ReturnsNullProject()
public void ReturnsNullProjectUrl()
{
var provider = new CustomUrlProvider();
provider.Initialize(correctUrl);
provider.Initialize(CorrectUrl);

Assert.IsNull(provider.ProjectUrl);
}
Expand All @@ -70,9 +75,9 @@ public void ReturnsNullProjectUrl()
public void ReturnsValidRawGitUrl()
{
var provider = new CustomUrlProvider();
provider.Initialize(correctUrl);
provider.Initialize(CorrectUrl);

string correctReturnedUrl = correctUrl.Replace("{filename}", "%var2%");
string correctReturnedUrl = CorrectUrl.Replace("{filename}", "%var2%");
correctReturnedUrl = correctReturnedUrl.Replace("{revision}", "{0}");

Assert.AreEqual(correctReturnedUrl, provider.RawGitUrl);
Expand Down
3 changes: 1 addition & 2 deletions src/GitLink.Tests/Providers/GitHubProviderFacts.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GitHubProviderFacts.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved.
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


namespace GitLink.Tests.Providers
{
using GitLink.Providers;
Expand Down
3 changes: 1 addition & 2 deletions src/GitLink.Tests/Providers/ProviderManagerFacts.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ProviderManagerFacts.cs" company="CatenaLogic">
// Copyright (c) 2014 - 2014 CatenaLogic. All rights reserved.
// Copyright (c) 2014 - 2016 CatenaLogic. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


namespace GitLink.Tests.Providers
{
using System;
Expand Down

0 comments on commit 7bc098c

Please sign in to comment.