Skip to content

Commit f8e9d0f

Browse files
committed
(maint) removed some warnings.
and pinned gh-actions environment.
1 parent e44a915 commit f8e9d0f

File tree

10 files changed

+32
-11
lines changed

10 files changed

+32
-11
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
1414
strategy:
1515
matrix:
16-
os: [windows-latest, ubuntu-latest, macos-latest]
16+
os: [ ubuntu-18.04, windows-2019, macos-10.15 ]
1717

1818
steps:
1919
- uses: actions/checkout@v2.3.4

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
jobs:
1818
analyze:
1919
name: Analyze
20-
runs-on: ubuntu-latest
20+
runs-on: ubuntu-18.04
2121

2222
strategy:
2323
fail-fast: false
@@ -49,7 +49,7 @@ jobs:
4949
# Prefix the list here with "+" to use these queries and those in the config file.
5050
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5151

52-
- run: ./build.ps1
52+
- run: ./build.ps1 --target=DotNetCore-Build
5353
shell: pwsh
5454

5555
- name: Perform CodeQL Analysis

docs/input/guidelines/CakeContribIcon.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Title: CakeContrib-Icon
1111
- [Related rules](#related-rules)
1212
- [Usage](#usage)
1313
- [Settings](#settings)
14-
- [Icon-Location](#icon-location)
1514
- [Icon include in project](#icon-include-in-project)
1615
- [Migrating from an existing project](#migrating-from-an-existing-project)
1716

src/Guidelines/build/TargetFrameworkVersions.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<!-- All other rules have some "configuration" here, this rules required/suggested targets are hard-coded in the task. Sadly. -->
1515

1616
<TargetFrameworkVersions
17+
ProjectFile="$(MSBuildProjectFullPath)"
1718
References="@(PackageReference)"
1819
TargetFramework="$(TargetFramework)"
1920
TargetFrameworks="$(TargetFrameworks)"

src/Tasks/CcgLogError.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using CakeContrib.Guidelines.Tasks.Extensions;
22

3+
using JetBrains.Annotations;
4+
35
using Microsoft.Build.Framework;
46
using Microsoft.Build.Utilities;
57

@@ -9,6 +11,7 @@ namespace CakeContrib.Guidelines.Tasks
911
/// <summary>
1012
/// This is a convenience-Task to call CcgError from inside the msbuild.
1113
/// </summary>
14+
[UsedImplicitly]
1215
public class CcgLogError : Task
1316
{
1417
/// <summary>

src/Tasks/CcgLogWarning.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using CakeContrib.Guidelines.Tasks.Extensions;
22

3+
using JetBrains.Annotations;
4+
35
using Microsoft.Build.Framework;
46
using Microsoft.Build.Utilities;
57

@@ -9,6 +11,7 @@ namespace CakeContrib.Guidelines.Tasks
911
/// <summary>
1012
/// This is a convenience-Task to call CcgWarning from inside the msbuild.
1113
/// </summary>
14+
[UsedImplicitly]
1215
public class CcgLogWarning : Task
1316
{
1417
/// <summary>

src/Tasks/RequiredFileEditorconfig.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ namespace CakeContrib.Guidelines.Tasks
1414
/// </summary>
1515
public class RequiredFileEditorconfig : Task
1616
{
17+
#if DEBUG
18+
private const MessageImportance LogLevel = MessageImportance.High;
19+
#else
20+
private const MessageImportance LogLevel = MessageImportance.Low;
21+
#endif
1722
private const string FileName = ".editorconfig";
1823

1924
/// <summary>
@@ -49,7 +54,7 @@ public override bool Execute()
4954
.Where(x => !string.IsNullOrEmpty(x))
5055
.Any(x => x.Equals(FileName, StringComparison.OrdinalIgnoreCase)))
5156
{
52-
Log.LogMessage(MessageImportance.Low, $"Recommended file '{FileName}' is set to omit.");
57+
Log.LogMessage(LogLevel, $"Recommended file '{FileName}' is set to omit.");
5358
return true;
5459
}
5560

src/Tasks/TargetFrameworkVersions.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ public class TargetFrameworkVersions : Task
100100
/// </summary>
101101
public ITaskItem[] Omitted { get; set; }
102102

103+
/// <summary>
104+
/// Gets or sets the project file.
105+
/// </summary>
106+
[Required]
107+
public string ProjectFile { get; set; }
108+
103109
/// <inheritdoc />
104110
public override bool Execute()
105111
{
@@ -118,7 +124,7 @@ public override bool Execute()
118124
{
119125
Log.CcgWarning(
120126
7,
121-
BuildEngine.ProjectFileOfTaskNode,
127+
ProjectFile,
122128
$"Cake.Core has a version of {cakeCore.GetMetadata("version")} which is not a valid version. Using default TargetVersions.");
123129
return Execute(DefaultTarget);
124130
}
@@ -195,7 +201,7 @@ private bool Execute(TargetsDefinitions targets)
195201

196202
Log.CcgError(
197203
7,
198-
BuildEngine.ProjectFileOfTaskNode,
204+
ProjectFile,
199205
"Missing required target: " + requiredTarget.Name);
200206
return false;
201207
}
@@ -228,7 +234,7 @@ private bool Execute(TargetsDefinitions targets)
228234

229235
Log.CcgWarning(
230236
7,
231-
BuildEngine.ProjectFileOfTaskNode,
237+
ProjectFile,
232238
"Missing suggested target: " + suggestedTarget.Name);
233239
}
234240

src/Tasks/Tasks.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17+
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
1718
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.9.0" CopyLocal="false" Publish="false" ExcludeAssets="runtime" PrivateAssets="All" />
1819
<PackageReference Include="Microsoft.Build.Framework" Version="16.9.0" CopyLocal="false" Publish="false" ExcludeAssets="runtime" PrivateAssets="All" />
1920
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3">

src/Tasks/Testability/FileSearcher.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1+
using System;
2+
using System.Diagnostics.CodeAnalysis;
13
using System.IO;
24

35
namespace CakeContrib.Guidelines.Tasks.Testability
46
{
57
/// <inheritdoc />
8+
[ExcludeFromCodeCoverage]
69
internal class FileSearcher : IFileSearcher
710
{
811
/// <inheritdoc />
912
public bool HasFileInFolderStructure(string startFolder, string fileName)
1013
{
1114
var folder = startFolder;
12-
var found = false;
13-
while (folder != null && !found)
15+
do
1416
{
15-
found = File.Exists(Path.Combine(folder, fileName));
17+
var found = File.Exists(Path.Combine(folder, fileName));
1618
if (found)
1719
{
1820
return true;
1921
}
2022

2123
folder = Path.GetDirectoryName(folder);
2224
}
25+
while (folder != null);
2326

2427
return false;
2528
}

0 commit comments

Comments
 (0)