• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 26147248174

20 May 2026 07:10AM UTC coverage: 70.941% (-0.04%) from 70.979%
26147248174

Pull #1954

github

web-flow
Merge 76da913e2 into 908c0a771
Pull Request #1954: #1946 spyder commandlet

4442 of 6928 branches covered (64.12%)

Branch coverage included in aggregate %.

11480 of 15516 relevant lines covered (73.99%)

3.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.17
cli/src/main/java/com/devonfw/tools/ide/common/Tag.java
1
package com.devonfw.tools.ide.common;
2

3
import java.util.Collection;
4
import java.util.Collections;
5
import java.util.HashMap;
6
import java.util.HashSet;
7
import java.util.Locale;
8
import java.util.Map;
9
import java.util.Objects;
10
import java.util.Set;
11

12
/**
13
 * A {@link Tag} represents a classifier or category. A tool and plugin can be associated with {@link Tag}s allowing end users to find them.
14
 */
15
public final class Tag {
16

17
  private static final Tag[] NO_TAGS = new Tag[0];
3✔
18

19
  private static final Map<String, Tag> TAG_MAP = new HashMap<>(128);
5✔
20

21
  private static final Collection<Tag> ALL_TAGS = Collections.unmodifiableCollection(TAG_MAP.values());
4✔
22

23
  /** The root {@link Tag}. */
24
  public static final Tag ROOT = new Tag();
4✔
25

26
  static {
27
    TAG_MAP.put(ROOT.id, ROOT);
6✔
28
  }
29

30
  /** {@link #getParent() Parent} for miscellaneous (undefined) tags. */
31
  public static final Tag MISC = create("miscellaneous", ROOT, true, "misc");
6✔
32

33
  /** {@link #getParent() Parent} for programming-languages. */
34
  public static final Tag LANGUAGE = create("language", ROOT, true, "programming");
6✔
35

36
  /** {@link Tag} for JVM (Java Virtual Machine). */
37
  public static final Tag JVM = create("java-virtual-machine", LANGUAGE, false, "jvm");
6✔
38

39
  /** {@link Tag} for Java. */
40
  public static final Tag JAVA = create("java", JVM);
4✔
41

42
  /** {@link Tag} for Go. */
43
  public static final Tag GO = create("go", LANGUAGE);
4✔
44

45
  /** {@link Tag} for Kotlin. */
46
  public static final Tag KOTLIN = create("kotlin", JVM);
4✔
47

48
  /** {@link Tag} for Scala. */
49
  public static final Tag SCALA = create("scala", JVM);
4✔
50

51
  /** {@link Tag} for DotNet (.NET). */
52
  public static final Tag DOTNET = create("dotnet", LANGUAGE, false, "net");
6✔
53

54
  /** {@link Tag} for C#. */
55
  public static final Tag CS = create("c#", DOTNET, false, "cs", "csharp");
15✔
56

57
  /** {@link Tag} for C. */
58
  public static final Tag C = create("c", LANGUAGE);
4✔
59

60
  /** {@link Tag} for Rust. */
61
  public static final Tag RUST = create("rust", LANGUAGE, false, "rs");
6✔
62

63
  /** {@link Tag} for C++. */
64
  public static final Tag CPP = create("c++", LANGUAGE, false, "cpp");
6✔
65

66
  /** {@link Tag} for Python. */
67
  public static final Tag PYTHON = create("python", LANGUAGE);
4✔
68

69
  /** {@link Tag} for Ruby. */
70
  public static final Tag RUBY = create("ruby", LANGUAGE);
4✔
71

72
  /** {@link Tag} for Perl. */
73
  public static final Tag PERL = create("perl", LANGUAGE);
4✔
74

75
  /** {@link Tag} for Shell scripting. */
76
  public static final Tag SHELL = create("shell", JVM, false, "script");
6✔
77

78
  /** {@link Tag} for Bash. */
79
  public static final Tag BASH = create("bash", SHELL, false, "terminal");
6✔
80

81
  /** {@link Tag} for TypeScript. */
82
  public static final Tag JAVA_SCRIPT = create("javascript", LANGUAGE, false, "js");
6✔
83

84
  /** {@link Tag} for TypeScript. */
85
  public static final Tag TYPE_SCRIPT = create("typescript", JAVA_SCRIPT, false, "ts");
6✔
86

87
  /** {@link #getParent() Parent} for programming-languages. */
88
  public static final Tag IDE = create("ide", ROOT);
4✔
89

90
  /** {@link Tag} for Eclipse. */
91
  public static final Tag ECLIPSE = create("eclipse", IDE);
4✔
92

93
  /** {@link Tag} for IDEA (JetBrains IDE Platform). */
94
  public static final Tag IDEA = create("idea", IDE);
4✔
95

96
  /** {@link Tag} for IntelliJ. */
97
  public static final Tag INTELLIJ = create("intellij", IDEA);
4✔
98

99
  /** {@link Tag} for Android-Studio. */
100
  public static final Tag ANDROID_STUDIO = create("android-studio", IDEA);
4✔
101

102
  /** {@link Tag} for Pycharm. */
103
  public static final Tag PYCHARM = create("pycharm", IDEA);
4✔
104

105
  /** {@link Tag} for VS-Code. */
106
  public static final Tag VS_CODE = create("vscode", IDE, false, "visualstudiocode");
6✔
107

108
  public static final Tag SPYDER = create("spyder", IDE);
4✔
109

110
  /** {@link Tag} for (code-)generators (including template-engines, etc.). */
111
  public static final Tag GENERATOR = create("generator", ROOT);
4✔
112

113
  /** {@link #getParent() Parent} for frameworks. */
114
  public static final Tag FRAMEWORK = create("framework", ROOT, true);
5✔
115

116
  /** {@link Tag} for Spring(framework). */
117
  public static final Tag SPRING = create("spring", FRAMEWORK, false, new String[] { "springframework", "springboot" },
21✔
118
      JAVA);
119

120
  /** {@link Tag} for Quarkus. */
121
  public static final Tag QUARKUS = create("quarkus", FRAMEWORK, false, null, JAVA);
12✔
122

123
  /** {@link Tag} for Micronaut. */
124
  public static final Tag MICRONAUT = create("micronaut", FRAMEWORK, false, null, JAVA);
12✔
125

126
  /** {@link Tag} for Angular. */
127
  public static final Tag ANGULAR = create("angular", FRAMEWORK, false, new String[] { "ng", "angularjs" },
21✔
128
      TYPE_SCRIPT);
129

130
  /** {@link Tag} for React. */
131
  public static final Tag REACT = create("react", FRAMEWORK, false, null, TYPE_SCRIPT);
12✔
132

133
  /** {@link Tag} for Vue. */
134
  public static final Tag VUE = create("vue", FRAMEWORK, false, null, TYPE_SCRIPT);
12✔
135

136
  /** {@link Tag} for Cordova. */
137
  public static final Tag CORDOVA = create("cordova", FRAMEWORK, false, null, JAVA_SCRIPT);
12✔
138

139
  /** {@link Tag} for Ionic. */
140
  public static final Tag IONIC = create("ionic", CORDOVA, false);
5✔
141

142
  /** {@link #getParent() Parent} for quality-assurance. */
143
  public static final Tag QA = create("quality-assurance", ROOT, false, "qa", "quality");
15✔
144

145
  /** {@link Tag} for everything related to testing. */
146
  public static final Tag TEST = create("testing", QA, false, "test");
6✔
147

148
  /** {@link Tag} for everything related to testing. */
149
  public static final Tag MOCK = create("mocking", TEST, false, "mock");
6✔
150

151
  /** {@link Tag} for everything related to testing. */
152
  public static final Tag CODE_QA = create("static-code-analysis", QA, false, "codeqa");
6✔
153

154
  /** {@link #getParent() Parent} for linters. */
155
  public static final Tag LINTING = create("linter", QA, false, "lint", "linting");
15✔
156

157
  /** {@link Tag} for everything related to documentation. */
158
  public static final Tag DOCUMENTATION = create("documentation", ROOT, false, "doc");
6✔
159

160
  /** {@link #getParent() Parent} for file formats. */
161
  public static final Tag FORMAT = create("format", ROOT, true);
5✔
162

163
  /** {@link Tag} for JSON. */
164
  public static final Tag JSON = create("json", FORMAT);
4✔
165

166
  /** {@link Tag} for YAML. */
167
  public static final Tag YAML = create("yaml", FORMAT, false, "yml");
6✔
168

169
  /** {@link Tag} for CSS. */
170
  public static final Tag CSS = create("css", FORMAT);
4✔
171

172
  /** {@link Tag} for Properties. */
173
  public static final Tag PROPERTIES = create("properties", FORMAT);
4✔
174

175
  /** {@link Tag} for AsciiDoc. */
176
  public static final Tag ASCII_DOC = create("ascii-doc", FORMAT, false, new String[] { "adoc" }, DOCUMENTATION);
17✔
177

178
  /** {@link Tag} for MarkDown. */
179
  public static final Tag MARK_DOWN = create("markdown", DOCUMENTATION, false, new String[] { "md" }, DOCUMENTATION);
17✔
180

181
  /** {@link Tag} for YAML. */
182
  public static final Tag PDF = create("pdf", FORMAT, false, null, DOCUMENTATION);
12✔
183

184
  /** {@link Tag} for HTML. */
185
  public static final Tag HTML = create("html", FORMAT, false, null, DOCUMENTATION);
12✔
186

187
  /** {@link Tag} for machine-learning. */
188
  public static final Tag MACHINE_LEARNING = create("machine-learning", ROOT, false, "ml");
6✔
189

190
  /** {@link Tag} for artificial-intelligence. */
191
  public static final Tag ARTIFICIAL_INTELLIGENCE = create("artificial-intelligence", MACHINE_LEARNING, false, "ai");
6✔
192

193
  /** {@link Tag} for data-science. */
194
  public static final Tag DATA_SCIENCE = create("data-science", ROOT);
4✔
195

196
  /** {@link Tag} for business-intelligence. */
197
  public static final Tag BUSINESS_INTELLIGENCE = create("business-intelligence", ROOT, false, "bi", "datawarehouse",
19✔
198
      "dwh");
199

200
  /** {@link #Tag} for productivity. */
201
  public static final Tag ARCHITECTURE = create("architecture", ROOT);
4✔
202

203
  /** {@link Tag} for AsciiDoc. */
204
  public static final Tag UML = create("uml", ARCHITECTURE, false, null, DOCUMENTATION);
12✔
205

206
  /** {@link #Tag} for security. */
207
  public static final Tag SECURITY = create("security", ROOT, false, "cve");
6✔
208

209
  /** {@link #Tag} for collaboration. */
210
  public static final Tag COLLABORATION = create("collaboration", ROOT, false, "collab");
6✔
211

212
  /** {@link #Tag} for virtualization. */
213
  public static final Tag VIRTUALIZATION = create("virtualization", ROOT, false, "vm");
6✔
214

215
  /** {@link #Tag} for docker. */
216
  public static final Tag DOCKER = create("docker", VIRTUALIZATION);
4✔
217

218
  /** {@link #Tag} for docker. */
219
  public static final Tag KUBERNETES = create("kubernetes", DOCKER, false, "k8s");
6✔
220

221
  /** {@link #Tag} for WSL. */
222
  public static final Tag WSL = create("wsl", VIRTUALIZATION);
4✔
223

224
  /** {@link Tag} for everything related to databases. */
225
  public static final Tag DB = create("database", ROOT);
4✔
226

227
  /** {@link Tag} for administration tools. */
228
  public static final Tag ADMIN = create("admin", ROOT);
4✔
229

230
  /** {@link #Tag} for network. */
231
  public static final Tag NETWORK = create("network", ROOT, false, "remote");
6✔
232

233
  /** {@link #Tag} for HTTP. */
234
  public static final Tag HTTP = create("http", NETWORK);
4✔
235

236
  /** {@link #Tag} for REST. */
237
  public static final Tag REST = create("rest", HTTP);
4✔
238

239
  /** {@link #Tag} for secure-shell. */
240
  public static final Tag SSH = create("secure-shell", NETWORK, false, "ssh", "scp");
15✔
241

242
  /** {@link #Tag} for capture. */
243
  public static final Tag CAPTURE = create("capture", ROOT, false, "capturing");
6✔
244

245
  /** {@link #Tag} for capture. */
246
  public static final Tag SCREENSHOT = create("screenshot", CAPTURE);
4✔
247

248
  /** {@link #Tag} for capture. */
249
  public static final Tag SCREEN_RECORDING = create("screenrecording", CAPTURE, false, "videocapture");
6✔
250

251
  /** {@link #Tag} for productivity. */
252
  public static final Tag PRODUCTIVITY = create("productivity", ROOT);
4✔
253

254
  /** {@link #Tag} for regular-expression. */
255
  public static final Tag REGEX = create("regular-expression", PRODUCTIVITY, false, "regex", "regexp");
15✔
256

257
  /** {@link #Tag} for search. */
258
  public static final Tag SEARCH = create("search", PRODUCTIVITY, false, "find");
6✔
259

260
  /** {@link #Tag} for spellchecker. */
261
  public static final Tag SPELLCHECKER = create("spellchecker", PRODUCTIVITY, false, "spellcheck", "spellchecking");
15✔
262

263
  /** {@link #Tag} for analyse. */
264
  public static final Tag ANALYSE = create("analyse", ROOT, false, "analyze", "analysis");
15✔
265

266
  /** {@link #Tag} for monitoring. */
267
  public static final Tag MONITORING = create("monitoring", ANALYSE, false, "monitor");
6✔
268

269
  /** {@link #Tag} for formatter. */
270
  public static final Tag FORMATTER = create("formatter", ROOT, false, "codeformat", "codeformatter");
15✔
271

272
  /** {@link #Tag} for user-experience. */
273
  public static final Tag UX = create("user-experience", PRODUCTIVITY, false, "ux");
6✔
274

275
  /** {@link #Tag} for style. */
276
  public static final Tag STYLE = create("style", UX, false, "theme", "icon", "skin");
19✔
277

278
  /** {@link #Tag} for style. */
279
  public static final Tag KEYBINDING = create("keybinding", UX, false, "keybindings", "keymap");
15✔
280

281
  /** {@link #Tag} for draw(ing). */
282
  public static final Tag DRAW = create("draw", UX, false, "diagram", "paint");
15✔
283

284
  /** {@link #Tag} for cloud. */
285
  public static final Tag CLOUD = create("cloud", ROOT);
4✔
286

287
  /** {@link #Tag} for infrastructure-as-code. */
288
  public static final Tag IAC = create("infrastructure-as-code", CLOUD, false, "iac");
6✔
289

290
  /** {@link #Tag} for software-configuration-management. */
291
  public static final Tag CONFIG_MANAGEMENT = create("software-configuration-management", ROOT, false,
15✔
292
      "configmanagement", "configurationmanagement");
293

294
  /** {@link #Tag} for build-management. */
295
  public static final Tag BUILD = create("build-management", CONFIG_MANAGEMENT, false, "build");
6✔
296

297
  /** {@link #Tag} for version-control. */
298
  public static final Tag VCS = create("version-control", CONFIG_MANAGEMENT, false, "vcs", "versioncontrolsystem");
15✔
299

300
  /** {@link #Tag} for issue-management. */
301
  public static final Tag ISSUE = create("issue-management", CONFIG_MANAGEMENT, false, "issue");
6✔
302

303
  /** {@link #Tag} for git. */
304
  public static final Tag GIT = create("git", VCS);
4✔
305

306
  /** {@link #Tag} for github. */
307
  public static final Tag GITHUB = create("github", GIT);
4✔
308

309

310
  /** {@link #Tag} for diff (tools that compare files and determine the difference). */
311
  public static final Tag DIFF = create("diff", CONFIG_MANAGEMENT, false, "patch");
6✔
312

313
  /** {@link #Tag} for diff (tools that compare files and determine the difference). */
314
  public static final Tag RUNTIME = create("runtime", ROOT);
4✔
315

316
  /** {@link #getParent() Parent} for operating-system. */
317
  public static final Tag OS = create("operating-system", ROOT, true, "os");
6✔
318

319
  /** {@link #Tag} for Windows. */
320
  public static final Tag WINDOWS = create("windows", OS);
4✔
321

322
  /** {@link #Tag} for Mac. */
323
  public static final Tag MAC = create("mac", OS, false, "macos", "osx");
15✔
324

325
  /** {@link #Tag} for Linux. */
326
  public static final Tag LINUX = create("linux", OS, false);
5✔
327

328
  /** {@link #getParent() Parent} for cryptography. */
329
  public static final Tag CRYPTO = create("cryptography", ROOT, false, "crypto");
6✔
330

331
  /** {@link #Tag} for encryption. */
332
  public static final Tag ENCRYPTION = create("encryption", CRYPTO);
4✔
333

334
  /** {@link Tag} for Nest. */
335
  public static final Tag NEST = create("nest", FRAMEWORK, false, new String[] { "nestjs", "nestcli" }, TYPE_SCRIPT);
22✔
336

337
  private final String id;
338

339
  private final Tag parent;
340

341
  private final boolean isAbstract;
342

343
  private final Tag[] additionalParents;
344

345
  private Tag() {
2✔
346

347
    this.id = "<root>";
3✔
348
    this.parent = null;
3✔
349
    this.isAbstract = true;
3✔
350
    this.additionalParents = NO_TAGS;
3✔
351
  }
1✔
352

353
  private Tag(String id, Tag parent, boolean isAbstract, Tag... additionalParents) {
354

355
    super();
2✔
356
    Objects.requireNonNull(id);
3✔
357
    Objects.requireNonNull(parent);
3✔
358
    assert (id.toLowerCase(Locale.ROOT).equals(id));
7!
359
    this.id = id;
3✔
360
    this.parent = parent;
3✔
361
    this.isAbstract = isAbstract;
3✔
362
    this.additionalParents = additionalParents;
3✔
363
  }
1✔
364

365
  /**
366
   * @return the identifier and name of this tag.
367
   */
368
  public String getId() {
369

370
    return this.id;
3✔
371
  }
372

373
  /**
374
   * @return the parent {@link Tag} or {@code null} if this is the root tag.
375
   */
376
  public Tag getParent() {
377

378
    return this.parent;
3✔
379
  }
380

381
  /**
382
   * @param i the index of the requested parent. Should be in the range from {@code 0} to
383
   *     <code>{@link #getParentCount()}-1</code>.
384
   * @return the requested {@link Tag}.
385
   */
386
  public Tag getParent(int i) {
387

388
    if (i == 0) {
2✔
389
      return this.parent;
3✔
390
    }
391
    return this.additionalParents[i - 1];
7✔
392
  }
393

394
  /**
395
   * @return the number of {@link #getParent(int) parents} available.
396
   */
397
  public int getParentCount() {
398

399
    if (this.parent == null) {
3✔
400
      return 0;
2✔
401
    }
402
    return this.additionalParents.length + 1;
6✔
403
  }
404

405
  /**
406
   * @return {@code true} if this {@link Tag} is abstract and cannot be selected since it is just a generic parent container, {@code false} otherwise.
407
   */
408
  public boolean isAbstract() {
409

410
    return this.isAbstract;
3✔
411
  }
412

413
  public boolean isAncestorOf(Tag tag) {
414

415
    return isAncestorOf(tag, false);
5✔
416
  }
417

418
  /**
419
   * @param tag the {@link Tag} to check.
420
   * @param includeAdditionalParents - {@code true} if {@link #getParent(int) additional parents} should be included, {@code false} otherwise (only consider
421
   *     {@link #getParent() primary parent}).
422
   * @return {@code true} if the given {@link Tag} is an ancestor of this tag, {@code false} otherwise. An ancestor is a direct or indirect
423
   *     {@link #getParent() parent}. Therefore, if {@link #ROOT} is given as {@link Tag} parameter, this method should always return {@code true}.
424
   */
425
  public boolean isAncestorOf(Tag tag, boolean includeAdditionalParents) {
426

427
    Tag ancestor = this.parent;
3✔
428
    while (ancestor != null) {
2✔
429
      if (ancestor == tag) {
3✔
430
        return true;
2✔
431
      }
432
      ancestor = ancestor.parent;
4✔
433
    }
434
    if (includeAdditionalParents) {
2✔
435
      for (Tag p : this.additionalParents) {
17✔
436
        do {
437
          if (p == tag) {
3✔
438
            return true;
2✔
439
          }
440
          p = p.parent;
3✔
441
        } while (p != null);
2✔
442
      }
443
    }
444
    return false;
2✔
445
  }
446

447
  @Override
448
  public String toString() {
449

450
    return this.id;
3✔
451
  }
452

453
  /**
454
   * @param id the {@link #getId() ID} of the tag.
455
   * @param parent the {@link #getParent() parent tag}.
456
   * @return the new {@link Tag}.
457
   */
458
  static Tag create(String id, Tag parent) {
459

460
    return create(id, parent, false);
5✔
461
  }
462

463
  /**
464
   * @param id the {@link #getId() ID} of the tag.
465
   * @param parent the {@link #getParent() parent tag}.
466
   * @param isAbstract the {@link #isAbstract() abstract flag}.
467
   * @return the new {@link Tag}.
468
   */
469
  static Tag create(String id, Tag parent, boolean isAbstract) {
470

471
    return create(id, parent, isAbstract, null, NO_TAGS);
7✔
472
  }
473

474
  /**
475
   * @param id the {@link #getId() ID} of the tag.
476
   * @param parent the {@link #getParent() parent tag}.
477
   * @param isAbstract the {@link #isAbstract() abstract flag}.
478
   * @return the new {@link Tag}.
479
   */
480
  static Tag create(String id, Tag parent, boolean isAbstract, String synonym) {
481

482
    return create(id, parent, isAbstract, new String[] { synonym }, NO_TAGS);
12✔
483
  }
484

485
  /**
486
   * @param id the {@link #getId() ID} of the tag.
487
   * @param parent the {@link #getParent() parent tag}.
488
   * @param isAbstract the {@link #isAbstract() abstract flag}.
489
   * @return the new {@link Tag}.
490
   */
491
  static Tag create(String id, Tag parent, boolean isAbstract, String... synonyms) {
492

493
    return create(id, parent, isAbstract, synonyms, NO_TAGS);
7✔
494
  }
495

496
  /**
497
   * @param id the {@link #getId() ID} of the tag.
498
   * @param parent the {@link #getParent() parent tag}.
499
   * @param isAbstract the {@link #isAbstract() abstract flag}.
500
   * @return the new {@link Tag}.
501
   */
502
  static Tag create(String id, Tag parent, boolean isAbstract, String[] synonyms, Tag... additionalParents) {
503

504
    Tag tag = new Tag(id, parent, isAbstract, additionalParents);
8✔
505
    add(id, tag);
3✔
506
    if (synonyms != null) {
2✔
507
      for (String synonym : synonyms) {
16✔
508
        add(synonym, tag);
3✔
509
      }
510
    }
511
    return tag;
2✔
512
  }
513

514
  private static void add(String key, Tag tag) {
515

516
    Tag duplicate = TAG_MAP.put(normalizeKey(key), tag);
7✔
517
    if (duplicate != null) {
2✔
518
      throw new IllegalStateException("Duplicate tag for " + key);
6✔
519
    }
520
  }
1✔
521

522
  private static String normalizeKey(String key) {
523

524
    return key.replace("-", "").replace(".", "");
8✔
525
  }
526

527
  private static Tag require(String key) {
528

529
    Tag tag = TAG_MAP.get(normalizeKey(key));
6✔
530
    if (tag == null) {
2!
531
      throw new IllegalStateException("Could not find required tag " + key);
×
532
    }
533
    return tag;
2✔
534
  }
535

536
  /**
537
   * @param id the {@link #getId() ID} of the requested {@link Tag}.
538
   * @return the {@link Tag} with the given {@link #getId() ID}. Will be lazily created as child of {@link #MISC} if not already exists.
539
   */
540
  public static Tag of(String id) {
541

542
    final String tagId = id.trim();
3✔
543
    int slash = tagId.indexOf('/');
4✔
544
    if (slash >= 0) {
2✔
545
      String parentId = tagId.substring(0, slash);
5✔
546
      Tag parent = require(parentId);
3✔
547
      String childId = tagId.substring(slash + 1);
6✔
548
      return TAG_MAP.computeIfAbsent(normalizeKey(childId), i -> new Tag(childId, parent, false, NO_TAGS));
17✔
549
    }
550
    return TAG_MAP.computeIfAbsent(normalizeKey(tagId), i -> new Tag(tagId, MISC, false, NO_TAGS));
16✔
551
  }
552

553
  /**
554
   * @return the {@link Collections} of all available {@link Tag}s.
555
   */
556
  public static Collection<Tag> getAll() {
557

558
    return ALL_TAGS;
2✔
559
  }
560

561
  /**
562
   * @param tagsCsv the tags as {@link String} in CSV format («first-tag»,...,«last-tag»). May be {@code null} or empty.
563
   * @return the parsed {@link Set} of {@link Tag}s.
564
   */
565
  public static Set<Tag> parseCsv(String tagsCsv) {
566

567
    if (tagsCsv == null) {
2✔
568
      return Collections.emptySet();
2✔
569
    }
570
    tagsCsv = tagsCsv.trim().toLowerCase(Locale.ROOT);
5✔
571
    if (tagsCsv.isEmpty()) {
3✔
572
      return Collections.emptySet();
2✔
573
    }
574
    String[] tagArray = tagsCsv.split(",");
4✔
575
    Set<Tag> tags = new HashSet<>(tagArray.length);
6✔
576
    for (String tag : tagArray) {
16✔
577
      tags.add(of(tag));
5✔
578
    }
579
    assert (tags.size() == tagArray.length);
6!
580
    return Set.of(tags.toArray(new Tag[tags.size()]));
8✔
581
  }
582

583
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc