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

Camelcade / Perl5-IDEA / #525521819

12 Apr 2026 11:03AM UTC coverage: 76.189% (+0.1%) from 76.061%
#525521819

push

github

hurricup
[qodana] Suppressed a warning on the api method

14764 of 22542 branches covered (65.5%)

Branch coverage included in aggregate %.

31091 of 37644 relevant lines covered (82.59%)

0.83 hits per line

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

75.76
/plugin/debugger/src/main/java/com/perl5/lang/perl/debugger/protocol/PerlLayerDescriptor.java
1
/*
2
 * Copyright 2015-2026 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.debugger.protocol;
18

19
import com.intellij.openapi.util.text.StringUtil;
20
import org.jetbrains.annotations.NotNull;
21
import org.jetbrains.annotations.Nullable;
22

23
import java.util.ArrayList;
24
import java.util.LinkedHashMap;
25
import java.util.List;
26
import java.util.Map;
27

28
public class PerlLayerDescriptor {
1✔
29
  private static final Map<Integer, String> FLAGS_MAP = new LinkedHashMap<>();
1✔
30
  private static final int UTF_FLAG = 0x00008000;
31

32
  static {
33
    FLAGS_MAP.put(0x00000100, "EOF");
1✔
34
    FLAGS_MAP.put(0x00000200, "CANWRITE");
1✔
35
    FLAGS_MAP.put(0x00000400, "CANREAD");
1✔
36
    FLAGS_MAP.put(0x00000800, "ERROR");
1✔
37
    FLAGS_MAP.put(0x00001000, "TRUNCATE");
1✔
38
    FLAGS_MAP.put(0x00002000, "APPEND");
1✔
39
    FLAGS_MAP.put(0x00004000, "CRLF");
1✔
40
    FLAGS_MAP.put(UTF_FLAG, "UTF8");
1✔
41
    FLAGS_MAP.put(0x00010000, "UNBUF");
1✔
42
    FLAGS_MAP.put(0x00020000, "WRBUF");
1✔
43
    FLAGS_MAP.put(0x00040000, "RDBUF");
1✔
44
    FLAGS_MAP.put(0x00080000, "LINEBUF");
1✔
45
    FLAGS_MAP.put(0x00100000, "TEMP");
1✔
46
    FLAGS_MAP.put(0x00200000, "OPEN");
1✔
47
    FLAGS_MAP.put(0x00400000, "FASTGETS");
1✔
48
    FLAGS_MAP.put(0x00800000, "TTY");
1✔
49
    FLAGS_MAP.put(0x01000000, "NOTREG");
1✔
50
    FLAGS_MAP.put(0x02000000, "CLEARED");
1✔
51
  }
1✔
52

53

54
  @SuppressWarnings("unused") private @Nullable String name;
55
  @SuppressWarnings("unused") private @Nullable String param;
56
  @SuppressWarnings("unused") private @Nullable String flags;
57

58
  public @NotNull String getName() {
59
    return name == null ? "UNKNOWN" : name;
1!
60
  }
61

62
  @SuppressWarnings("unused")
63
  public @Nullable String getParam() {
64
    return param;
×
65
  }
66

67
  @SuppressWarnings("unused")
68
  public @Nullable String getFlags() {
69
    return flags;
×
70
  }
71

72
  public @Nullable String getPresentableFlags() {
73
    if (flags == null) {
1!
74
      return null;
×
75
    }
76
    StringBuilder sb = new StringBuilder();
1✔
77
    int flagValue = getIntFlag();
1✔
78
    sb.append("0x").append(Integer.toHexString(flagValue)).append(":");
1✔
79

80
    List<String> flagNames = new ArrayList<>();
1✔
81
    for (Map.Entry<Integer, String> entry : FLAGS_MAP.entrySet()) {
1✔
82
      if ((flagValue & entry.getKey()) != 0) {
1✔
83
        flagNames.add(entry.getValue());
1✔
84
      }
85
    }
1✔
86
    sb.append(StringUtil.join(flagNames, ","));
1✔
87

88
    return sb.toString();
1✔
89
  }
90

91
  private int getIntFlag() {
92
    if (flags == null) {
1!
93
      return 0;
×
94
    }
95
    try {
96
      return Integer.parseInt(flags);
1✔
97
    }
98
    catch (NumberFormatException e) {
×
99
      return 0;
×
100
    }
101
  }
102

103
  public @NotNull String getPresentableName() {
104
    String name = ":" + getName();
1✔
105
    if (param != null) {
1!
106
      name += "(" + param + ")";
×
107
    }
108
    if ((getIntFlag() & UTF_FLAG) != 0) {
1!
109
      name += " :utf8";
×
110
    }
111
    return name;
1!
112
  }
113

114
  @Override
115
  public String toString() {
116
    return "PerlLayerDescriptor{" +
×
117
           "name='" + name + '\'' +
118
           ", param='" + param + '\'' +
119
           ", flags='" + flags + '\'' +
120
           '}';
121
  }
122
}
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