Skip to content

Commit cd70c12

Browse files
authored
Merge pull request #77 from sillsdev/use-jetbrains-annotations
Replaced SuppressMessage attributes with PublicAPI from JetBrains.Annotations
2 parents da2bbcc + a20c5e7 commit cd70c12

26 files changed

+133
-126
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1616

1717
## [Unreleased]
1818

19+
### Changed
20+
- [SIL.BuildTasks.AWS] Changed case of text in log message from "Publishing Sourcefiles" "Publishing SourceFiles". If anything is doing a case-sensitive parse of the log file, looking for this text, this could be a breaking change.
21+
22+
### Deprecated
23+
24+
- [SIL.BuildTasks] Deprecated `AbandondedSuites` in favor of correctly spelled `AbandonedSuites`.
25+
1926
## [3.1.1] - 2025-03-18
27+
2028
### Changed
2129

2230
- [SIL.BuildTasks] Upgraded dependency on Markdig.Signed to version 0.37.0 (to be consistent with SIL.ReleaseTasks)

SIL.BuildTasks.AWS/AwsTaskBase.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018 SIL Global
1+
// Copyright (c) 2018-2025 SIL Global
22
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
33
/*
44
* Original code from https://code.google.com/archive/p/snowcode/
@@ -9,16 +9,15 @@
99
*/
1010

1111
using System;
12-
using System.Diagnostics.CodeAnalysis;
1312
using Amazon.Runtime;
1413
using Amazon.Runtime.CredentialManagement;
14+
using JetBrains.Annotations;
1515
using Microsoft.Build.Framework;
1616
using Microsoft.Build.Utilities;
1717

