Skip to content

Commit 217a1b3

Browse files
authored
Merge pull request #1355 from yukon39/issue-1344
[WIP] Исправление замечаний сонара и рефакторинг
2 parents c030fd4 + dbe9f5c commit 217a1b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+436
-389
lines changed

Build_Core.csproj

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
ItemName="BuildVariant"/>
7070
</CreateItem>
7171

72-
<Exec Command="dotnet publish &quot;src/%(BuildVariant.Identity)/%(BuildVariant.ProjectFile)&quot; -f %(BuildVariant.Framework) -c $(Configuration) -p:Platform=%(BuildVariant.Platform) -p:UseAppHost=false -o &quot;$(ArtifactsRoot)/fdd-%(BuildVariant.Suffix)/bin&quot;"/>
72+
<Exec Command="dotnet publish &quot;src/%(BuildVariant.Identity)/%(BuildVariant.ProjectFile)&quot; -f %(BuildVariant.Framework) -c $(Configuration) -p:Platform=%(BuildVariant.Platform) -p:UseAppHost=false -o &quot;$(ArtifactsRoot)/fdd-%(BuildVariant.Suffix)/bin&quot;" UseUtf8Encoding="Always"/>
7373

7474
<PropertyGroup>
7575
<CppBinPrefix>$(MSBuildProjectDirectory)/src/ScriptEngine.NativeApi/bin/$(Configuration)</CppBinPrefix>
@@ -105,9 +105,9 @@
105105
<RuntimeID Include="osx-arm64"/>
106106
</ItemGroup>
107107

108-
<Exec Command="dotnet publish &quot;src/oscript/oscript.csproj&quot; -r %(RuntimeID.Identity) --self-contained -c $(Configuration) -o &quot;$(ArtifactsRoot)/%(RuntimeID.Identity)/bin&quot;"/>
108+
<Exec Command="dotnet publish &quot;src/oscript/oscript.csproj&quot; -r %(RuntimeID.Identity) --self-contained -c $(Configuration) -o &quot;$(ArtifactsRoot)/%(RuntimeID.Identity)/bin&quot;" UseUtf8Encoding="Always"/>
109109

110-
<PropertyGroup>
110+
<PropertyGroup>
111111
<CppBinPrefix>$(MSBuildProjectDirectory)/src/ScriptEngine.NativeApi/bin/$(Configuration)</CppBinPrefix>
112112
</PropertyGroup>
113113

@@ -181,8 +181,8 @@
181181
<Output TaskParameter="FirstItem" PropertyName="Runner"/>
182182
</GetFirstItem>
183183

184-
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)/install/unicode-zipper.os&quot; unpack &quot;$(MSBuildProjectDirectory)/install/opm.ospx&quot; &quot;$(LibDir)/tmp&quot;"/>
185-
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)/install/unicode-zipper.os&quot; unpack &quot;$(LibDir)/tmp/content.zip&quot; &quot;$(LibDir)/opm&quot;"/>
184+
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)/install/unicode-zipper.os&quot; unpack &quot;$(MSBuildProjectDirectory)/install/opm.ospx&quot; &quot;$(LibDir)/tmp&quot;" UseUtf8Encoding="Always"/>
185+
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)/install/unicode-zipper.os&quot; unpack &quot;$(LibDir)/tmp/content.zip&quot; &quot;$(LibDir)/opm&quot;" UseUtf8Encoding="Always"/>
186186

187187
<Copy SourceFiles="$(MSBuildProjectDirectory)\install\package-loader.os" DestinationFolder="$(LibDir)"/>
188188
<RemoveDir Directories="$(LibDir)/tmp"/>
@@ -204,7 +204,8 @@
204204
<Exec Command="$(OpmLaunch) install -d &quot;$(LibDir)&quot; %(CoreLibraries.Identity)"
205205
IgnoreExitCode="false"
206206
EnvironmentVariables="@(ConfigEnv)"
207-
Condition="'$(SkipLibraryDownload)' == ''"/>
207+
Condition="'$(SkipLibraryDownload)' == ''"
208+
UseUtf8Encoding="Always"/>
208209

209210
</Target>
210211

@@ -256,6 +257,7 @@
256257
WorkingDirectory="$(TestsRoot)/%(TestAssemblies.Identity)"
257258
Command="dotnet test --logger:&quot;junit;LogFilePath=$(MSBuildProjectDirectory)/tests/%(TestAssemblies.Identity).xml&quot;"
258259
IgnoreExitCode="true"
260+
UseUtf8Encoding="Always"
259261
/>
260262

261263
</Target>
@@ -276,7 +278,8 @@
276278
WorkingDirectory="$(MSBuildProjectDirectory)\tests"
277279
Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)\tests\testrunner.os&quot; -runall . xddReportPath ."
278280
IgnoreExitCode="true"
279-
ContinueOnError="true">
281+
ContinueOnError="true"
282+
UseUtf8Encoding="Always">
280283
<Output TaskParameter="ExitCode" PropertyName="TestsExitCode"/>
281284
</Exec>
282285

