Sonar code smells corrections

This commit is contained in:
BONNEVILLE Geoffroy
2018-06-18 14:58:01 +02:00
parent 978929ba48
commit b1ded11fa5
14 changed files with 63 additions and 512 deletions

View File

@@ -22,7 +22,6 @@ namespace ModernKeePass.Services
private StorageFile _realDatabaseFile;
private StorageFile _databaseFile;
private GroupVm _recycleBin;
private CompositeKey _compositeKey;
public GroupVm RootGroup { get; set; }
@@ -57,11 +56,7 @@ namespace ModernKeePass.Services
}
}
public CompositeKey CompositeKey
{
get { return _compositeKey; }
set { _compositeKey = value; }
}
public CompositeKey CompositeKey { get; set; }
public PwUuid DataCipher
{
@@ -112,7 +107,7 @@ namespace ModernKeePass.Services
throw new ArgumentNullException(nameof(key));
}
_compositeKey = key;
CompositeKey = key;
var ioConnection = IOConnectionInfo.FromFile(DatabaseFile);
if (createNew)
{
@@ -153,7 +148,7 @@ namespace ModernKeePass.Services
public async Task ReOpen()
{
await Open(_compositeKey);
await Open(CompositeKey);
}
/// <summary>

View File

@@ -20,8 +20,7 @@ namespace ModernKeePass.Services
}
public IReadOnlyDictionary<string, ProductListing> Products { get; }
//private LicenseInformation _licenseInformation;
private readonly HashSet<Guid> _consumedTransactionIds = new HashSet<Guid>();
public LicenseService()
@@ -51,7 +50,7 @@ namespace ModernKeePass.Services
case ProductPurchaseStatus.AlreadyPurchased:
return (int) PurchaseResult.AlreadyPurchased;
default:
throw new ArgumentOutOfRangeException();
throw new ArgumentOutOfRangeException(nameof(purchaseResults.Status));
}
}

View File

@@ -4,6 +4,8 @@ namespace ModernKeePass.Services
{
public abstract class SingletonServiceBase<T> where T : new()
{
protected SingletonServiceBase() { }
private static readonly Lazy<T> LazyInstance =
new Lazy<T>(() => new T());