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

Camelcade / Perl5-IDEA / #525521516

19 Apr 2025 04:38PM UTC coverage: 82.156% (-0.02%) from 82.177%
#525521516

push

github

hurricup
[Sonarcube] Work around SonarScanner crash due to outdated commons-compress in JetBrains Gradle plugin

SonarScanner fails at runtime with NoSuchMethodError on TarArchiveInputStream#getNextEntry(),
because JetBrains' intellij-platform-gradle-plugin 2.5.0 bundles an old version of
commons-compress (likely 1.20) that lacks the expected method signature.

Gradle loads classes from this plugin before resolving buildscript dependencies, so
declaring the correct version in buildscript dependencies has no effect.

To work around this, we created a local Gradle plugin (`com.hurricup.gradle.fixcompress`)
in `buildSrc` that depends on the correct version of commons-compress (1.27.1). By
ensuring this plugin is applied early, we force Gradle to load the correct class version first.

This hack avoids patching JetBrains' plugin jar and makes the build succeed both locally
and on CI, without publishing anything to Maven.

30806 of 37497 relevant lines covered (82.16%)

0.82 hits per line

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

85.0
/mason/mason2/core/src/main/java/com/perl5/lang/mason2/elementType/MasonNamespaceElementType.java
1
/*
2
 * Copyright 2015-2023 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.mason2.elementType;
18

19
import com.intellij.lang.ASTNode;
20
import com.intellij.openapi.util.text.StringUtil;
21
import com.intellij.psi.PsiElement;
22
import com.intellij.psi.stubs.IndexSink;
23
import com.intellij.psi.stubs.StubElement;
24
import com.perl5.lang.mason2.Mason2Language;
25
import com.perl5.lang.mason2.Mason2Util;
26
import com.perl5.lang.mason2.psi.MasonNamespaceDefinition;
27
import com.perl5.lang.mason2.psi.impl.MasonNamespaceDefinitionImpl;
28
import com.perl5.lang.mason2.psi.stubs.MasonNamespaceDefitnitionsStubIndex;
29
import com.perl5.lang.mason2.psi.stubs.MasonParentNamespacesStubIndex;
30
import com.perl5.lang.perl.parser.elementTypes.PsiElementProvider;
31
import com.perl5.lang.perl.psi.PerlNamespaceDefinitionElement;
32
import com.perl5.lang.perl.psi.stubs.namespaces.PerlNamespaceDefinitionData;
33
import com.perl5.lang.perl.psi.stubs.namespaces.PerlNamespaceDefinitionElementType;
34
import com.perl5.lang.perl.psi.stubs.namespaces.PerlNamespaceDefinitionStub;
35
import org.jetbrains.annotations.NotNull;
36

37
import static com.perl5.lang.perl.psi.stubs.namespaces.PerlNamespaceIndex.NAMESPACE_KEY;
38

39

40
public class MasonNamespaceElementType extends PerlNamespaceDefinitionElementType implements PsiElementProvider {
1✔
41
  public MasonNamespaceElementType(String name) {
42
    super(name, Mason2Language.INSTANCE);
1✔
43
  }
1✔
44

45
  @Override
46
  public PerlNamespaceDefinitionElement createPsi(@NotNull PerlNamespaceDefinitionStub stub) {
47
    return new MasonNamespaceDefinitionImpl(stub, this);
1✔
48
  }
49

50
  @Override
51
  public @NotNull PerlNamespaceDefinitionStub createStub(@NotNull PerlNamespaceDefinitionElement psi, StubElement parentStub) {
52
    assert psi instanceof MasonNamespaceDefinitionImpl;
1✔
53
    return new PerlNamespaceDefinitionStub(parentStub, this, new PerlNamespaceDefinitionData(
1✔
54
      StringUtil.notNullize(((MasonNamespaceDefinitionImpl)psi).getAbsoluteComponentPath()), psi));
1✔
55
  }
56

57
  @Override
58
  public void indexStub(@NotNull PerlNamespaceDefinitionStub stub, @NotNull IndexSink sink) {
59
    String name = stub.getNamespaceName();
1✔
60
    sink.occurrence(MasonNamespaceDefitnitionsStubIndex.KEY, name);
1✔
61

62
    // fixme this is kinda hack to make MRO work. But, it should be smarter
63
    sink.occurrence(NAMESPACE_KEY, Mason2Util.getClassnameFromPath(name));
1✔
64

65
    for (String parent : stub.getParentNamespacesNames()) {
1✔
66
      if (parent != null && !parent.isEmpty()) {
×
67
        sink.occurrence(MasonParentNamespacesStubIndex.KEY, parent);
×
68
      }
69
    }
×
70
  }
1✔
71

72
  @Override
73
  public boolean shouldCreateStub(ASTNode node) {
74
    PsiElement psi = node.getPsi();
1✔
75
    return psi instanceof MasonNamespaceDefinition &&
1✔
76
           psi.isValid() &&
1✔
77
           StringUtil.isNotEmpty(((MasonNamespaceDefinition)psi).getAbsoluteComponentPath());
1✔
78
  }
79

80
  @Override
81
  public @NotNull PsiElement getPsiElement(@NotNull ASTNode node) {
82
    return new MasonNamespaceDefinitionImpl(node);
1✔
83
  }
84
}
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