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

Camelcade / Perl5-IDEA / #525521714

21 Nov 2025 08:47AM UTC coverage: 75.925% (-0.003%) from 75.928%
#525521714

push

github

hurricup
Bump org.sonarqube from 7.0.1.6134 to 7.1.0.6387

Bumps org.sonarqube from 7.0.1.6134 to 7.1.0.6387.

---
updated-dependencies:
- dependency-name: org.sonarqube
  dependency-version: 7.1.0.6387
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

14753 of 22633 branches covered (65.18%)

Branch coverage included in aggregate %.

31070 of 37720 relevant lines covered (82.37%)

0.82 hits per line

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

59.57
/plugin/common/src/main/java/com/perl5/lang/perl/util/PerlPluginUtil.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.util;
18

19
import com.intellij.ide.plugins.IdeaPluginDescriptor;
20
import com.intellij.ide.plugins.PluginManagerCore;
21
import com.intellij.openapi.Disposable;
22
import com.intellij.openapi.application.PathManager;
23
import com.intellij.openapi.extensions.PluginId;
24
import com.intellij.openapi.project.Project;
25
import com.intellij.openapi.util.io.FileUtil;
26
import com.perl5.lang.perl.fileTypes.PerlFileTypeService;
27
import com.perl5.lang.perl.idea.project.PerlNamesCache;
28
import org.jetbrains.annotations.NotNull;
29

30
import java.io.File;
31
import java.io.IOException;
32
import java.util.Objects;
33

34

35
public class PerlPluginUtil {
×
36
  public static final String PLUGIN_ID = "com.perl5";
37
  private static final String PERL_DIR = "perl5";
38
  private static final String REMOTES_DIR = "remote";
39

40
  public static @NotNull IdeaPluginDescriptor getPlugin() {
41
    return Objects.requireNonNull(PluginManagerCore.getPlugin(PluginId.getId(PLUGIN_ID)));
1!
42
  }
43

44
  /**
45
   * @return disposable for the plugin. Need to be replaced with proper plugin disposable later
46
   */
47
  public static @NotNull Disposable getUnloadAwareDisposable() {
48
    return PerlFileTypeService.getInstance();
1!
49
  }
50

51
  /**
52
   * @return project-level disposable for a plugin. It's eol happens on project service unloading what may
53
   * happen when project is closed or plugin unloaded.
54
   */
55
  public static @NotNull PerlNamesCache getUnloadAwareDisposable(@NotNull Project project) {
56
    return PerlNamesCache.getInstance(project);
1!
57
  }
58

59
  /**
60
   * @return true iff plugin is no longer available in the context of {@code project}
61
   */
62
  public static boolean isUnloaded(@NotNull Project project) {
63
    if (project.isDisposed()) {
1!
64
      return true;
1✔
65
    }
66
    var service = project.getServiceIfCreated(PerlNamesCache.class);
×
67
    return service == null || service.isDisposed();
×
68
  }
69

70
  public static @NotNull String getPluginVersion() {
71
    return Objects.requireNonNull(getPlugin().getVersion());
1!
72
  }
73

74
  public static @NotNull String getPluginRoot() {
75
    IdeaPluginDescriptor plugin = PerlPluginUtil.getPlugin();
1✔
76
    try {
77
      return FileUtil.toSystemIndependentName(plugin.getPluginPath().toFile().getCanonicalPath());
1!
78
    }
79
    catch (IOException e) {
×
80
      throw new RuntimeException(e);
×
81
    }
82
  }
83

84
  /**
85
   * @return path to IDE perl helper scripts
86
   */
87
  public static @NotNull String getPluginHelpersRoot() {
88
    return FileUtil.toSystemIndependentName(new File(getPluginRoot(), "perl").getPath());
1!
89
  }
90

91
  /**
92
   * @return path to the helpers libs dir
93
   */
94
  public static @NotNull String getHelpersLibPath() {
95
    return getHelperPath("lib");
1✔
96
  }
97

98
  /**
99
   * @return path to a helper with {@code relativePath}
100
   */
101
  public static @NotNull String getHelperPath(@NotNull String relativePath) {
102
    return FileUtil.toSystemIndependentName(new File(getPluginHelpersRoot(), relativePath).getPath());
1!
103
  }
104

105
  /**
106
   * @return perl5 dir in the ide's {@code system} dir
107
   */
108
  public static @NotNull String getPerlSystemPath() {
109
    String systemPath = PathManager.getSystemPath();
1✔
110
    String perlDirectory = FileUtil.join(systemPath, PERL_DIR);
1✔
111
    FileUtil.createDirectory(new File(perlDirectory));
1✔
112
    return perlDirectory;
1!
113
  }
114

115
  /**
116
   * @return root for remote filesystems cache
117
   */
118
  public static @NotNull String getRemotesCachePath() {
119
    String remotesCachePath = FileUtil.join(getPerlSystemPath(), REMOTES_DIR);
1✔
120
    FileUtil.createDirectory(new File(remotesCachePath));
1✔
121
    return remotesCachePath;
1!
122
  }
123
}
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