Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version to v3.5.3 #463

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/SonarCloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
# (PRs from forks can't access secrets other than secrets.GITHUB_TOKEN for security reasons)
if: ${{ !github.event.pull_request.head.repo.fork }}
env:
version: '3.5.2'
versionFile: '3.5.2'
version: '3.5.3'
versionFile: '3.5.3'
steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"${{ github.event.repository.owner.login }}_SmartFormat" /o:"${{ github.event.repository.owner.login }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.exclusions="**/SmartFormat.ZString/**/*" /d:sonar.cs.opencover.reportsPaths="./src/SmartFormat.Tests/**/coverage*.xml"
.\.sonar\scanner\dotnet-sonarscanner begin /k:"${{ github.event.repository.owner.login }}_SmartFormat" /o:"${{ github.event.repository.owner.login }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.scanner.scanAll=false /d:sonar.host.url="https://sonarcloud.io" /d:sonar.exclusions="**/SmartFormat.ZString/**/*" /d:sonar.cs.opencover.reportsPaths="./src/SmartFormat.Tests/**/coverage*.xml"
dotnet sln ./src/SmartFormat.sln remove ./src/Demo/Demo.csproj
dotnet add ./src/SmartFormat.Tests/SmartFormat.Tests.csproj package AltCover
dotnet restore ./src/SmartFormat.sln
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ for:
- ps: dotnet restore SmartFormat.sln --verbosity quiet
- ps: dotnet add .\SmartFormat.Tests\SmartFormat.Tests.csproj package AltCover
- ps: |
$version = "3.5.2"
$version = "3.5.3"
$versionFile = $version + "." + ${env:APPVEYOR_BUILD_NUMBER}

if ($env:APPVEYOR_PULL_REQUEST_NUMBER) {
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<Copyright>Copyright 2011-$(CurrentYear) SmartFormat Project</Copyright>
<RepositoryUrl>https://github.com/axuno/SmartFormat.git</RepositoryUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<Version>3.5.2</Version>
<FileVersion>3.5.2</FileVersion>
<Version>3.5.3</Version>
<FileVersion>3.5.3</FileVersion>
<AssemblyVersion>3.0.0</AssemblyVersion> <!--only update AssemblyVersion with major releases -->
<LangVersion>latest</LangVersion>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
Expand Down
3 changes: 2 additions & 1 deletion src/SmartFormat/Core/Parsing/SplitList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public Format this[int index]
{
get
{
if (index > _splits.Count) throw new ArgumentOutOfRangeException(nameof(index)); //NOSONAR - ArgumentOutOfRangeException.ThrowIfGreaterThan < net5.0
// Can't use ArgumentOutOfRangeException.ThrowIfGreaterThan < net5.0
if (index > _splits.Count) throw new ArgumentOutOfRangeException(nameof(index)); //NOSONAR

if (_splits.Count == 0) return _format;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,7 @@ public void Add(string name, IVariable variable)
/// <returns><see langword="true"/> if a variable with the specified name was removed, <see langword="false"/> if one was not.</returns>
public bool Remove(string name)
{
if (_variableLookup.TryGetValue(name, out var v))
{
return _variableLookup.Remove(name);
}
return false;
return _variableLookup.Remove(name);
}

/// <summary>
Expand Down Expand Up @@ -200,4 +196,4 @@ public void Clear()
{
_variableLookup.Clear();
}
}
}
10 changes: 2 additions & 8 deletions src/SmartFormat/Extensions/PersistentVariablesSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,7 @@ public void Add(string name, VariablesGroup group)
/// <returns><see langword="true"/> if a <see cref="VariablesGroup"/> with a matching name was found and removed, or <see langword="true"/> if one was not.</returns>
public bool Remove(string name)
{
if (GroupLookup.TryGetValue(name, out var v))
{
GroupLookup.Remove(name);
return true;
}

return false;
return GroupLookup.Remove(name);
}

/// <inheritdoc cref="Remove(string)"/>
Expand Down Expand Up @@ -248,4 +242,4 @@ private static bool TryEvaluateGroup(ISelectorInfo selectorInfo, IVariablesGroup
selectorInfo.Result = variable.GetValue();
return true;
}
}
}
12 changes: 6 additions & 6 deletions src/SmartFormat/Extensions/PluralLocalizationFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public PluralLocalizationFormatter(string defaultTwoLetterIsoLanguageName)
}

/// <summary>
/// Gets or sets the two letter ISO language name.
/// Gets or sets the two-letter ISO language name.
/// </summary>
/// <remarks>
/// Culture is now determined in this sequence:<br/>
Expand Down Expand Up @@ -79,7 +79,7 @@ public PluralLocalizationFormatter(string defaultTwoLetterIsoLanguageName)
/// With <see cref="CanAutoDetect"/> == <see langword="false"/>, the formatter can only be
/// called by its name in the input format string.
/// <para/>
/// <b>Auto detection only works with more than 1 format argument.
/// <b>Auto-detection only works with more than 1 format argument.
/// It is recommended to set <see cref="CanAutoDetect"/> to <see langword="false"/>. This will be the default in a future version.
/// </b>
/// </summary>
Expand Down Expand Up @@ -111,8 +111,8 @@ public bool TryEvaluateFormat(IFormattingInfo formattingInfo)

var useAutoDetection = string.IsNullOrEmpty(formattingInfo.Placeholder?.FormatterName);

// This extension requires at least two plural words for auto detection
// Valid types for auto detection are checked later
// This extension requires at least two plural words for auto-detection
// Valid types for auto-detection are checked later
if (useAutoDetection && pluralWords.Count <= 1) return false;

decimal value;
Expand All @@ -133,7 +133,7 @@ public bool TryEvaluateFormat(IFormattingInfo formattingInfo)
break;
default:
{
// Auto detection calls just return a failure to evaluate
// Auto-detection calls just return a failure to evaluate
if (useAutoDetection) return false;

// throw, if the formatter has been called explicitly
Expand All @@ -150,7 +150,7 @@ public bool TryEvaluateFormat(IFormattingInfo formattingInfo)

if (pluralIndex < 0 || pluralWords.Count <= pluralIndex)
throw new FormattingException(format, $"Invalid number of plural parameters in {nameof(PluralLocalizationFormatter)}",
pluralWords.Last().EndIndex);
pluralWords.Count - 1);

// Output the selected word (allowing for nested formats):
var pluralForm = pluralWords[pluralIndex];
Expand Down