1818
namespace SIL.BuildTasks.AWS
1919
{
20-
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
21-
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
20+
[PublicAPI]
2221
public abstract class AwsTaskBase : Task
2322
{
2423
/// <summary>
@@ -33,8 +32,7 @@ public abstract class AwsTaskBase : Task
3332
/// <returns></returns>
3433
protected AWSCredentials GetAwsCredentials()
3534
{
36-
AWSCredentials awsCredentials;
37-
if (!new CredentialProfileStoreChain().TryGetAWSCredentials(CredentialStoreProfileName, out awsCredentials))
35+
if (!new CredentialProfileStoreChain().TryGetAWSCredentials(CredentialStoreProfileName, out var awsCredentials))
3836
throw new ApplicationException("Unable to get AWS credentials from the credential profile store");
3937

4038
Log.LogMessage(MessageImportance.Normal, "Connecting to AWS using AwsAccessKeyId: {0}",

SIL.BuildTasks.AWS/S3/S3BuildPublisher.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018 SIL Global
1+
// Copyright (c) 2018-2025 SIL Global
22
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
33
/*
44
* Original code from https://code.google.com/archive/p/snowcode/
@@ -9,8 +9,8 @@
99
*/
1010

1111
using System;
12-
using System.Diagnostics.CodeAnalysis;
1312
using Amazon.Runtime;
13+
using JetBrains.Annotations;
1414
using Microsoft.Build.Framework;
1515

1616
namespace SIL.BuildTasks.AWS.S3
@@ -19,9 +19,7 @@ namespace SIL.BuildTasks.AWS.S3
1919
/// MSBuild task to publish a set of files to a S3 bucket.
2020
/// </summary>
2121
/// <remarks>If made public the files will be available at https://s3.amazonaws.com/bucket_name/folder/file_name</remarks>
22-
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
23-
[SuppressMessage("ReSharper", "UnusedMember.Global")]
24-
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
22+
[PublicAPI]
2523
public class S3BuildPublisher : AwsTaskBase
2624
{
2725
#region Properties
@@ -51,7 +49,7 @@ public class S3BuildPublisher : AwsTaskBase
5149
public string DestinationBucket { get; set; }
5250

5351
/// <summary>
54-
/// Gets or sets if the files should be publically readable
52+
/// Gets or sets if the files should be publicly readable
5553
/// </summary>
5654
public bool IsPublicRead { get; set; }
5755

@@ -83,7 +81,7 @@ public override bool Execute()
8381

8482
private bool ProcessFiles()
8583
{
86-
Log.LogMessage(MessageImportance.Normal, "Publishing Sourcefiles={0} to {1}", Join(SourceFiles), DestinationBucket);
84+
Log.LogMessage(MessageImportance.Normal, "Publishing SourceFiles={0} to {1}", Join(SourceFiles), DestinationBucket);
8785

8886
ShowAclWarnings();
8987

SIL.BuildTasks.AWS/SIL.BuildTasks.AWS.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net472</TargetFrameworks>
4-
<RootNamespace>SIL.BuildTasks</RootNamespace>
4+
<RootNamespace>SIL.BuildTasks.AWS</RootNamespace>
55
<Description>SIL.BuildTasks.AWS defines a S3BuildPublisher msbuild task to publish a set of files to a S3 bucket.</Description>
66
<AssemblyTitle>SIL.BuildTasks.AWS</AssemblyTitle>
77
<IsTool>true</IsTool>
88
</PropertyGroup>
99
<ItemGroup>
1010
<PackageReference Include="AWSSDK.S3" Version="3.3.110.50" IncludeAssets="All" PrivateAssets="All" />
11+
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0">
12+
<PrivateAssets>All</PrivateAssets>
13+
</PackageReference>
1114
<PackageReference Include="Markdig.Signed" Version="0.41.1" />
1215
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.14.8" />
1316
<PackageReference Include="SIL.ReleaseTasks.Dogfood" Version="[2.3.3-*,)" PrivateAssets="All" />

SIL.BuildTasks.Tests/SIL.BuildTasks.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<Reference Include="Microsoft.Build.Utilities.v4.0" />
1212
</ItemGroup>
1313
<ItemGroup>
14+
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0">
15+
<PrivateAssets>All</PrivateAssets>
16+
</PackageReference>
1417
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.14.8" />
1518
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.14.8" />
1619
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />

SIL.BuildTasks/Archive/Archive.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
// Copyright (c) 2018 SIL Global
1+
// Copyright (c) 2018-2025 SIL Global
22
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
33

44
using System.Collections.Generic;
55
using System.Diagnostics;
6-
using System.Diagnostics.CodeAnalysis;
76
using System.Text;
7+
using JetBrains.Annotations;
88
using Microsoft.Build.Framework;
99
using Microsoft.Build.Utilities;
1010

1111
namespace SIL.BuildTasks.Archive
1212
{
13-
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
14-
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
13+
[PublicAPI]
1514
public class Archive : Task
1615
{
1716
[Required]

SIL.BuildTasks/CpuArchitecture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// Copyright (c) 2018 SIL Global
1+
// Copyright (c) 2018-2025 SIL Global
22
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
33
using System;
44
using System.Diagnostics;
5-
using System.Diagnostics.CodeAnalysis;
5+
using JetBrains.Annotations;
66
using Microsoft.Build.Framework;
77
using Microsoft.Build.Utilities;
88

@@ -11,7 +11,7 @@ namespace SIL.BuildTasks
1111
/// <summary>
1212
/// Return the CPU architecture of the current system.
1313
/// </summary>
14-
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
14+
[PublicAPI]
1515
public class CpuArchitecture : Task
1616
{
1717
public override bool Execute()

SIL.BuildTasks/DownloadFile.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Copyright (c) 2018 SIL Global
1+
// Copyright (c) 2018-2025 SIL Global
22
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
33
using System;
4-
using System.Diagnostics.CodeAnalysis;
54
using System.IO;
65
using System.Net;
6+
using JetBrains.Annotations;
77
using Microsoft.Build.Framework;
88
using Microsoft.Build.Utilities;
99

@@ -16,9 +16,7 @@ namespace SIL.BuildTasks
1616
/// may be sent in clear.
1717
/// Adapted from http://stackoverflow.com/questions/1089452/how-can-i-use-msbuild-to-download-a-file
1818
/// </summary>
19-
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
20-
[SuppressMessage("ReSharper", "UnusedMember.Global")]
21-
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
19+
[PublicAPI]
2220
public class DownloadFile : Task
2321
{
2422
/// <summary>
@@ -45,9 +43,9 @@ public class DownloadFile : Task
4543

4644
public override bool Execute()
4745
{
48-
// This doesn't seem to work reliably..can return true even when only network cable is unplugged.
49-
// Left in in case it works in some cases. But the main way of dealing with disconnect is the
50-
// same algorithm in the WebException handler.
46+
// This doesn't seem to work reliably. It can return true even when only network cable
47+
// is unplugged. Left it in just in case it works in some cases. But the main way of
48+
// dealing with disconnect is the same algorithm in the WebException handler.
5149
if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
5250
{
5351
if (File.Exists(LocalFilename))
@@ -60,8 +58,7 @@ public override bool Execute()
6058
return false; // Presumably can't continue
6159
}
6260

63-
bool success;
64-
var read = DoDownloadFile(Address, LocalFilename, Username, Password, out success);
61+
var read = DoDownloadFile(Address, LocalFilename, Username, Password, out var success);
6562

6663
if (success)
6764
Log.LogMessage(MessageImportance.Low, "{0} bytes written", read);

SIL.BuildTasks/FileUpdate.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
// Copyright (c) 2023 SIL Global
1+
// Copyright (c) 2023-2025 SIL Global
22
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
33
using System;
44
using System.Diagnostics;
55
using System.Text.RegularExpressions;
6+
using JetBrains.Annotations;
67
using Microsoft.Build.Framework;
78
using Microsoft.Build.Utilities;
89

910
namespace SIL.BuildTasks
1011
{
12+
[PublicAPI]
1113
public class FileUpdate : Task
1214
{
1315
private string _dateFormat;

SIL.BuildTasks/MakePot/MakePot.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
// Copyright (c) 2018 SIL Global
1+
// Copyright (c) 2018-2025 SIL Global
22
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
33
using System;
44
using System.Collections.Generic;
5-
using System.Diagnostics.CodeAnalysis;
65
using System.IO;
76
using System.Text.RegularExpressions;
87
using System.Xml;
8+
using JetBrains.Annotations;
99
using Microsoft.Build.Framework;
1010
using Microsoft.Build.Utilities;
1111

1212
namespace SIL.BuildTasks.MakePot
1313
{
14-
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
15-
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
14+
[PublicAPI]
1615
public class MakePot: Task
1716
{
1817
private readonly Dictionary<string, List<string>> _entries = new Dictionary<string, List<string>>();
@@ -182,7 +181,7 @@ internal void ProcessSrcFile(string filePath)
182181
}
183182
var comments = "#: " + filePath;
184183

185-
//catch the second parameter from calls like this:
184+
// Catch the second parameter from calls like this:
186185
// StringCataGet("~Note", "The label for the field showing a note.");
187186

188187
if (!string.IsNullOrEmpty(match.Groups["note"].Value))
@@ -214,16 +213,16 @@ private static void WriteEntry(string key, IEnumerable<string> comments, TextWri
214213

215214
public static string EscapeString(string s)
216215
{
217-
var result = s.Replace("\\", "\\\\"); // This must be first
216+
var result = s.Replace(@"\", @"\\"); // This must be first
218217
result = result.Replace("\"", "\\\"");
219218
return result;
220219
}
221220

222221
public static string UnescapeString(string s)
223222
{
224-
var result = s.Replace("\\'", "'");
225-
result = result.Replace("\\\"", "\"");
226-
result = result.Replace("\\\\", "\\");
223+
var result = s.Replace(@"\'", "'");
224+
result = result.Replace(@"\""", "\"");
225+
result = result.Replace(@"\\", @"\");
227226
return result;
228227
}
229228
}

0 commit comments

Comments
 (0)