Skip to content

Commit

Permalink
remove redundant parens (#1363)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Feb 16, 2024
1 parent 6efb990 commit af7974e
Show file tree
Hide file tree
Showing 40 changed files with 178 additions and 178 deletions.
4 changes: 2 additions & 2 deletions src/Humanizer.Tests.Shared/BitFieldEnumHumanizeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void CanHumanizeMultipleWordDescriptionAttribute() =>
[Fact]
public void CanHumanizeMultipleValueBitFieldEnum()
{
var xoredBitFlag = (BitFieldEnumUnderTest.RED | BitFieldEnumUnderTest.DARK_GRAY);
var xoredBitFlag = BitFieldEnumUnderTest.RED | BitFieldEnumUnderTest.DARK_GRAY;
Assert.Equal(BitFlagEnumTestsResources.ExpectedResultWhenBothValuesXored, xoredBitFlag.Humanize());
}

Expand All @@ -29,7 +29,7 @@ public void CanHumanizeShortMultipleWordDescriptionAttribute() =>
[Fact]
public void CanHumanizeShortMultipleValueBitFieldEnum()
{
var xoredBitFlag = (ShortBitFieldEnumUnderTest.RED | ShortBitFieldEnumUnderTest.DARK_GRAY);
var xoredBitFlag = ShortBitFieldEnumUnderTest.RED | ShortBitFieldEnumUnderTest.DARK_GRAY;
Assert.Equal(BitFlagEnumTestsResources.ExpectedResultWhenBothValuesXored, xoredBitFlag.Humanize());
}

Expand Down
2 changes: 1 addition & 1 deletion src/Humanizer.Tests.Shared/MetricNumeralTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void TestAllSymbolsAsInt(int exponent)
[Theory]
[InlineData("0", 0d, false, true, null)]
[InlineData("123", 123d, false, true, null)]
[InlineData("-123", (-123d), false, true, null)]
[InlineData("-123", -123d, false, true, null)]
[InlineData("1.23k", 1230d, false, true, null)]
[InlineData("1 k", 1000d, true, true, null)]
[InlineData("1 kilo", 1000d, true, false, null)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private static string PrecisionHumanize(TimeSpan ts, Tense tense, double precisi
{
var factor = Convert.ToInt32(Math.Floor((double)days / 30));
var maxMonths = Convert.ToInt32(Math.Ceiling((double)days / 30));
months = (days >= 30 * (factor + precision)) ? maxMonths : maxMonths - 1;
months = days >= 30 * (factor + precision) ? maxMonths : maxMonths - 1;
}

// year calculation
Expand All @@ -89,7 +89,7 @@ private static string PrecisionHumanize(TimeSpan ts, Tense tense, double precisi
{
var factor = Convert.ToInt32(Math.Floor((double)days / 365));
var maxMonths = Convert.ToInt32(Math.Ceiling((double)days / 365));
years = (days >= 365 * (factor + precision)) ? maxMonths : maxMonths - 1;
years = days >= 365 * (factor + precision) ? maxMonths : maxMonths - 1;
}

// start computing result from larger units to smaller ones
Expand Down
2 changes: 1 addition & 1 deletion src/Humanizer/FluentDate/In.SomeTimeFrom.tt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Humanizer;
public partial class In
{
<#for (var i = 1; i <= 10; i++){
var plural = ( i > 1 ? "s" : "");
var plural = i > 1 ? "s" : "";
var second = "Second" + plural;
var minute = "Minute" + plural;
var hour = "Hour" + plural;
Expand Down
2 changes: 1 addition & 1 deletion src/Humanizer/FluentDate/InDate.SomeTimeFrom.tt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Humanizer;
public partial class InDate
{
<#for (var i = 1; i <= 10; i++){
var plural = ( i > 1 ? "s" : "");
var plural = i > 1 ? "s" : "";

var day = "Day" + plural;
var week = "Week" + plural;
Expand Down
6 changes: 3 additions & 3 deletions src/Humanizer/HeadingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class HeadingExtensions
/// <param name="culture">The culture to return the textual representation in</param>
public static string ToHeading(this double heading, HeadingStyle style = HeadingStyle.Abbreviated, CultureInfo culture = null)
{
var val = (int)((heading / 22.5) + .5);
var val = (int)(heading / 22.5 + .5);

var result = Headings[val % 16];

Expand All @@ -57,7 +57,7 @@ public static string ToHeading(this double heading, HeadingStyle style = Heading
/// <returns>The heading arrow.</returns>
public static char ToHeadingArrow(this double heading)
{
var val = (int)((heading / 45) + .5);
var val = (int)(heading / 45 + .5);

return HeadingArrows[val % 8];
}
Expand Down Expand Up @@ -110,7 +110,7 @@ public static double FromHeadingArrow(this char heading)
return -1;
}

return (index * 45.0);
return index * 45.0;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,25 @@ private string Convert(int number, bool isOrdinal)

var parts = new List<string>();

if ((number / 1000000000) > 0)
if (number / 1000000000 > 0)
{
parts.Add($"{Convert(number / 1000000000)} miljard");
number %= 1000000000;
}

if ((number / 1000000) > 0)
if (number / 1000000 > 0)
{
parts.Add($"{Convert(number / 1000000)} miljoen");
number %= 1000000;
}

if ((number / 1000) > 0)
if (number / 1000 > 0)
{
parts.Add($"{Convert(number / 1000)} duisend");
number %= 1000;
}

if ((number / 100) > 0)
if (number / 100 > 0)
{
parts.Add($"{Convert(number / 100)} honderd");
number %= 100;
Expand All @@ -86,13 +86,13 @@ private string Convert(int number, bool isOrdinal)
}
else
{
var lastPartValue = (number / 10) * 10;
var lastPartValue = number / 10 * 10;
var lastPart = TensMap[number / 10];
if ((number % 10) > 0)
if (number % 10 > 0)
{
lastPart = $"{GetUnitValue(number % 10, false)} en {(isOrdinal ? GetUnitValue(lastPartValue, isOrdinal) : lastPart)}";
}
else if ((number % 10) == 0)
else if (number % 10 == 0)
{
lastPart = $"{(parts.Count > 0 ? "en " : "")}{lastPart}{(isOrdinal ? "ste" : "")}";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public override string Convert(long number, GrammaticalGender gender, bool addAn
else
{
var ones = tens % 10;
tens = (tens / 10);
tens = tens / 10;

if (ones > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,40 +53,40 @@ private string ConvertImpl(long number, bool isOrdinal)

var parts = new List<string>();

if ((number / 1000000000000000000) > 0)
if (number / 1000000000000000000 > 0)
{
parts.Add($"{Convert(number / 1000000000000000000)} քվինտիլիոն");
number %= 1000000000000000000;
}

if ((number / 1000000000000000) > 0)
if (number / 1000000000000000 > 0)
{
parts.Add($"{Convert(number / 1000000000000000)} կվադրիլիոն");
number %= 1000000000000000;
}

if ((number / 1000000000000) > 0)
if (number / 1000000000000 > 0)

{
parts.Add($"{Convert(number / 1000000000000)} տրիլիոն");
number %= 1000000000000;
}

if ((number / 1000000000) > 0)
if (number / 1000000000 > 0)
{
parts.Add($"{Convert(number / 1000000000)} միլիարդ");
number %= 1000000000;
}

if ((number / 1000000) > 0)
if (number / 1000000 > 0)
{
parts.Add($"{Convert(number / 1000000)} միլիոն");
number %= 1000000;
}

if ((number / 1000) > 0)
if (number / 1000 > 0)
{
if ((number / 1000) == 1)
if (number / 1000 == 1)
{
parts.Add("հազար");
}
Expand All @@ -98,9 +98,9 @@ private string ConvertImpl(long number, bool isOrdinal)
number %= 1000;
}

if ((number / 100) > 0)
if (number / 100 > 0)
{
if ((number / 100) == 1)
if (number / 100 == 1)
{
parts.Add("հարյուր");
}
Expand All @@ -121,7 +121,7 @@ private string ConvertImpl(long number, bool isOrdinal)
else
{
var lastPart = TensMap[number / 10];
if ((number % 10) > 0)
if (number % 10 > 0)
{
lastPart += $"{GetUnitValue(number % 10, isOrdinal)}";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,33 @@ public override string Convert(long input)

var parts = new List<string>();

if ((number / 1000000000) > 0)
if (number / 1000000000 > 0)
{
parts.Add($"{Convert(number / 1000000000)} milyard");
number %= 1000000000;
}

if ((number / 1000000) > 0)
if (number / 1000000 > 0)
{
parts.Add($"{Convert(number / 1000000)} milyon");
number %= 1000000;
}

var thousand = (number / 1000);
var thousand = number / 1000;
if (thousand > 0)
{
parts.Add($"{(thousand > 1 ? Convert(thousand) : "")} min".Trim());
number %= 1000;
}

var hundred = (number / 100);
var hundred = number / 100;
if (hundred > 0)
{
parts.Add($"{(hundred > 1 ? Convert(hundred) : "")} yüz".Trim());
number %= 100;
}

if ((number / 10) > 0)
if (number / 10 > 0)
{
parts.Add(TensMap[number / 10]);
number %= 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,25 @@ public override string Convert(long input)

var parts = new List<string>();

if ((number / 10000000) > 0)
if (number / 10000000 > 0)
{
parts.Add($"{Convert(number / 10000000)} কোটি");
number %= 10000000;
}

if ((number / 100000) > 0)
if (number / 100000 > 0)
{
parts.Add($"{Convert(number / 100000)} লক্ষ");
number %= 100000;
}

if ((number / 1000) > 0)
if (number / 1000 > 0)
{
parts.Add($"{Convert(number / 1000)} হাজার");
number %= 1000;
}

if ((number / 100) > 0)
if (number / 100 > 0)
{
parts.Add($"{HundredsMap[number / 100]}");
number %= 100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd

var parts = new List<string>();

if ((number / 1000000000) > 0)
if (number / 1000000000 > 0)
{
// gender is not applied for billions
parts.Add(number / 1000000000 >= 2
Expand All @@ -42,7 +42,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd
number %= 1000000000;
}

if ((number / 1000000) > 0)
if (number / 1000000 > 0)
{
// gender is not applied for millions
parts.Add(number / 1000000 >= 2
Expand All @@ -52,14 +52,14 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd
number %= 1000000;
}

if ((number / 1000) > 0)
if (number / 1000 > 0)
{
// gender is not applied for thousands
parts.Add(number / 1000 == 1 ? "mil" : $"{Convert(number / 1000, GrammaticalGender.Masculine)} mil");
number %= 1000;
}

if ((number / 100) > 0)
if (number / 100 > 0)
{
if (number == 100)
{
Expand All @@ -68,7 +68,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd
else
{
// Gender is applied to hundreds starting from 200
parts.Add(ApplyGender(PortugueseHundredsMap[(number / 100)], gender));
parts.Add(ApplyGender(PortugueseHundredsMap[number / 100], gender));
}

number %= 100;
Expand All @@ -88,7 +88,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd
else
{
var lastPart = PortugueseTensMap[number / 10];
if ((number % 10) > 0)
if (number % 10 > 0)
{
lastPart += $" e {ApplyGender(PortugueseUnitsMap[number % 10], gender)}";
}
Expand All @@ -110,7 +110,7 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender)

var parts = new List<string>();

if ((number / 1000000000) > 0)
if (number / 1000000000 > 0)
{
parts.Add(number / 1000000000 == 1
? ApplyOrdinalGender("bilionésimo", gender)
Expand All @@ -119,7 +119,7 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender)
number %= 1000000000;
}

if ((number / 1000000) > 0)
if (number / 1000000 > 0)
{
parts.Add(number / 1000000 == 1
? ApplyOrdinalGender("milionésimo", gender)
Expand All @@ -128,7 +128,7 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender)
number %= 1000000;
}

if ((number / 1000) > 0)
if (number / 1000 > 0)
{
parts.Add(number / 1000 == 1
? ApplyOrdinalGender("milésimo", gender)
Expand All @@ -137,13 +137,13 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender)
number %= 1000;
}

if ((number / 100) > 0)
if (number / 100 > 0)
{
parts.Add(ApplyOrdinalGender(PortugueseOrdinalHundredsMap[number / 100], gender));
number %= 100;
}

if ((number / 10) > 0)
if (number / 10 > 0)
{
parts.Add(ApplyOrdinalGender(PortugueseOrdinalTensMap[number / 10], gender));
number %= 10;
Expand Down
Loading

0 comments on commit af7974e

Please sign in to comment.