• 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

32.0
/mason/mason2/core/src/main/java/com/perl5/lang/mason2/psi/impl/MasonFlagsStatementImpl.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.psi.impl;
18

19
import com.intellij.lang.ASTNode;
20
import com.intellij.openapi.util.text.StringUtil;
21
import com.intellij.psi.ElementManipulators;
22
import com.intellij.psi.PsiElement;
23
import com.intellij.psi.tree.IElementType;
24
import com.perl5.lang.mason2.psi.MasonFlagsStatement;
25
import com.perl5.lang.perl.psi.PsiPerlCommaSequenceExpr;
26
import com.perl5.lang.perl.psi.impl.PsiPerlStatementImpl;
27
import com.perl5.lang.perl.psi.utils.PerlPsiUtil;
28
import org.jetbrains.annotations.Contract;
29
import org.jetbrains.annotations.NotNull;
30
import org.jetbrains.annotations.Nullable;
31

32
import java.util.List;
33

34
import static com.perl5.lang.perl.parser.PerlElementTypesGenerated.COMMA;
35
import static com.perl5.lang.perl.parser.PerlElementTypesGenerated.FAT_COMMA;
36

37

38
public class MasonFlagsStatementImpl extends PsiPerlStatementImpl implements MasonFlagsStatement {
39
  public MasonFlagsStatementImpl(ASTNode node) {
40
    super(node);
1✔
41
  }
1✔
42

43
  @Override
44
  public void changeParentsList(@NotNull List<? super String> currentList) {
45
    String extendsFlagsValue = getExtendsFlagValue();
1✔
46
    if (extendsFlagsValue != null) {
1✔
47
      currentList.add(extendsFlagsValue);
×
48
    }
49
  }
1✔
50

51

52
  private @Nullable String getExtendsFlagValue() {
53
    PsiElement expr = getExpr();
1✔
54
    // fixme this can be a prototype for scanning a hash to map
55
    if (expr instanceof PsiPerlCommaSequenceExpr) {
1✔
56
      PsiElement currentElement = expr.getFirstChild();
×
57
      while (currentElement != null) {
×
58
        PsiElement keyElement = currentElement;
×
59

60
        // comma between key and val
61
        if (isNullOrNotComma(currentElement = PerlPsiUtil.getNextSignificantSibling(currentElement))) {
×
62
          break;
×
63
        }
64

65
        PsiElement valElement = PerlPsiUtil.getNextSignificantSibling(currentElement);
×
66

67
        if (valElement != null && StringUtil.equals("extends", ElementManipulators.getValueText(keyElement))) {
×
68
          return ElementManipulators.getValueText(valElement);
×
69
        }
70

71
        // comma between pairs
72
        if (isNullOrNotComma(currentElement = PerlPsiUtil.getNextSignificantSibling(currentElement))) {
×
73
          break;
×
74
        }
75

76
        currentElement = PerlPsiUtil.getNextSignificantSibling(currentElement);
×
77
      }
×
78
    }
79

80
    return null;
1✔
81
  }
82

83
  @Contract("null -> true")
84
  private boolean isNullOrNotComma(@Nullable PsiElement element) {
85
    if (element == null) {
×
86
      return true;
×
87
    }
88

89
    IElementType elementType = element.getNode().getElementType();
×
90
    return elementType != COMMA && elementType != FAT_COMMA;
×
91
  }
92
}
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