Skip to content

Commit

Permalink
Revert change to build for x64 only; build for 'AnyCPU' (#15)
Browse files Browse the repository at this point in the history
Started documenting public methods
Updated .editrorconfig and fixing code analysis issues
Added stylecop
  • Loading branch information
jim-dale authored Dec 18, 2023
1 parent 83e8727 commit 232aa68
Show file tree
Hide file tree
Showing 43 changed files with 1,169 additions and 430 deletions.
22 changes: 18 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
# CS1591: Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS1591.severity = none

# Xml project files
Expand All @@ -37,10 +38,10 @@ indent_style = space
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_event = false:warning
dotnet_style_qualification_for_field = true:suggestion
dotnet_style_qualification_for_property = true:suggestion
dotnet_style_qualification_for_method = true:suggestion
dotnet_style_qualification_for_event = true:suggestion

# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
Expand Down Expand Up @@ -195,5 +196,18 @@ csharp_prefer_simple_default_expression = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion

# SA1000: Keywords should be spaced correctly
dotnet_diagnostic.SA1000.severity = none
# SA1010: Opening square brackets should be spaced correctly
dotnet_diagnostic.SA1010.severity = none
# SA1600: Elements must be documented
dotnet_diagnostic.SA1600.severity = none
# SA1602: Enumeration items should be documented
dotnet_diagnostic.SA1602.severity = none
# SA1623: Property summary documentation must match accessors
dotnet_diagnostic.SA1623.severity = none
# SA1633: File should have header
dotnet_diagnostic.SA1633.severity = none

[*.sln]
indent_style = tab
1 change: 1 addition & 0 deletions BankingTools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.github\workflows\ofxnet-pr.yml = .github\workflows\ofxnet-pr.yml
.github\workflows\ofxnet-publish.yml = .github\workflows\ofxnet-publish.yml
README.md = README.md
stylecop.json = stylecop.json
EndProjectSection
EndProject
Global
Expand Down
18 changes: 17 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,25 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<PlatformTarget>x64</PlatformTarget>
<NeutralLanguage>en</NeutralLanguage>
<Authors>Jim Dale</Authors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AnalysisLevel>latest-all</AnalysisLevel>
<Deterministic>true</Deterministic>
</PropertyGroup>

<!-- Code analysis packages and configuration-->
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json">
<Link>Analysis/stylecop.json</Link>
</AdditionalFiles>
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# BankingTools
Banking tools v1.4.0
Banking tools v1.4.1

[![PR build](https://github.com/jim-dale/BankingTools/actions/workflows/ofxnet-publish.yml/badge.svg)](https://github.com/jim-dale/BankingTools/actions/workflows/ofxnet-publish.yml)
[![PR build](https://github.com/jim-dale/BankingTools/actions/workflows/ofxnet-pr.yml/badge.svg)](https://github.com/jim-dale/BankingTools/actions/workflows/ofxnet-pr.yml)
[![Published build](https://github.com/jim-dale/BankingTools/actions/workflows/ofxnet-publish.yml/badge.svg)](https://github.com/jim-dale/BankingTools/actions/workflows/ofxnet-publish.yml)
[![Nuget](https://img.shields.io/nuget/v/OfxNet)](https://www.nuget.org/packages/OfxNet/)

Expand Down
20 changes: 20 additions & 0 deletions src/OfxNet/IOfxElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,29 @@
using System;
using System.Collections.Generic;

/// <summary>
/// Interface for elements within an SGML or XML document.
/// </summary>
public interface IOfxElement
{
/// <summary>
/// Gets the value of the element as a string.
/// </summary>
public string? Value { get; }

/// <summary>
/// Searches for the child element matching the name specified.
/// </summary>
/// <param name="name">The name of the child element.</param>
/// <param name="comparer">The <see cref="StringComparer"/> to use to match the element name.</param>
/// <returns>The child element if found, otherwise <see langword="null"/>.</returns>
public IOfxElement? Element(string name, StringComparer comparer);

/// <summary>
/// Searches for all the child elements matching the name specified.
/// </summary>
/// <param name="name">The name of the child elements.</param>
/// <param name="comparer">The <see cref="StringComparer"/> to use to match the element name.</param>
/// <returns>The collection of child elements if found, otherwise an empty collection.</returns>
public IEnumerable<IOfxElement> Elements(string name, StringComparer comparer);
}
10 changes: 10 additions & 0 deletions src/OfxNet/Models/OfxAccount.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
namespace OfxNet;

/// <summary>
/// Base class inherited by the different bank account types.
/// </summary>
public class OfxAccount
{
/// <summary>
/// Gets or sets the account number.
/// </summary>
public string? AccountNumber { get; set; }

/// <summary>
/// Gets or sets the checksum.
/// </summary>
public string? Checksum { get; set; }
}
1 change: 1 addition & 0 deletions src/OfxNet/Models/OfxAccountBalance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
public class OfxAccountBalance
{
public decimal Balance { get; set; }

public DateTimeOffset DateAsOf { get; set; }
}
2 changes: 1 addition & 1 deletion src/OfxNet/Models/OfxAccountType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ public enum OfxAccountType
[Description("Line of credit")]
CREDITLINE,
[Description("Certificate of Deposit")]
CD
CD,
}
14 changes: 14 additions & 0 deletions src/OfxNet/Models/OfxBankAccount.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
namespace OfxNet;

/// <summary>
/// OFX Bank account information.
/// </summary>
public class OfxBankAccount : OfxAccount
{
/// <summary>
/// Gets or sets the bank identifier.
/// </summary>
public string? BankId { get; set; }

/// <summary>
/// Gets or sets the branch identifier.
/// </summary>
public string? BranchId { get; set; }

/// <summary>
/// Gets or sets the type of account.
/// </summary>
public OfxAccountType AccountType { get; set; }
}
14 changes: 14 additions & 0 deletions src/OfxNet/Models/OfxCorrectiveAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@

using System.ComponentModel;

/// <summary>
/// OFX corrective action enum values.
/// </summary>
public enum OfxCorrectiveAction
{
/// <summary>
/// Not set.
/// </summary>
NotSet,

/// <summary>
/// Replace this transaction with one referenced by <c>CORRECTFITID</c>.
/// </summary>
[Description("Replace this transaction with one referenced by CORRECTFITID")]
REPLACE,

/// <summary>
/// Delete transaction.
/// </summary>
[Description("Delete transaction")]
DELETE,
}
1 change: 1 addition & 0 deletions src/OfxNet/Models/OfxCurrency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
public class OfxCurrency(decimal rate, string symbol)
{
public decimal Rate { get; init; } = rate;

public string Symbol { get; init; } = symbol;
}
8 changes: 8 additions & 0 deletions src/OfxNet/Models/OfxPayee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
public class OfxPayee
{
public string? Name { get; set; }

public string? AddressLine1 { get; set; }

public string? AddressLine2 { get; set; }

public string? AddressLine3 { get; set; }

public string? City { get; set; }

public string? State { get; set; }

public string? PostalCode { get; set; }

public string? Country { get; set; }

public string? PhoneNumber { get; set; }
}
20 changes: 19 additions & 1 deletion src/OfxNet/Models/OfxSeverity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,31 @@

using System.ComponentModel;

/// <summary>
/// OFX severity values.
/// </summary>
public enum OfxSeverity
{
/// <summary>
/// Not set.
/// </summary>
NotSet,

/// <summary>
/// Informational only.
/// </summary>
[Description("Informational only")]
INFO,

/// <summary>
/// Some problem with the request occurred but a valid response still present.
/// </summary>
[Description("Some problem with the request occurred but a valid response still present")]
WARN,

/// <summary>
/// A problem severe enough that response could not be made.
/// </summary>
[Description("A problem severe enough that response could not be made")]
ERROR
ERROR,
}
3 changes: 3 additions & 0 deletions src/OfxNet/Models/OfxSignOn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ namespace OfxNet;
public class OfxSignOn
{
public OfxStatus? Status { get; set; }

public DateTimeOffset ServerDate { get; set; }

public string? Language { get; set; }

public string? IntuBid { get; set; }
}
3 changes: 3 additions & 0 deletions src/OfxNet/Models/OfxStatement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
public class OfxStatement
{
public string? DefaultCurrency { get; set; }

public OfxAccountBalance? LedgerBalance { get; set; }

public OfxAccountBalance? AvailableBalance { get; set; }

public OfxTransactionList? TransactionList { get; set; }
}

Expand Down
21 changes: 21 additions & 0 deletions src/OfxNet/Models/OfxStatementTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,46 @@
public class OfxStatementTransaction
{
public OfxTransactionType TxType { get; set; }

public DateTimeOffset DatePosted { get; set; }

public DateTimeOffset? DateUser { get; set; }

public DateTimeOffset? DateAvailable { get; set; }

public decimal Amount { get; set; }

public string? FitId { get; set; }

public string? Name { get; set; }

public string? Memo { get; set; }

public string? Memo2 { get; set; }

public string? ChequeNumber { get; set; }

public string? ReferenceNumber { get; set; }

public string? CorrectFitId { get; set; }

public OfxCorrectiveAction CorrectAction { get; set; }

public string? ServiceProviderName { get; set; }

public string? ServerTxId { get; set; }

public int? StandardIndustrialCode { get; set; }

public string? PayeeId { get; set; }

public OfxPayee? Payee { get; set; }

public OfxCurrency? Currency { get; set; }

public OfxCurrency? OriginalCurrency { get; set; }

public OfxBankAccount? BankAccountTo { get; set; }

public OfxCreditCardAccount? CreditCardAccountTo { get; set; }
}
14 changes: 14 additions & 0 deletions src/OfxNet/Models/OfxStatus.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
namespace OfxNet;

/// <summary>
/// OFX status aggregate.
/// </summary>
public class OfxStatus
{
/// <summary>
/// Gets or sets the OFX error code.
/// </summary>
public int Code { get; set; }

/// <summary>
/// Gets or sets the severity of the error.
/// </summary>
public OfxSeverity Severity { get; set; }

/// <summary>
/// Gets or sets the textual explanation from the financial institution.
/// </summary>
public string? Message { get; set; }
}
4 changes: 4 additions & 0 deletions src/OfxNet/Models/OfxTransactionList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
public class OfxTransactionList
{
public DateTimeOffset StartDate { get; set; }

public DateTimeOffset EndDate { get; set; }

[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1002:Do not expose generic lists", Justification = "Simple implementation.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Simple implementation.")]
public List<OfxStatementTransaction> Transactions { get; set; } = [];
}
2 changes: 2 additions & 0 deletions src/OfxNet/Models/OfxTransactionType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public enum OfxTransactionType
[Description("Generic debit")]
DEBIT,
[Description("Interest earned or paid. Note: Depends on signage of amount")]
#pragma warning disable CA1720 // Identifier contains type name
INT,
#pragma warning restore CA1720 // Identifier contains type name
[Description("Dividend")]
DIV,
[Description("FI fee")]
Expand Down
Loading

0 comments on commit 232aa68

Please sign in to comment.