Skip to content

Commit 3a0aea5

Browse files
committed
Address some naming issues (via disabling the syntax check)
1 parent 2fe37f6 commit 3a0aea5

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

src/Microsoft.ML.XGBoost/WrappedXGBoostInterface.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,13 @@ public static extern int XGBoosterPredict(IntPtr bHandle, IntPtr dHandle,
8888
#endregion
8989

9090
#region API serialization
91+
#pragma warning disable MSML_ParameterLocalVarName
9192
[DllImport(DllName)]
9293
public static extern int XGBoosterDumpModel(IntPtr handle, string fmap, int with_stats, out int out_len, out IntPtr dumpStr);
9394

9495
[DllImport(DllName)]
9596
public static extern int XGBoosterDumpModelEx(IntPtr handle, string fmap, int with_stats, string format, out int out_len, out IntPtr dumpStr);
97+
#pragma warning restore MSML_ParameterLocalVarName
9698
#endregion
9799

98100
}

src/Microsoft.ML.XGBoost/WrappedXGBooster.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ namespace Microsoft.ML.Trainers.XGBoost
3232
/// </summary>
3333
internal class Booster : IDisposable
3434
{
35-
35+
#pragma warning disable MSML_PrivateFieldName // Private field name not in: _camelCase format
3636
private bool disposed;
3737
private readonly IntPtr _handle;
3838
private const int normalPrediction = 0; // Value for the optionMask in prediction
39-
#pragma warning disable CS0414
4039
private int numClass = 1;
41-
#pragma warning restore CS0414
40+
#pragma warning restore MSML_PrivateFieldName
4241

4342
public IntPtr Handle => _handle;
4443

@@ -179,8 +178,9 @@ public void SetParameter(string name, string val)
179178
}
180179

181180
#region Create Models
182-
181+
#pragma warning disable MSML_ParameterLocalVarName
183182
public string[] DumpModelEx(string fmap, int with_stats, string format)
183+
#pragma warning restore MSML_ParameterLocalVarName
184184
{
185185
int length;
186186
IntPtr treePtr;
@@ -233,10 +233,12 @@ public void GetModel()
233233

234234
private class TablePopulator
235235
{
236+
#pragma warning disable MSML_GeneralName
236237
public Dictionary<int, List<JsonElement>> dict = new();
237238
public Dictionary<string, int> nodes = new();
238239
public Dictionary<string, string> lte = new();
239240
public Dictionary<string, string> gt = new();
241+
#pragma warning restore MSML_GeneralName
240242

241243
public TablePopulator(JsonElement elm)
242244
{

src/Microsoft.ML.XGBoost/WrappedXGDMatrix.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@ namespace Microsoft.ML.Trainers.XGBoost
1212
/// </summary>
1313
internal sealed class DMatrix : IDisposable
1414
{
15+
#pragma warning disable MSML_PrivateFieldName
1516
private bool disposed = false;
17+
#pragma warning restore MSML_PrivateFieldName
18+
#pragma warning disable IDE0044
1619
private IntPtr _handle;
20+
#pragma warning restore IDE0044
1721
public IntPtr Handle => _handle;
1822
private const float Missing = 0f;
1923

2024
/// <summary>
2125
/// Create a <see cref="DMatrix"/> for storing training and prediction data under XGBoost framework.
2226
/// </summary>
27+
#nullable enable
2328
public unsafe DMatrix(float[] data, uint nrows, uint ncols, float[]? labels = null)
2429
{
2530
int errp = WrappedXGBoostInterface.XGDMatrixCreateFromMat(data, nrows, ncols, Missing, out _handle);
@@ -35,6 +40,7 @@ public unsafe DMatrix(float[] data, uint nrows, uint ncols, float[]? labels = nu
3540
}
3641

3742
}
43+
#nullable disable
3844

3945
public ulong GetNumRows()
4046
{

src/Microsoft.ML.XGBoost/XGBoostInterface.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public struct XGBoostVersion
3939

4040
public static XGBoostVersion Version()
4141
{
42-
int major, minor, patch;
42+
int major;
43+
int minor;
44+
int patch;
4345
WrappedXGBoostInterface.XGBoostVersion(out major, out minor, out patch);
4446
return new XGBoostVersion
4547
{

0 commit comments

Comments
 (0)