Skip to content

Commit

Permalink
Merge pull request #111 from MoneyTools/2023-10-18-LINT-fixes
Browse files Browse the repository at this point in the history
LINT-fixes
  • Loading branch information
clovett committed Jan 2, 2024
2 parents 029dea9 + ca462fd commit 9c3a544
Show file tree
Hide file tree
Showing 26 changed files with 97 additions and 116 deletions.
6 changes: 3 additions & 3 deletions Source/WPF/MyMoney/Charts/AnimatingBarChart.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private Size CreateColumnInfos()
var block = info.Label;
if (block == null)
{
block = new TextBlock() { Foreground = Foreground };
block = new TextBlock() { Foreground = this.Foreground };
info.Label = block;
}
block.Text = item.Label;
Expand Down Expand Up @@ -494,9 +494,9 @@ private Size AddAxisLabels(out AxisTickSpacer scale)
}
else
{
label = new TextBlock() { Foreground = Foreground };
label = new TextBlock() { Foreground = this.Foreground };
this.axisLabels.Add(label);
line = new Polygon() { Stroke = LineBrush, StrokeThickness = LineThickness, Points = new PointCollection() };
line = new Polygon() { Stroke = this.LineBrush, StrokeThickness = this.LineThickness, Points = new PointCollection() };
this.axisLines.Add(line);
}
this.ChartCanvas.Children.Add(line);
Expand Down
8 changes: 4 additions & 4 deletions Source/WPF/MyMoney/Controls/Calculator/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public double Parse(string expression)
switch (token)
{
case Token.Number:
this.Shift(new Operation() { Token = Token.Number, Number = number });
this.Shift(new Operation() { Token = Token.Number, Number = this.number });
this.state = 1;
break;
case Token.Plus:
Expand Down Expand Up @@ -141,12 +141,12 @@ public double Parse(string expression)
switch (token)
{
case Token.Number:
this.Shift(new Operation() { Token = Token.Number, Number = number });
this.Shift(new Operation() { Token = Token.Number, Number = this.number });
this.ReduceUnaryOperator();
this.state = 1;
break;
case Token.LeftParen:
this.Shift(new Operation() { Token = Token.LeftParen, Number = number });
this.Shift(new Operation() { Token = Token.LeftParen, Number = this.number });
this.state = 0;
break;
case Token.Dollar:
Expand All @@ -161,7 +161,7 @@ public double Parse(string expression)
switch (token)
{
case Token.Number:
this.Shift(new Operation() { Token = Token.Number, Number = number });
this.Shift(new Operation() { Token = Token.Number, Number = this.number });
this.ReduceUnaryOperator();
this.state = 1;
break;
Expand Down
18 changes: 9 additions & 9 deletions Source/WPF/MyMoney/Controls/SingleLineTextBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,16 @@ private FormattedText GetFormattedText()
this._properties = new TextProperties()
{
CultureInfo = CultureInfo.CurrentCulture,
FontFamily = FontFamily,
FontSize = FontSize,
FontStyle = FontStyle,
FontWeight = FontWeight,
FontStretch = FontStretch,
ForegroundBrush = Foreground,
FontFamily = this.FontFamily,
FontSize = this.FontSize,
FontStyle = this.FontStyle,
FontWeight = this.FontWeight,
FontStretch = this.FontStretch,
ForegroundBrush = this.Foreground,
PixelsPerDip = VisualTreeHelper.GetDpi(this).PixelsPerDip,
FlowDirection = FlowDirection,
TextAlignment = TextAlignment,
VerticalAlignment = VerticalAlignment
FlowDirection = this.FlowDirection,
TextAlignment = this.TextAlignment,
VerticalAlignment = this.VerticalAlignment
};
this._properties.Typeface = new Typeface(this._properties.FontFamily, this._properties.FontStyle, this._properties.FontWeight, this._properties.FontStretch);
this._formatted = null;
Expand Down
20 changes: 10 additions & 10 deletions Source/WPF/MyMoney/Database/CostBasis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ internal SecuritySale Sell(DateTime date, decimal units, decimal unitSalePrice)
return new SecuritySale()
{
DateSold = date,
Security = Security,
CostBasisPerUnit = CostBasisPerUnit,
Security = this.Security,
CostBasisPerUnit = this.CostBasisPerUnit,
UnitsSold = canSell,
DateAcquired = DatePurchased,
DateAcquired = this.DatePurchased,
SalePricePerUnit = unitSalePrice
};
}
Expand Down Expand Up @@ -227,7 +227,7 @@ public void Buy(DateTime datePurchased, decimal units, decimal costBasis)
{
SecurityPurchase sp = new SecurityPurchase()
{
Security = Security,
Security = this.Security,
DatePurchased = datePurchased,
CostBasisPerUnit = costBasis / units,
UnitsRemaining = units
Expand Down Expand Up @@ -283,8 +283,8 @@ public IEnumerable<SecuritySale> Sell(DateTime dateSold, decimal units, decimal
// Generate an error item so we can report this problem later.
this.pending.Add(new SecuritySale()
{
Security = Security,
Account = Account,
Security = this.Security,
Account = this.Account,
DateSold = dateSold,
UnitsSold = units,
SalePricePerUnit = salePricePerUnit
Expand Down Expand Up @@ -391,7 +391,7 @@ public void Buy(Security s, DateTime datePurchased, decimal units, decimal costB
queue = new SecurityFifoQueue()
{
Security = s,
Account = Account
Account = this.Account
};
this.queues[s] = queue;
}
Expand All @@ -417,7 +417,7 @@ public IEnumerable<SecuritySale> Sell(Security s, DateTime dateSold, decimal uni
queue = new SecurityFifoQueue()
{
Security = s,
Account = Account
Account = this.Account
};
this.queues[s] = queue;
}
Expand Down Expand Up @@ -532,7 +532,7 @@ public IList<SecurityGroup> GetHoldingsBySecurityType(Predicate<Account> filter)
SecurityGroup group = null;
if (!result.TryGetValue(type, out group))
{
group = new SecurityGroup() { Date = toDate, Security = sp.Security, Type = type, Purchases = new List<SecurityPurchase>() };
group = new SecurityGroup() { Date = this.toDate, Security = sp.Security, Type = type, Purchases = new List<SecurityPurchase>() };
result[type] = group;
}
else if (group.Security != sp.Security)
Expand Down Expand Up @@ -563,7 +563,7 @@ public IList<SecurityGroup> RegroupBySecurity(SecurityGroup groupByType)
SecurityGroup group = null;
if (!holdingsBySecurity.TryGetValue(s, out group))
{
group = new SecurityGroup() { Date = toDate, Security = s, Type = s.SecurityType, Purchases = new List<SecurityPurchase>() };
group = new SecurityGroup() { Date = this.toDate, Security = s, Type = s.SecurityType, Purchases = new List<SecurityPurchase>() };
holdingsBySecurity[s] = group;
}
group.Purchases.Add(sp);
Expand Down
32 changes: 16 additions & 16 deletions Source/WPF/MyMoney/Database/Money.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3398,21 +3398,21 @@ public OnlineAccount ShallowCopy()
// do NOT want to copy Parent or Id fields because this generates confusing change events.
return new OnlineAccount()
{
name = name,
institution = institution,
ofx = ofx,
fid = fid,
userid = userid,
password = password,
bankId = bankId,
brokerId = brokerId,
branchId = branchId,
ofxVersion = ofxVersion,
logoUrl = logoUrl,
appId = appId,
appVersion = appVersion,
sessionCookie = sessionCookie,
clientUid = clientUid
name = this.name,
institution = this.institution,
ofx = this.ofx,
fid = this.fid,
userid = this.userid,
password = this.password,
bankId = this.bankId,
brokerId = this.brokerId,
branchId = this.branchId,
ofxVersion = this.ofxVersion,
logoUrl = this.logoUrl,
appId = this.appId,
appVersion = this.appVersion,
sessionCookie = this.sessionCookie,
clientUid = this.clientUid
};
}

Expand Down Expand Up @@ -12432,7 +12432,7 @@ public bool Matches(QueryRow q)

public Currency GetAccountCurrency()
{
MyMoney money = this.Account.Parent.Parent as MyMoney;
MyMoney money = this.Account.Parent.Parent as MyMoney;
if (money == null)
{
return Currencies.GetDefaultCurrency();
Expand Down
2 changes: 1 addition & 1 deletion Source/WPF/MyMoney/Dialogs/MoneyFileImportDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private void ImportMoneyFile(MyMoney newMoney, AttachmentManager newAttachments,
{
this.list.Add(new AccountImportState()
{
Dispatcher = dispatcher,
Dispatcher = this.dispatcher,
Account = acct,
Name = acct.Name,
});
Expand Down
2 changes: 1 addition & 1 deletion Source/WPF/MyMoney/Dialogs/RenamePayeeDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private void CheckConflicts()
if (this.Alias)
{
AliasType atype = this.checkBoxUseRegex.IsChecked == true ? AliasType.Regex : AliasType.None;
Alias a = new Alias() { Pattern = Pattern, AliasType = atype };
Alias a = new Alias() { Pattern = this.Pattern, AliasType = atype };
IEnumerable<Alias> conflicts = this.money.FindSubsumedAliases(a);
if (conflicts.Count() > 0)
{
Expand Down
5 changes: 2 additions & 3 deletions Source/WPF/MyMoney/Dialogs/StockQuoteServiceDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Windows.Controls;
using Walkabout.StockQuotes;
using Walkabout.Utilities;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace Walkabout.Dialogs
{
Expand Down Expand Up @@ -36,7 +35,7 @@ public StockQuoteManager StockQuoteManager
}
private void OnServiceSelected(object sender, SelectionChangedEventArgs e)
{
if (!_initialized)
if (!this._initialized)
{
return;
}
Expand All @@ -60,7 +59,7 @@ private void OnServiceSelected(object sender, SelectionChangedEventArgs e)

private void UpdateDialog()
{
foreach (StockServiceSettings item in this.ComboServiceName.Items)
foreach (StockServiceSettings item in this.ComboServiceName.Items)
{
item.PropertyChanged -= this.OnSettingsChanged;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/WPF/MyMoney/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2642,7 +2642,7 @@ private void HideBalancePanel(bool balanced, bool hasStatement)

#region MANAGE VIEW

int ignoreViewChangeCount;
private int ignoreViewChangeCount;

private void OnBeforeViewStateChanged(object sender, EventArgs e)
{
Expand Down
8 changes: 3 additions & 5 deletions Source/WPF/MyMoney/Ofx/Ofx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.NetworkInformation;
using System.Runtime.CompilerServices;
using System.Security.Policy;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
Expand Down Expand Up @@ -2917,11 +2915,11 @@ private void ProcessCurrency(XElement e, Account account, OfxDownloadData result
Currency c = this.myMoney.Currencies.FindCurrencyOrDefault(account.NonNullCurrency);
if (string.Compare(c.Name, symbol, StringComparison.OrdinalIgnoreCase) != 0)
{
if (currencyErrors.Contains(symbol))
if (this.currencyErrors.Contains(symbol))
{
OfxDownloadData data = results.AddError(this.onlineAccount, account, $"Transaction with currency {symbol} doesn't match account currency {c.Name}");
data.LinkCaption = e.ToString();
currencyErrors.Add(symbol);
this.currencyErrors.Add(symbol);
}
}
}
Expand Down Expand Up @@ -3858,7 +3856,7 @@ private void HandleChallenge(OFX ofx)
this.OnError(new OfxException("Server returned unexpected response from MFA Challenge Request")
{
Root = ofx,
HelpLink = challengeLog
HelpLink = this.challengeLog
});
}
}
Expand Down
10 changes: 5 additions & 5 deletions Source/WPF/MyMoney/Reports/NetWorthReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public override async Task Generate(IReportWriter writer)

Predicate<Account> bankAccountFilter = (a) => { return this.IsBankAccount(a); };
decimal balance = this.myMoney.GetCashBalanceNormalized(this.reportDate, bankAccountFilter);
var cashGroup = new AccountGroup() { Filter = bankAccountFilter, Date = reportDate, Title = "Bank Account" };
var cashGroup = new AccountGroup() { Filter = bankAccountFilter, Date = this.reportDate, Title = "Bank Account" };

// Non-investment Cash
var color = this.GetRandomColor();
Expand All @@ -121,7 +121,7 @@ public override async Task Generate(IReportWriter writer)
balance = this.myMoney.GetCashBalanceNormalized(this.reportDate, investmentAccountFilter);
if (balance != 0)
{
var investmentCashGroup = new AccountGroup { Filter = investmentAccountFilter, Date = reportDate, Title = "Investment Account" };
var investmentCashGroup = new AccountGroup { Filter = investmentAccountFilter, Date = this.reportDate, Title = "Investment Account" };
color = this.GetRandomColor();
data.Add(new ChartDataValue() { Label = "Investment Cash", Value = (double)balance.RoundToNearestCent(), Color = color, UserData = investmentCashGroup });
this.WriteRow(writer, color, "Investment Cash", balance, () => this.OnSelectCashGroup(investmentCashGroup));
Expand All @@ -133,7 +133,7 @@ public override async Task Generate(IReportWriter writer)
balance = this.myMoney.GetCashBalanceNormalized(this.reportDate, taxDeferredAccountFilter);
if (balance != 0)
{
var taxDeferredCashGroup = new AccountGroup { Filter = taxDeferredAccountFilter, Date = reportDate, Title = "Tax-Deferred Account" };
var taxDeferredCashGroup = new AccountGroup { Filter = taxDeferredAccountFilter, Date = this.reportDate, Title = "Tax-Deferred Account" };
color = this.GetRandomColor();
data.Add(new ChartDataValue() { Label = "Tax-Deferred Cash", Value = (double)balance.RoundToNearestCent(), Color = color, UserData = taxDeferredCashGroup });
this.WriteRow(writer, color, "Tax-Deferred Cash", balance, () => this.OnSelectCashGroup(taxDeferredCashGroup));
Expand All @@ -145,7 +145,7 @@ public override async Task Generate(IReportWriter writer)
balance = this.myMoney.GetCashBalanceNormalized(this.reportDate, taxFreeAccountFilter);
if (balance != 0)
{
var taxFreeCashGroup = new AccountGroup { Filter = taxFreeAccountFilter, Date = reportDate, Title = "Tax-Free Account" };
var taxFreeCashGroup = new AccountGroup { Filter = taxFreeAccountFilter, Date = this.reportDate, Title = "Tax-Free Account" };
color = this.GetRandomColor();
data.Add(new ChartDataValue() { Label = "Tax-Free Cash", Value = (double)balance.RoundToNearestCent(), Color = color, UserData = taxFreeCashGroup });
this.WriteRow(writer, color, "Tax-Free Cash", balance, () => this.OnSelectCashGroup(taxFreeCashGroup));
Expand Down Expand Up @@ -189,7 +189,7 @@ public override async Task Generate(IReportWriter writer)
Predicate<Account> creditAccountFilter = (a) => a.Type == AccountType.Credit;
balance = this.myMoney.GetCashBalanceNormalized(this.reportDate, creditAccountFilter);
totalBalance += balance;
var creditGroup = new AccountGroup() { Filter = creditAccountFilter, Date = reportDate, Title = "Credit Accounts" };
var creditGroup = new AccountGroup() { Filter = creditAccountFilter, Date = this.reportDate, Title = "Credit Accounts" };
color = this.GetRandomColor();
this.WriteRow(writer, color, "Credit", balance, () => this.OnSelectCashGroup(creditGroup));
totalBalance += this.WriteLoanAccountRows(writer, data, color, true);
Expand Down
7 changes: 1 addition & 6 deletions Source/WPF/MyMoney/StockQuotes/AlphaVantage.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
using ModernWpf.Controls;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static System.Data.Entity.Infrastructure.Design.Executor;

namespace Walkabout.StockQuotes
{
Expand Down
10 changes: 2 additions & 8 deletions Source/WPF/MyMoney/StockQuotes/IEXCloud.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Walkabout.StockQuotes
Expand Down Expand Up @@ -52,7 +46,7 @@ public static bool IsMySettings(StockServiceSettings settings)
}

protected override async Task<StockQuote> DownloadThrottledQuoteAsync(string symbol)
{
{
string uri = string.Format(stockQuoteAddress, symbol, this.Settings.ApiKey);

HttpClient client = new HttpClient();
Expand Down Expand Up @@ -97,7 +91,7 @@ protected override async Task<StockQuote> DownloadThrottledQuoteAsync(string sym
public static StockQuote ParseStockQuote(JObject child)
{
// See https://iexcloud.io/docs/core/QUOTE

var quote = new StockQuote() { Downloaded = DateTime.Now };
JToken value;
if (child.TryGetValue("symbol", StringComparison.Ordinal, out value) && value.Type != JTokenType.Null)
Expand Down
1 change: 0 additions & 1 deletion Source/WPF/MyMoney/StockQuotes/IStockQuoteService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Linq;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
using Walkabout.Utilities;

Expand Down
Loading

0 comments on commit 9c3a544

Please sign in to comment.