Skip to content

Commit

Permalink
Merge pull request #141 from Yubico/dennisdyallo/implicit-var
Browse files Browse the repository at this point in the history
Adopt inferred variable types (var) to enhance code readability and maintainability
  • Loading branch information
DennisDyallo authored Aug 14, 2024
2 parents 299b6ae + 6b971e6 commit e1dbe19
Show file tree
Hide file tree
Showing 202 changed files with 1,545 additions and 1,585 deletions.
11 changes: 9 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ dotnet_style_readonly_field = true:warning
#### C# Coding Conventions ####

# var preferences
csharp_style_var_elsewhere = false:warning
csharp_style_var_for_built_in_types = false:warning
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion

# Pattern matching preferences
Expand Down Expand Up @@ -351,3 +351,10 @@ dotnet_diagnostic.ca1707.severity = none

# CA1014: Mark assemblies with CLSCompliant
dotnet_diagnostic.ca1014.severity = none


[Yubico.Core/src/**/*.cs]
# var preferences
csharp_style_var_elsewhere = false:warning
csharp_style_var_for_built_in_types = false:warning
csharp_style_var_when_type_is_apparent = true:warning
3 changes: 1 addition & 2 deletions Yubico.Core/src/Yubico/Core/Devices/Hid/MacOSHidDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
using System.Globalization;
using System.Linq;
using Microsoft.Extensions.Logging;
using Yubico.PlatformInterop;
using Yubico.Core.Logging;

using Yubico.PlatformInterop;
using static Yubico.PlatformInterop.NativeMethods;

namespace Yubico.Core.Devices.Hid
Expand Down
4 changes: 2 additions & 2 deletions Yubico.DotNetPolyfills/src/Contrib.Bcl.Ranges/Range.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ value is Range r &&
public (int Offset, int Length) GetOffsetAndLength(int length)
{
int start;
Index startIndex = Start;
var startIndex = Start;
if (startIndex.IsFromEnd)
{
start = length - startIndex.Value;
Expand All @@ -88,7 +88,7 @@ value is Range r &&
}

int end;
Index endIndex = End;
var endIndex = End;
if (endIndex.IsFromEnd)
{
end = length - endIndex.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public bool LaunchPinPopup(KeyEntryData keyEntryData)
return false;
}

DialogResult dResult = DialogResult.OK;
var dResult = DialogResult.OK;
do
{
_pinPopupForm.UpdateMessage(dResult, keyEntryData);
Expand Down
Loading

0 comments on commit e1dbe19

Please sign in to comment.