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

ljacqu / wordeval / 14573369468

21 Apr 2025 12:20PM UTC coverage: 58.038% (+2.9%) from 55.116%
14573369468

push

github

ljacqu
Create Hunspell aff parser (work in progress)

310 of 613 branches covered (50.57%)

96 of 98 new or added lines in 10 files covered. (97.96%)

834 of 1437 relevant lines covered (58.04%)

3.35 hits per line

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

88.89
/src/main/java/ch/jalu/wordeval/dictionary/hunspell/condition/RegexCondition.java
1
package ch.jalu.wordeval.dictionary.hunspell.condition;
2

3
import ch.jalu.wordeval.dictionary.hunspell.AffixType;
4
import lombok.ToString;
5

6
import java.util.regex.Pattern;
7

8
/**
9
 * Affix condition for a regexp pattern.
10
 */
11
@ToString
12
public class RegexCondition implements AffixCondition {
13

14
  private final Pattern pattern;
15

16
  public RegexCondition(String pattern, AffixType affixType) {
2✔
17
    this.pattern = compilePattern(pattern, affixType);
5✔
18
  }
1✔
19

20
  @Override
21
  public boolean matches(String word) {
22
    return pattern.matcher(word).find();
6✔
23
  }
24

25
  private static Pattern compilePattern(String pattern, AffixType affixType) {
26
    String adjustedPattern;
27
    switch (affixType) {
5!
28
      case PFX -> adjustedPattern = "^" + pattern;
4✔
29
      case SFX -> adjustedPattern = pattern + "$";
4✔
NEW
30
      default -> throw new IllegalStateException("Unexpected value: " + affixType);
×
31
    }
32
    return Pattern.compile(adjustedPattern);
3✔
33
  }
34
}
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