Skip to content

Commit 9318b2f

Browse files
committed
fix typo and replace to more better word
1 parent d803365 commit 9318b2f

File tree

6 files changed

+49
-26
lines changed

6 files changed

+49
-26
lines changed

.vscode/cspell.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,30 @@
1111
"language": "en",
1212
// words - list of words to be always considered correct
1313
"words": [
14+
"cloneable",
15+
"LINQ",
1416
"memberwise",
1517
"munin",
1618
"smdn",
19+
"SYSLIB",
1720
],
1821
"ignoreWords": [
1922
"dirtyconfig",
20-
"netstandard",
2123
"multigraph",
22-
"vlabel"
24+
"netstandard",
25+
"rrdgraph",
26+
"vlabel",
27+
],
28+
"ignoreRegExpList": [
29+
"SYSTEM_[A-Z][A-Z0-9_]+",
2330
],
2431
// flagWords - list of words to be always considered incorrect
2532
// This is useful for offensive words and common spelling errors.
2633
// For example "hte" should be "the"
2734
"flagWords": [],
35+
"suggestWords": [
36+
"clonable->cloneable",
37+
],
2838
"ignorePaths": [
2939
"**/bin",
3040
"**/obj",

src/Smdn.Net.MuninNode/Smdn.Net.MuninNode.Protocol/MuninProtocolHandler.cs

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ IMuninNodeProfile profile
101101
this.profile = profile ?? throw new ArgumentNullException(nameof(profile));
102102

103103
banner = $"# munin node at {profile.HostName}";
104+
105+
// cSpell:disable
106+
// the typo 'munins' is intentional, follows the actual munin-node implementation
107+
// ref: https://github.com/munin-monitoring/munin/blob/master/lib/Munin/Node/Server.pm#L320-L322
104108
versionInformation = $"munins node on {profile.HostName} version: {profile.Version}";
109+
// cSpell:enable
105110

106111
ReinitializePluginDictionary();
107112
}
@@ -745,7 +750,7 @@ StringBuilder responseBuilder
745750
.Fields
746751
.Any(static f => !string.IsNullOrEmpty(f.Attributes.NegativeFieldName));
747752

748-
// The fields referenced by {fieldname}.negative must be defined ahread of others,
753+
// The fields referenced by {fieldname}.negative must be defined ahead of others,
749754
// and thus lists the negative field settings first.
750755
// Otherwise, the following error occurs when generating the graph.
751756
// "[RRD ERROR] Unable to graph /var/cache/munin/www/XXX.png : undefined v name XXXXXXXXXXXXXX"
@@ -801,22 +806,26 @@ static bool IsNegativeField(IPluginField field, IReadOnlyCollection<IPluginField
801806
else
802807
return null;
803808
}
804-
805-
static string? TranslateFieldDrawAttribute(PluginFieldGraphStyle style)
806-
=> style switch {
807-
PluginFieldGraphStyle.Default => null,
808-
PluginFieldGraphStyle.Area => "AREA",
809-
PluginFieldGraphStyle.Stack => "STACK",
810-
PluginFieldGraphStyle.AreaStack => "AREASTACK",
811-
PluginFieldGraphStyle.Line => "LINE",
812-
PluginFieldGraphStyle.LineWidth1 => "LINE1",
813-
PluginFieldGraphStyle.LineWidth2 => "LINE2",
814-
PluginFieldGraphStyle.LineWidth3 => "LINE3",
815-
PluginFieldGraphStyle.LineStack => "LINESTACK",
816-
PluginFieldGraphStyle.LineStackWidth1 => "LINE1STACK",
817-
PluginFieldGraphStyle.LineStackWidth2 => "LINE2STACK",
818-
PluginFieldGraphStyle.LineStackWidth3 => "LINE3STACK",
819-
_ => throw new InvalidOperationException($"undefined draw attribute value: ({(int)style} {style})"),
820-
};
821809
}
810+
811+
#pragma warning disable SA1124 // Do not use #regions
812+
#region cSpell:disable
813+
private static string? TranslateFieldDrawAttribute(PluginFieldGraphStyle style)
814+
=> style switch {
815+
PluginFieldGraphStyle.Default => null,
816+
PluginFieldGraphStyle.Area => "AREA",
817+
PluginFieldGraphStyle.Stack => "STACK",
818+
PluginFieldGraphStyle.AreaStack => "AREASTACK",
819+
PluginFieldGraphStyle.Line => "LINE",
820+
PluginFieldGraphStyle.LineWidth1 => "LINE1",
821+
PluginFieldGraphStyle.LineWidth2 => "LINE2",
822+
PluginFieldGraphStyle.LineWidth3 => "LINE3",
823+
PluginFieldGraphStyle.LineStack => "LINESTACK",
824+
PluginFieldGraphStyle.LineStackWidth1 => "LINE1STACK",
825+
PluginFieldGraphStyle.LineStackWidth2 => "LINE2STACK",
826+
PluginFieldGraphStyle.LineStackWidth3 => "LINE3STACK",
827+
_ => throw new InvalidOperationException($"undefined draw attribute value: ({(int)style} {style})"),
828+
};
829+
#endregion cSpell:enable
830+
#pragma warning restore SA1124
822831
}

