Skip to content

Commit d81de85

Browse files
committed
Merge branch 'maintenance/NetAnalyzers' into develop
Upgraded `FxCopAnalyzers` to new `NetAnalyzers` and implemented new recommendations. This doesn't change the functionality, but does improve the code to make it more reliable and consistent.
2 parents 5e34b68 + df6360d commit d81de85

File tree

8 files changed

+50
-12
lines changed

8 files changed

+50
-12
lines changed

OnTopic.Data.Transfer.Tests/LastModifiedImportStrategyTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class LastModifiedImportStrategyTest {
2424
/*==========================================================================================================================
2525
| HELPER: GET TOPIC WITH NEWER TOPIC DATA
2626
\-------------------------------------------------------------------------------------------------------------------------*/
27-
private Tuple<Topic, TopicData> GetTopicWithNewerTopicData(
27+
private static Tuple<Topic, TopicData> GetTopicWithNewerTopicData(
2828
DateTime? targetDate = null,
2929
DateTime? sourceDate = null,
3030
bool isDirty = true

OnTopic.Data.Transfer.Tests/OnTopic.Data.Transfer.Tests.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp3.1</TargetFramework>
55
<LangVersion>9.0</LangVersion>
66
<IsPackable>false</IsPackable>
7+
<AnalysisLevel>latest</AnalysisLevel>
8+
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
9+
</PropertyGroup>
10+
11+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
12+
<NoWarn>1701;1702;1707</NoWarn>
713
</PropertyGroup>
814

915
<ItemGroup>

OnTopic.Data.Transfer/Interchange/ExportOptions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class ExportOptions {
2323
/*==========================================================================================================================
2424
| PRIVATE VARIABLES
2525
\-------------------------------------------------------------------------------------------------------------------------*/
26-
private bool _includeNestedTopics = false;
26+
private bool _includeNestedTopics;
2727

2828
/*==========================================================================================================================
2929
| INCLUDE EXTERNAL REFERENCES
@@ -40,7 +40,7 @@ public class ExportOptions {
4040
/// exporting with other exports. It may also make when the purpose of the export is to act as a backup for a portion of a
4141
/// topic graph, with the expected target being the same topic graph should a bulk-restore be required.
4242
/// </remarks>
43-
public bool IncludeExternalReferences { get; set; } = false;
43+
public bool IncludeExternalReferences { get; set; }
4444

4545
/*==========================================================================================================================
4646
| EXPORT SCOPE
@@ -78,7 +78,7 @@ public class ExportOptions {
7878
/// </para>
7979
/// </remarks>
8080
public bool IncludeNestedTopics {
81-
get => IncludeChildTopics? true : _includeNestedTopics;
81+
get => IncludeChildTopics || _includeNestedTopics;
8282
set => _includeNestedTopics = value;
8383
}
8484

@@ -93,7 +93,7 @@ public bool IncludeNestedTopics {
9393
/// children under the current <see cref="Topic"/>. If enabled, this will be recursive and thus include <i>all</i>
9494
/// descendents, including any nested topics.
9595
/// </remarks>
96-
public bool IncludeChildTopics { get; set; } = false;
96+
public bool IncludeChildTopics { get; set; }
9797

9898
/*==========================================================================================================================
9999
| TRANSLATE TOPIC POINTERS

OnTopic.Data.Transfer/Interchange/ImportStrategy.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ namespace OnTopic.Data.Transfer.Interchange {
1717
/// </summary>
1818
public enum ImportStrategy {
1919

20+
/*==========================================================================================================================
21+
| NONE
22+
\-------------------------------------------------------------------------------------------------------------------------*/
23+
/// <summary>
24+
/// No import strategy is selected.
25+
/// </summary>
26+
None = 0,
27+
2028
/*==========================================================================================================================
2129
| ADD
2230
\-------------------------------------------------------------------------------------------------------------------------*/

OnTopic.Data.Transfer/Interchange/LastModifiedImportStrategy.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ namespace OnTopic.Data.Transfer.Interchange {
2121
/// </remarks>
2222
public enum LastModifiedImportStrategy {
2323

24+
/*==========================================================================================================================
25+
| NONE
26+
\-------------------------------------------------------------------------------------------------------------------------*/
27+
/// <summary>
28+
/// No import strategy is selected.
29+
/// </summary>
30+
None = 0,
31+
2432
/*==========================================================================================================================
2533
| INHERIT
2634
\-------------------------------------------------------------------------------------------------------------------------*/

OnTopic.Data.Transfer/Interchange/TopicExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static TopicData Export(this Topic topic, [NotNull]ExportOptions? options
8282
\-----------------------------------------------------------------------------------------------------------------------*/
8383
var attributes = topic.Attributes.Where(a =>
8484
!ReservedAttributeKeys.Any(r =>
85-
r.Equals(a.Key, StringComparison.InvariantCultureIgnoreCase)
85+
r.Equals(a.Key, StringComparison.OrdinalIgnoreCase)
8686
)
8787
);
8888

@@ -188,7 +188,7 @@ public static void Import(this Topic topic, TopicData topicData, [NotNull]Import
188188
}
189189

190190
//Wire up derived topics
191-
if (key.Equals("DerivedTopic", StringComparison.CurrentCultureIgnoreCase)) {
191+
if (key.Equals("DerivedTopic", StringComparison.OrdinalIgnoreCase)) {
192192
source.DerivedTopic = target;
193193
}
194194

OnTopic.Data.Transfer/OnTopic.Data.Transfer.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<TargetFramework>netstandard2.0</TargetFramework>
66
<LangVersion>9.0</LangVersion>
77
<Nullable>enable</Nullable>
8+
<AnalysisLevel>latest</AnalysisLevel>
9+
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
810
</PropertyGroup>
911

1012
<PropertyGroup>
@@ -32,10 +34,6 @@
3234
<PrivateAssets>all</PrivateAssets>
3335
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3436
</PackageReference>
35-
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0">
36-
<PrivateAssets>all</PrivateAssets>
37-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
38-
</PackageReference>
3937
<PackageReference Include="OnTopic" Version="4.3.0" />
4038
<PackageReference Include="System.ObjectModel" Version="4.3.0" />
4139
<PackageReference Include="System.Text.Json" Version="4.6.0" />
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*==============================================================================================================================
2+
| Author Ignia, LLC
3+
| Client Ignia, LLC
4+
| Project Topics Library
5+
\=============================================================================================================================*/
6+
using System;
7+
using System.Runtime.CompilerServices;
8+
using System.Runtime.InteropServices;
9+
10+
/*==============================================================================================================================
11+
| DEFINE ASSEMBLY ATTRIBUTES
12+
>===============================================================================================================================
13+
| Declare and define attributes used in the compiling of the finished assembly.
14+
\-----------------------------------------------------------------------------------------------------------------------------*/
15+
[assembly: ComVisible(false)]
16+
[assembly: CLSCompliant(true)]
17+
[assembly: InternalsVisibleTo("OnTopic.Data.Transfer.Tests")]
18+
[assembly: GuidAttribute("4F221895-703A-4C49-9E33-7C7394743DDE")]

0 commit comments

Comments
 (0)