diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..2a93aa0 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "jetbrains.resharper.globaltools": { + "version": "2021.2.2", + "commands": [ + "jb" + ] + } + } +} \ No newline at end of file diff --git a/Common.DotSettings b/Common.DotSettings index a3d6674..5adb19b 100644 --- a/Common.DotSettings +++ b/Common.DotSettings @@ -1,17 +1,38 @@  False True + True AssemblyInfo.cs True DO_NOT_SHOW DO_NOT_SHOW ERROR + ERROR + DO_NOT_SHOW True HINT DO_NOT_SHOW DO_NOT_SHOW - <?xml version="1.0" encoding="utf-16"?><Profile name="CatalogueCleanup"><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><HtmlReformatCode>True</HtmlReformatCode><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_BOTH</BehavourStyle><LocalVariableStyle>ALWAYS_IMPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_IMPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSReorderTypeMembers>True</CSReorderTypeMembers><JsReformatCode>True</JsReformatCode><JsFormatDocComments>True</JsFormatDocComments><XMLReformatCode>True</XMLReformatCode></Profile> + ERROR + ERROR + <?xml version="1.0" encoding="utf-16"?><Profile name="CatalogueCleanup"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSUseVar><BehavourStyle>CAN_CHANGE_BOTH</BehavourStyle><LocalVariableStyle>ALWAYS_IMPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_IMPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSReorderTypeMembers>True</CSReorderTypeMembers><JsReformatCode>True</JsReformatCode><JsFormatDocComments>True</JsFormatDocComments><IDEA_SETTINGS>&lt;profile version="1.0"&gt; + &lt;option name="myName" value="CatalogueCleanup" /&gt; + &lt;inspection_tool class="ES6ShorthandObjectProperty" enabled="false" level="INFORMATION" enabled_by_default="false" /&gt; + &lt;inspection_tool class="JSArrowFunctionBracesCanBeRemoved" enabled="false" level="INFORMATION" enabled_by_default="false" /&gt; + &lt;inspection_tool class="JSPrimitiveTypeWrapperUsage" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="JSRemoveUnnecessaryParentheses" enabled="false" level="INFORMATION" enabled_by_default="false" /&gt; + &lt;inspection_tool class="JSUnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="TypeScriptExplicitMemberType" enabled="false" level="INFORMATION" enabled_by_default="false" /&gt; + &lt;inspection_tool class="UnnecessaryContinueJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="UnnecessaryLabelJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="UnnecessaryLabelOnBreakStatementJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="UnnecessaryLabelOnContinueStatementJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="UnnecessaryReturnJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; +&lt;/profile&gt;</IDEA_SETTINGS><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><FormatAttributeQuoteDescriptor>True</FormatAttributeQuoteDescriptor></Profile> + <?xml version="1.0" encoding="utf-16"?><Profile name="FullCatalogueCleanup"><XMLReformatCode>True</XMLReformatCode><CSCodeStyleAttributes ArrangeTypeAccessModifier="False" ArrangeTypeMemberAccessModifier="False" SortModifiers="False" RemoveRedundantParentheses="False" AddMissingParentheses="False" ArrangeBraces="False" ArrangeAttributes="False" ArrangeArgumentsStyle="False" ArrangeCodeBodyStyle="False" ArrangeVarStyle="False" ArrangeTrailingCommas="False" /><HtmlReformatCode>True</HtmlReformatCode><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><RemoveCodeRedundanciesVB>True</RemoveCodeRedundanciesVB><VBOptimizeImports>True</VBOptimizeImports><VBShortenReferences>True</VBShortenReferences><VBFormatDocComments>True</VBFormatDocComments><CSharpFormatDocComments>True</CSharpFormatDocComments><CSShortenReferences>True</CSShortenReferences><CSReorderTypeMembers>True</CSReorderTypeMembers><IDEA_SETTINGS>&lt;profile version="1.0"&gt; + &lt;option name="myName" value="FullCatalogueCleanup" /&gt; +&lt;/profile&gt;</IDEA_SETTINGS></Profile> CatalogueCleanup public protected internal private new abstract virtual override sealed static readonly extern unsafe volatile async True @@ -22,12 +43,16 @@ True True NEXT_LINE_SHIFTED_2 + 0 NEXT_LINE_SHIFTED_2 NEXT_LINE_SHIFTED_2 - True + 10000 + False NEVER NEVER + False 120 + WRAP_IF_LONG False False <?xml version="1.0" encoding="utf-16"?> @@ -113,13 +138,15 @@ False False False + False AP AB TTN WB $object$_On$event$ - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="_Test" Style="AaBb_AaBb" /></Policy> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="Test" Suffix="" Style="AaBb_AaBb" /><ExtraRule Prefix="" Suffix="Test" Style="AaBb_AaBb" /></Policy> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="Test" Suffix="" Style="AaBb" /><ExtraRule Prefix="" Suffix="Test" Style="AaBb" /></Policy> <Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="AaBb_AaBb" /></Policy> @@ -311,21 +338,23 @@ public void SetUp() cbn True [CanBeNull] - True - True - Imported 29.01.2015 - True - 0 - True - True - 2.0 - InCSharpStatement - True - 2.0 - InCSharpFile - ipse - True - throw new InvalidProgramStateException("$TODO$"); + False + + + + + + + + + + + + + + + True + True diff --git a/Directory.Build.props b/Directory.Build.props index 7e94621..c485c94 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,8 +13,8 @@ - - + + \ No newline at end of file diff --git a/GroBuf.Tests/GroBuf.Tests.csproj b/GroBuf.Tests/GroBuf.Tests.csproj index 97b5cc6..9376866 100644 --- a/GroBuf.Tests/GroBuf.Tests.csproj +++ b/GroBuf.Tests/GroBuf.Tests.csproj @@ -2,15 +2,15 @@ false - net48;netcoreapp2.1;netcoreapp3.1;net5.0 + net48;netcoreapp3.1;net5.0;net6.0 - - - - - + + + + + diff --git a/GroBuf.Tests/TestStrings.cs b/GroBuf.Tests/TestStrings.cs index 09ae456..4b6dd17 100644 --- a/GroBuf.Tests/TestStrings.cs +++ b/GroBuf.Tests/TestStrings.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Text; @@ -44,28 +44,28 @@ public void TestPerformance() [Test] public void TestString() { - const string s = "zzz \u2376 \uDEAD"; + const string s = "zzz ароваро \u2376 \uDEAD"; byte[] bytes = serializer.Serialize(s); var deserialize = serializer.Deserialize(bytes); - Assert.AreEqual("zzz \u2376 \uDEAD", deserialize); + Assert.AreEqual("zzz ароваро \u2376 \uDEAD", deserialize); } [Test] public void TestString1() { - const string s = "zzz \u2376 \uDEAD"; + const string s = "zzz ароваро \u2376 \uDEAD"; byte[] bytes = serializer.Serialize(typeof(string), s); var deserialize = serializer.Deserialize(typeof(string), bytes); - Assert.AreEqual("zzz \u2376 \uDEAD", deserialize); + Assert.AreEqual("zzz ароваро \u2376 \uDEAD", deserialize); } [Test] public void TestStringInProp() { - const string s = "zzz \u2376 \uDEAD"; + const string s = "zzz ароваро \u2376 \uDEAD"; byte[] bytes = serializer.Serialize(new WithS {S = s}); var deserialize = serializer.Deserialize(bytes); - Assert.AreEqual("zzz \u2376 \uDEAD", deserialize.S); + Assert.AreEqual("zzz ароваро \u2376 \uDEAD", deserialize.S); } [Test] diff --git a/GroBuf.Tests/TestTools/XmlHelpers.cs b/GroBuf.Tests/TestTools/XmlHelpers.cs index b660353..5de9baf 100644 --- a/GroBuf.Tests/TestTools/XmlHelpers.cs +++ b/GroBuf.Tests/TestTools/XmlHelpers.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Text; using System.Xml; @@ -11,7 +11,7 @@ public static XmlNode GoToChild(this XmlNode node, string name) { var xmlNode = TryGoToChild(node, name); if (xmlNode != null) return xmlNode; - throw new FormatException(string.Format(" '{0}' '{1}'", node.Name, name)); + throw new FormatException(string.Format("У элемента '{0}' не найдено дочернего '{1}'", node.Name, name)); } public static XmlNode TryGoToChild(this XmlNode node, string name) diff --git a/GroBuf/GroBuf.csproj b/GroBuf/GroBuf.csproj index d3a68ef..ab96b47 100644 --- a/GroBuf/GroBuf.csproj +++ b/GroBuf/GroBuf.csproj @@ -7,7 +7,7 @@ - + diff --git a/GroBuf/Readers/ReaderMethodBuilderContext.cs b/GroBuf/Readers/ReaderMethodBuilderContext.cs index 0f585d9..dca95a5 100644 --- a/GroBuf/Readers/ReaderMethodBuilderContext.cs +++ b/GroBuf/Readers/ReaderMethodBuilderContext.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Reflection; @@ -201,7 +201,7 @@ public void SkipValue() LoadIndexByRef(); // stack: [ref index] LoadIndex(); // stack: [ref index, index] - // todo: switch + // todo: сделать switch Il.Ldloc(TypeCode); // stack: [ref index, index, TypeCode] Il.Ldc_I4((int)GroBufTypeCode.DateTimeOld); // stack: [ref index, index, TypeCode, GroBufTypeCode.DateTimeOld] var notDateTimeLabel = Il.DefineLabel("notDateTime"); diff --git a/appveyor.yml b/appveyor.yml index 7d97707..71d4059 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,36 +4,46 @@ skip_commits: files: - '**/*.md' -image: Visual Studio 2019 +image: Visual Studio 2022 init: - cmd: git config --global core.autocrlf false + +nuget: + disable_publish_on_pr: true + +before_build: - ps: | $ErrorActionPreference = "Stop" $tagName = $env:APPVEYOR_REPO_TAG_NAME if ($tagName -match '^v\d+\.\d+') # tag name starts with 'vX.Y' { + $version = $tagName.Substring(1) $env:SHOULD_PUBLISH_NUGET_PACKAGE = "true" Write-Host "Will publish nuget package for $tagName tag" -ForegroundColor "Green" if ($tagName -match '^v\d+\.\d+-release') # tag name starts with 'vX.Y-release' (e.g. use 'v4.2-release.1' tag for the first patch for release v4.2) { + $version = $version.Substring(0, $version.IndexOf("-release")) $env:SHOULD_CREATE_RELEASE = "true" Write-Host "Will create release for $tagName tag" -ForegroundColor "Green" } + $matchVersion = Select-String -Path ./version.json -Pattern "`"version`": `"$version`"" + if ($matchVersion -eq $null) + { + Write-Error "Version in tag ($version) does not match version in version.json" + } } - -nuget: - disable_publish_on_pr: true - -before_build: - cmd: dotnet --info - - cmd: dotnet restore ./GroBuf.sln --verbosity m + - cmd: dotnet restore ./GroBuf.sln --verbosity minimal + - cmd: dotnet tool restore build_script: - cmd: dotnet build --configuration Release ./GroBuf.sln - cmd: dotnet pack --no-build --configuration Release ./GroBuf.sln test_script: + - cmd: dotnet jb cleanupcode GroBuf.sln --profile=CatalogueCleanup --verbosity=WARN + - cmd: git diff --exit-code - cmd: dotnet test --no-build --configuration Release --filter TestCategory!=LongRunning ./GroBuf.Tests/GroBuf.Tests.csproj artifacts: @@ -43,7 +53,7 @@ deploy: - provider: NuGet server: https://nuget.org api_key: - secure: y2RPf+gBBqffQVm8pg9qZcg99m7K8hsSa4z7VHvIE6t+kuO7r/oIqTVcryZzL93D + secure: 3Myenol+seNdEnkmH7tadxQLsmOE7VWQSp6vQii4vt2dX1S7XwjNV4T24HQTUsrr skip_symbols: true on: SHOULD_PUBLISH_NUGET_PACKAGE: true diff --git a/global.json b/global.json index 8c50959..d6c2c37 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,6 @@ { "sdk": { - "version": "5.0.103" + "version": "6.0.100", + "rollForward": "latestFeature" } } \ No newline at end of file