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

Camelcade / Perl5-IDEA / #525521547

24 May 2025 10:39AM UTC coverage: 82.232% (-0.09%) from 82.324%
#525521547

push

github

hurricup
Got rid of ContainerUtil.immutableList usages

4 of 4 new or added lines in 3 files covered. (100.0%)

52 existing lines in 15 files now uncovered.

30870 of 37540 relevant lines covered (82.23%)

0.82 hits per line

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

0.0
/plugin/core/src/main/java/com/perl5/lang/perl/idea/refactoring/PerlRefactoringSupportProvider.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.idea.refactoring;
18

19
import com.intellij.lang.refactoring.RefactoringSupportProvider;
20
import com.intellij.psi.PsiElement;
21
import com.intellij.psi.PsiFile;
22
import com.intellij.psi.PsiNameIdentifierOwner;
23
import com.intellij.psi.search.LocalSearchScope;
24
import com.intellij.psi.search.SearchScope;
25
import com.intellij.refactoring.RefactoringActionHandler;
26
import com.perl5.lang.perl.PerlLanguage;
27
import com.perl5.lang.perl.extensions.PerlRenameUsagesHelper;
28
import com.perl5.lang.perl.idea.refactoring.introduce.PerlIntroduceVariableHandler;
29
import com.perl5.lang.perl.parser.Exception.Class.ide.refactoring.PerlRenamingVetoCondition;
30
import com.perl5.lang.perl.psi.PerlNamespaceDefinition;
31
import com.perl5.lang.perl.psi.PerlNamespaceElement;
32
import com.perl5.lang.perl.psi.PerlStringContentElement;
33
import org.jetbrains.annotations.NotNull;
34
import org.jetbrains.annotations.Nullable;
35

36
/**
37
 * This class is responsible for controlling refactoring process
38
 */
39
public class PerlRefactoringSupportProvider extends RefactoringSupportProvider {
×
40
  // todo RenameInputValidator
41
  @Override
42
  public boolean isInplaceRenameAvailable(@NotNull PsiElement element, PsiElement context) {
43
    SearchScope useScope = element.getUseScope();
×
44
    return useScope instanceof LocalSearchScope localSearchScope
×
UNCOV
45
           && element instanceof PsiNameIdentifierOwner identifierOwner
×
46
           && !(element instanceof PerlRenameUsagesHelper)
47
           && isInplaceAllowed(element, context)
×
48
           && !(identifierOwner.getNameIdentifier() instanceof PerlStringContentElement)
×
49
           && element.getContainingFile().getLanguage() == PerlLanguage.INSTANCE
×
50
           && !(localSearchScope.getScope()[0] instanceof PsiFile)
×
51
      ;
52
  }
53

54
  public boolean isPerlInplaceRenameAvailable(@NotNull PsiElement element, PsiElement context) {
55
    if (!isInplaceAllowed(element, context)) {
×
56
      return false;
×
57
    }
58
    else if (element instanceof PerlRenameUsagesHelper renameUsagesHelper) {
×
59
      return renameUsagesHelper.isInplaceRefactoringAllowed();
×
60
    }
61
    return true;
×
62
  }
63

64
  /**
65
   * Common logic for any inplace, platform or ours
66
   */
67
  private static boolean isInplaceAllowed(@NotNull PsiElement element, PsiElement context) {
68
    if (PerlRenamingVetoCondition.isVetoed(element)) {
×
69
      return false;
×
70
    }
71
    else {
72
      return !(element instanceof PerlNamespaceDefinition) ||
×
73
             !(context instanceof PerlNamespaceElement perlNamespaceElement) ||
×
74
             !perlNamespaceElement.isTag();
×
75
    }
76
  }
77

78
  @Override
79
  public boolean isMemberInplaceRenameAvailable(@NotNull PsiElement element, PsiElement context) {
80
    return false;
×
81
  }
82

83
  @Override
84
  public @Nullable RefactoringActionHandler getIntroduceVariableHandler() {
85
    return new PerlIntroduceVariableHandler();
×
86
  }
87
}
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