Skip to content

Commit 1cc4383

Browse files
committed
Fix IDE0057 error
1 parent ccfdd1b commit 1cc4383

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/Microsoft.ComponentDetection.Detectors/kubernetes/KubernetesComponentDetector.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,27 +149,27 @@ private static bool LooksLikeKubernetesManifest(string contents)
149149
continue;
150150
}
151151

152-
var afterKind = trimmed.Slice(4).TrimStart();
152+
var afterKind = trimmed[4..].TrimStart();
153153
if (afterKind.IsEmpty || afterKind[0] != ':')
154154
{
155155
continue;
156156
}
157157

158-
var value = afterKind.Slice(1).Trim();
158+
var value = afterKind[1..].Trim();
159159

160160
// Strip inline YAML comments (K8s kind values never contain '#').
161161
var commentIdx = value.IndexOf('#');
162162
if (commentIdx >= 0)
163163
{
164-
value = value.Slice(0, commentIdx).TrimEnd();
164+
value = value[..commentIdx].TrimEnd();
165165
}
166166

167167
// Strip optional surrounding quotes (e.g. kind: "Deployment").
168168
if (value.Length >= 2 &&
169169
((value[0] == '"' && value[^1] == '"') ||
170170
(value[0] == '\'' && value[^1] == '\'')))
171171
{
172-
value = value.Slice(1, value.Length - 2).Trim();
172+
value = value[1..^1].Trim();
173173
}
174174

175175
if (!value.IsEmpty && KubernetesKinds.Contains(value.ToString()))

0 commit comments

Comments
 (0)