@@ -307,7 +310,7 @@
307310
<Output TaskParameter="FirstItem" PropertyName="Runner"/>
308311
</GetFirstItem>
309312

310-
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)\install\unicode-zipper.os&quot; pack &quot;$(ArtifactsRoot)/%(RuntimeID.Identity)/*&quot; &quot;$(ArtifactsRoot)/OneScript-$(ReleaseNumber)-%(RuntimeID.Identity).zip&quot;"/>
313+
<Exec Command="dotnet &quot;$(Runner)&quot; &quot;$(MSBuildProjectDirectory)\install\unicode-zipper.os&quot; pack &quot;$(ArtifactsRoot)/%(RuntimeID.Identity)/*&quot; &quot;$(ArtifactsRoot)/OneScript-$(ReleaseNumber)-%(RuntimeID.Identity).zip&quot;" UseUtf8Encoding="Always"/>
311314
<RemoveDir Directories="$(ArtifactsRoot)/%(RuntimeID.Identity)" />
312315
</Target>
313316

@@ -346,7 +349,7 @@
346349

347350
<Error Text="No nuget token (/p:NugetToken=) specified" Condition="'$(NugetToken)' == ''" />
348351
<Exec WorkingDirectory="$(MSBuildProjectDirectory)\built\nuget"
349-
Command="dotnet nuget push %(NugetAbleProject.Identity).$(ReleaseNumber).nupkg -k $(NugetToken) -s https://api.nuget.org/v3/index.json"/>
352+
Command="dotnet nuget push %(NugetAbleProject.Identity).$(ReleaseNumber).nupkg -k $(NugetToken) -s https://api.nuget.org/v3/index.json" UseUtf8Encoding="Always"/>
350353

351354
</Target>
352355

src/OneScript.StandardLibrary/XDTO/XDTOSerializer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This Source Code Form is subject to the terms of the
2020
namespace OneScript.StandardLibrary.XDTO
2121
{
2222
[ContextClass("СериализаторXDTO", "XDTOSerializer")]
23-
public class XDTOSerializer : AutoContext<XDTOSerializer>
23+
public sealed class XDTOSerializer : AutoContext<XDTOSerializer>
2424
{
2525
private readonly ITypeManager _typeManager;
2626
private readonly XmlGlobalFunctions _xmlGlobalFunctions;
@@ -223,7 +223,7 @@ public IValue ReadXML(XmlReaderImpl xmlReader, IValue valueType = null)
223223
}
224224
else if (xsiNil.SystemType == BasicTypes.String)
225225
typeValue = new BslTypeValue(BasicTypes.Undefined);
226-
};
226+
}
227227

228228
if (typeValue == null)
229229
throw RuntimeException.InvalidArgumentValue();

src/OneScript.StandardLibrary/XMLSchema/Collections/XMLSchemaSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This Source Code Form is subject to the terms of the
1818
namespace OneScript.StandardLibrary.XMLSchema.Collections
1919
{
2020
[ContextClass("НаборСхемXML", "XMLSchemaSet")]
21-
public class XMLSchemaSet : AutoCollectionContext<XMLSchemaSet, Objects.XMLSchema>
21+
public sealed class XMLSchemaSet : AutoCollectionContext<XMLSchemaSet, Objects.XMLSchema>
2222
{
2323
private readonly XmlSchemaSet _schemaSet;
2424
private readonly List<Objects.XMLSchema> _items;

src/OneScript.StandardLibrary/XMLSchema/Collections/XSComplexFinalUnion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This Source Code Form is subject to the terms of the
1616
namespace OneScript.StandardLibrary.XMLSchema.Collections
1717
{
1818
[ContextClass("ОбъединениеЗавершенностиСоставногоТипаXS", "XSComplexFinalUnion")]
19-
public class XSComplexFinalUnion : AutoContext<XSComplexFinalUnion>
19+
public sealed class XSComplexFinalUnion : AutoContext<XSComplexFinalUnion>
2020
{
2121
private readonly ArrayImpl _values;
2222

src/OneScript.StandardLibrary/XMLSchema/Collections/XSComponentFixedList.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ This Source Code Form is subject to the terms of the
1414
namespace OneScript.StandardLibrary.XMLSchema.Collections
1515
{
1616
[ContextClass("ФиксированныйСписокКомпонентXS", "XSComponentFixedList")]
17-
public class XSComponentFixedList : AutoCollectionContext<XSComponentFixedList, IXSComponent>
17+
public sealed class XSComponentFixedList : AutoCollectionContext<XSComponentFixedList, IXSComponent>
1818
{
1919

2020
private readonly List<IXSComponent> _items;
2121

2222
public XSComponentFixedList() => _items = new List<IXSComponent>();
2323

24+
public static XSComponentFixedList EmptyList() => new XSComponentFixedList();
25+
2426
public void Add(IXSComponent value) => _items.Add(value);
2527
public void Remove(IXSComponent value) => _items.Remove(value);
2628
public void Clear() => _items.Clear();

src/OneScript.StandardLibrary/XMLSchema/Collections/XSComponentList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This Source Code Form is subject to the terms of the
1717
namespace OneScript.StandardLibrary.XMLSchema.Collections
1818
{
1919
[ContextClass("СписокКомпонентXS", "XSComponentList")]
20-
public class XSComponentList : AutoCollectionContext<XSComponentList, IXSComponent>
20+
public sealed class XSComponentList : AutoCollectionContext<XSComponentList, IXSComponent>
2121
{
2222
private readonly List<IXSComponent> _items;
2323

src/OneScript.StandardLibrary/XMLSchema/Collections/XSDisallowedSubstitutionsUnion.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ This Source Code Form is subject to the terms of the
1010
using OneScript.StandardLibrary.Collections;
1111
using OneScript.StandardLibrary.XMLSchema.Enumerations;
1212
using OneScript.Types;
13-
using ScriptEngine.Machine;
1413
using ScriptEngine.Machine.Contexts;
1514

1615
namespace OneScript.StandardLibrary.XMLSchema.Collections
1716
{
1817
[ContextClass("ОбъединениеНедопустимыхПодстановкиXS", "XSDisallowedSubstitutionsUnion")]
19-
public class XsDisallowedSubstitutionsUnion : AutoContext<XsDisallowedSubstitutionsUnion>
18+
public sealed class XsDisallowedSubstitutionsUnion : AutoContext<XsDisallowedSubstitutionsUnion>
2019
{
21-
private ArrayImpl _values;
20+
private readonly ArrayImpl _values;
2221

2322
private bool Contains(XmlSchemaDerivationMethod value)
2423
{
25-
XSDisallowedSubstitutions enumValue = EnumerationXSDisallowedSubstitutions.FromNativeValue(value);
26-
IValue idx = _values.Find(enumValue);
24+
var enumValue = EnumerationXSDisallowedSubstitutions.FromNativeValue(value);
25+
var idx = _values.Find(enumValue);
2726
return (idx.SystemType != BasicTypes.Undefined);
2827
}
2928

src/OneScript.StandardLibrary/XMLSchema/Collections/XSNamedComponentMap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This Source Code Form is subject to the terms of the
1818
namespace OneScript.StandardLibrary.XMLSchema.Collections
1919
{
2020
[ContextClass("КоллекцияИменованныхКомпонентXS", "XSNamedComponentMap")]
21-
public class XSNamedComponentMap : AutoCollectionContext<XSNamedComponentMap, IXSNamedComponent>
21+
public sealed class XSNamedComponentMap : AutoCollectionContext<XSNamedComponentMap, IXSNamedComponent>
2222
{
2323
private readonly List<IXSNamedComponent> _items;
2424

src/OneScript.StandardLibrary/XMLSchema/Collections/XSProhibitedSubstitutionsUnion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This Source Code Form is subject to the terms of the
1616
namespace OneScript.StandardLibrary.XMLSchema.Collections
1717
{
1818
[ContextClass("ОбъединениеЗапрещенныхПодстановокXS", "XSProhibitedSubstitutionsUnion")]
19-
public class XsProhibitedSubstitutionsUnion : AutoContext<XsProhibitedSubstitutionsUnion>
19+
public sealed class XsProhibitedSubstitutionsUnion : AutoContext<XsProhibitedSubstitutionsUnion>
2020
{
2121
private readonly ArrayImpl _values;
2222

src/OneScript.StandardLibrary/XMLSchema/Collections/XSSchemaFinalUnion.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ This Source Code Form is subject to the terms of the
1010
using OneScript.StandardLibrary.Collections;
1111
using OneScript.StandardLibrary.XMLSchema.Enumerations;
1212
using OneScript.Types;
13-
using ScriptEngine.Machine;
1413
using ScriptEngine.Machine.Contexts;
1514

1615
namespace OneScript.StandardLibrary.XMLSchema.Collections
1716
{
1817
[ContextClass("ОбъединениеЗавершенностиСхемыXS", "XSSchemaFinalUnion")]
19-
public class XSSchemaFinalUnion : AutoContext<XSSchemaFinalUnion>
18+
public sealed class XSSchemaFinalUnion : AutoContext<XSSchemaFinalUnion>
2019
{
21-
private ArrayImpl _values;
20+
private readonly ArrayImpl _values;
2221

2322
private bool Contains(XmlSchemaDerivationMethod value)
2423
{
2524
var enumValue = EnumerationXSSchemaFinal.Instance.FromNativeValue(value);
26-
IValue idx = _values.Find(enumValue);
25+
var idx = _values.Find(enumValue);
2726
return (idx.SystemType != BasicTypes.Undefined);
2827
}
2928

0 commit comments

Comments
 (0)