src/Smdn.Net.MuninNode/Smdn.Net.MuninPlugin/PluginGraphAttributesBuilder.Build.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public IPluginGraphAttributes Build()
5050
if (width is int w)
5151
attributes.Add($"graph_width {w}");
5252

53-
if (updateRate is TimeSpan urate)
54-
attributes.Add($"update_rate {(int)urate.TotalSeconds}");
53+
if (updateRate is TimeSpan rate)
54+
attributes.Add($"update_rate {(int)rate.TotalSeconds}");
5555

5656
attributes.TrimExcess();
5757

src/Smdn.Net.MuninNode/Smdn.Net.MuninPlugin/PluginGraphAttributesBuilder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ public PluginGraphAttributesBuilder WithCategoryOther()
321321
public PluginGraphAttributesBuilder WithCategory(WellKnownCategory category)
322322
=> WithCategory(TranslateWellKnownCategory(category));
323323

324+
#pragma warning disable SA1124 // Do not use #regions
325+
#region cSpell:disable
324326
private static string TranslateWellKnownCategory(WellKnownCategory category)
325327
=> category switch {
326328
WellKnownCategory.OneSec => "1sec",
@@ -368,6 +370,8 @@ private static string TranslateWellKnownCategory(WellKnownCategory category)
368370
WellKnownCategory.Wireless => "wireless",
369371
_ => throw new ArgumentException("not a well known category", paramName: nameof(category)),
370372
};
373+
#endregion cSpell:enable
374+
#pragma warning restore SA1124
371375

372376
/// <summary>Sets a value for the <c>graph_width</c> and <c>graph_height</c>.</summary>
373377
/// <seealso cref="WithWidth"/>

tests/Smdn.Net.MuninNode/Smdn.Net.MuninNode/NodeBase.Accept.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ await reader.ReadLineAsync(cancellationToken),
153153
);
154154

155155
var connected = !(
156-
client.Client.Poll(1 /*microsecs*/, SelectMode.SelectRead) &&
156+
client.Client.Poll(1 /*microseconds*/, SelectMode.SelectRead) &&
157157
client.Client.Available == 0
158158
);
159159

@@ -190,7 +190,7 @@ ex.InnerException is SocketException
190190
}
191191

192192
var connected = !(
193-
client.Client.Poll(1 /*microsecs*/, SelectMode.SelectRead) &&
193+
client.Client.Poll(1 /*microseconds*/, SelectMode.SelectRead) &&
194194
client.Client.Available == 0
195195
);
196196

tests/Smdn.Net.MuninNode/Smdn.Net.MuninPlugin/PluginFieldBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ public void Name_Invalid(string name)
5454
[TestCase("LABEL_")]
5555
[TestCase("0LABEL")]
5656
[TestCase("LABEL0")]
57-
public void Lavel_Valid(string label)
57+
public void Label_Valid(string label)
5858
=> Assert.DoesNotThrow(() => new ConcretePluginField(name: "field", label: label));
5959

6060
[TestCase("")]
6161
[TestCase("\\LABEL")]
6262
[TestCase("LABEL\\")]
6363
[TestCase("#LABEL")]
6464
[TestCase("LABEL#")]
65-
public void Lavel_Invalid(string label)
65+
public void Label_Invalid(string label)
6666
=> Assert.Throws<ArgumentException>(() => new ConcretePluginField(name: "field", label: label));
6767

6868
[TestCase("LABEL", "LABEL")]

0 commit comments

Comments
 (0)