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

Camelcade / Perl5-IDEA / #525521660

24 Aug 2025 01:28PM UTC coverage: 75.89% (-6.3%) from 82.227%
#525521660

push

github

hurricup
Migrated coverage reporting to https://github.com/nbaztec/coveralls-jacoco-gradle-plugin

See: https://github.com/kt3k/coveralls-gradle-plugin/issues/119

14751 of 22639 branches covered (65.16%)

Branch coverage included in aggregate %.

31091 of 37767 relevant lines covered (82.32%)

0.82 hits per line

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

68.09
/plugin/common/src/main/java/com/perl5/lang/perl/parser/elementTypes/PerlNamespaceNameTokenType.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.perl.parser.elementTypes;
18

19
import com.intellij.lang.ASTNode;
20
import com.intellij.openapi.util.TextRange;
21
import com.intellij.psi.impl.source.tree.TreeUtil;
22
import com.intellij.psi.tree.IElementType;
23
import com.intellij.psi.tree.TokenSet;
24
import com.intellij.psi.util.PsiUtilCore;
25
import org.jetbrains.annotations.NotNull;
26

27
import static com.perl5.lang.perl.parser.PerlElementTypesGenerated.*;
28
import static com.perl5.lang.perl.psi.stubs.PerlStubElementTypes.NO_STATEMENT;
29
import static com.perl5.lang.perl.psi.stubs.PerlStubElementTypes.USE_STATEMENT;
30

31
public class PerlNamespaceNameTokenType extends PerlReparseableTokenType {
32
  private static final TokenSet SUFFICIENT_CONTAINERS = TokenSet.create(
1✔
33
    NAMESPACE_DEFINITION,
34
    VARIABLE_DECLARATION_LEXICAL,
35
    VARIABLE_DECLARATION_GLOBAL,
36
    ANNOTATION_RETURNS,
37
    ANNOTATION_TYPE,
38
    USE_STATEMENT,
39
    NO_STATEMENT,
40
    REQUIRE_EXPR,
41
    PACKAGE_EXPR
42
  );
43

44
  public PerlNamespaceNameTokenType(@NotNull String debugName) {
45
    super(debugName);
1✔
46
  }
1✔
47

48
  @Override
49
  protected @NotNull TextRange getLexerConfirmationRange(@NotNull ASTNode leaf) {
50
    ASTNode parent = leaf.getTreeParent();
1✔
51
    IElementType parentType = PsiUtilCore.getElementType(parent);
1✔
52
    if (parentType == SUB_DEFINITION || parentType == SUB_DECLARATION) {
1✔
53
      ASTNode nextLeaf = TreeUtil.nextLeaf(leaf);
1✔
54
      int endOffset = nextLeaf == null ? leaf.getTextRange().getEndOffset() :
1!
55
                      nextLeaf.getTextRange().getEndOffset();
1✔
56
      return TextRange.create(parent.getStartOffset(), endOffset);
1!
57
    }
58
    if (SUFFICIENT_CONTAINERS.contains(parentType)) {
1✔
59
      return TextRange.create(parent.getStartOffset(), leaf.getTextRange().getEndOffset());
1!
60
    }
61
    if (parentType == METHOD) {
1!
62
      ASTNode callElement = parent.getTreeParent();
1✔
63
      IElementType callType = PsiUtilCore.getElementType(callElement);
1✔
64
      if (callType == SUB_CALL || callType == CODE_VARIABLE) {
1!
65
        ASTNode derefExpr = callElement.getTreeParent();
1✔
66
        if (PsiUtilCore.getElementType(derefExpr) == DEREF_EXPR) {
1!
67
          return TextRange.create(derefExpr.getStartOffset(), callElement.getTextRange().getEndOffset());
×
68
        }
69
        return TextRange.create(callElement.getStartOffset(), callElement.getTextRange().getEndOffset());
1!
70
      }
71
    }
72
    return TextRange.EMPTY_RANGE;
×
73
  }
74
}
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