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

Camelcade / Perl5-IDEA / #525521578

05 Jun 2025 08:31AM UTC coverage: 82.354% (+0.06%) from 82.298%
#525521578

push

github

hurricup
Redundant throws

30858 of 37470 relevant lines covered (82.35%)

0.82 hits per line

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

93.75
/plugin/core/src/main/java/com/perl5/lang/pod/parser/PodParserUtil.java
1
/*
2
 * Copyright 2015-2025 Alexandr Evstigneev
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.perl5.lang.pod.parser;
18

19
import com.intellij.lang.PsiBuilder;
20
import com.intellij.lang.parser.GeneratedParserUtilBase;
21
import com.intellij.openapi.util.NlsContexts.ParsingError;
22
import com.intellij.psi.tree.IElementType;
23
import com.perl5.lang.pod.lexer.PodElementTypes;
24
import com.perl5.lang.pod.lexer.PodTokenSetsEx;
25
import org.jetbrains.annotations.NotNull;
26

27

28
public class PodParserUtil extends GeneratedParserUtilBase implements PodElementTypes {
×
29
  @SuppressWarnings({"StaticMethodOnlyUsedInOneClass", "SameReturnValue"})
30
  public static boolean completeOrReport(@NotNull PsiBuilder b,
31
                                         int ignoredL,
32
                                         @NotNull IElementType targetElement,
33
                                         @NotNull @ParsingError String message) {
34
    if (b.getTokenType() == targetElement) {
1✔
35
      b.advanceLexer();
1✔
36
      return true;
1✔
37
    }
38
    PsiBuilder.Marker marker = b.mark();
1✔
39
    while (!b.eof() && b.getTokenType() != targetElement && b.getTokenType() != POD_NEWLINE) {
1✔
40
      b.advanceLexer();
×
41
    }
42
    marker.error(message);
1✔
43
    b.advanceLexer();
1✔
44
    return true;
1✔
45
  }
46

47
  @SuppressWarnings({"UnusedReturnValue", "StaticMethodOnlyUsedInOneClass"})
48
  public static boolean checkAndConvert(@NotNull PsiBuilder b,
49
                                        int ignoredL,
50
                                        @NotNull IElementType sourceType,
51
                                        @NotNull IElementType ignoredTargetType) {
52
    if (b.getTokenType() == sourceType) {
1✔
53
      PsiBuilder.Marker m = b.mark();
1✔
54
      b.advanceLexer();
1✔
55
      m.collapse(POD_INDENT_LEVEL);
1✔
56
      return true;
1✔
57
    }
58
    return false;
1✔
59
  }
60

61

62
  @SuppressWarnings("StaticMethodOnlyUsedInOneClass")
63
  public static boolean collapseNonSpaceTo(@NotNull PsiBuilder b, int ignoredL, @NotNull IElementType targetElement) {
64
    IElementType tokenType = b.getTokenType();
1✔
65

66
    if (tokenType == POD_IDENTIFIER) {
1✔
67
      PsiBuilder.Marker m = b.mark();
1✔
68
      while (!b.eof() && !PodTokenSetsEx.ALL_WHITE_SPACES.contains(b.rawLookup(1))) {
1✔
69
        b.advanceLexer();
1✔
70
      }
71
      b.advanceLexer();
1✔
72
      m.collapse(targetElement);
1✔
73
      return true;
1✔
74
    }
75
    return false;
1✔
76
  }
77

78
  @SuppressWarnings({"StaticMethodOnlyUsedInOneClass", "SameReturnValue"})
79
  public static boolean parsePodSectionContent(@NotNull PsiBuilder b,
80
                                               int ignoredL,
81
                                               @NotNull IElementType stopToken,
82
                                               @NotNull IElementType targetToken,
83
                                               @ParsingError String errorMessage) {
84
    PsiBuilder.Marker m = b.mark();
1✔
85
    while (!b.eof() && b.getTokenType() != stopToken) {
1✔
86
      b.advanceLexer();
1✔
87
    }
88

89
    m.done(targetToken);
1✔
90

91
    if (b.eof()) {
1✔
92
      b.mark().error(errorMessage);
1✔
93
    }
94

95
    return true;
1✔
96
  }
97
}
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