Showing 84 of 185 total issues
Method addExpectedMsg
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void addExpectedMsg(Rules rule, int line, String msg, int length, int limit) {
Method lineLengthViolation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void lineLengthViolation(int lineNumber, int lineLength, int lengthLimit, Rules rule, String msg) {
Method addExpectedNameMsg
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void addExpectedNameMsg(int line, int column, String msg, int length, int limit) {
Method addExpectedLineMsg
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void addExpectedLineMsg(int line, int column, String msg, int length, int limit) {
Method genOutputStringForTest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static String genOutputStringForTest(Rules rule, String filePath, int line, Severity severity, String msg) {
Method addExpectedMsg
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void addExpectedMsg(Rules rule, int line, int column, Severity severity, String msg) {
Method validateViolationMessage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void validateViolationMessage(ViolationMessage message, Rules rule, String msg,
int line, int column) {
Method genOutputStringForTest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static String genOutputStringForTest(String filePath, int line, int column, Severity severity, String msg) {
Method addExpectedMsg
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void addExpectedMsg(int line, int column, Rules rule, String msg, String fileName) {
Method createListeners
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private List<SwiftBaseListener> createListeners(Set<Rules> enabledRules,
Printer printer,
CommonTokenStream tokenStream,
ConstructLengths constructLengths,
CommentExtractor commentExtractor)
Method getEnabledRules
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public Set<Rules> getEnabledRules() throws CLIArgumentParserException {
// --only is given precedence over --except
// CLI input is given precedence over YAML configuration file
// Retrieve included or excluded rules from CLI
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method compareTo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public int compareTo(final ViolationMessage message) {
int ret = this.lineNumber - message.lineNumber;
if (ret == 0) {
ret = this.columnNumber - message.columnNumber;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method extractComments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private void extractComments() {
for (Token token : tokenStream.getTokens()) {
if (token.getChannel() != Token.HIDDEN_CHANNEL) {
continue;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method equals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return new HashSet<>(Arrays.asList(Rules.values()));
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Method getNumberOfBlankLines
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static int getNumberOfBlankLines(List<Token> tokens) {
if (tokens == null || tokens.size() <= 1) {
return 0;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method commentLeftOfCloseBrace
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private boolean commentLeftOfCloseBrace(Token closeBraceToken) {
Location closeBraceLocation = ListenerUtil.getTokenLocation(closeBraceToken);
List<Token> tokens = tokenStream.getHiddenTokensToLeft(closeBraceToken.getTokenIndex());
// if comments are to the left of }
if (tokens != null) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getFormat
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private Format getFormat() throws CLIArgumentParserException, YAMLException {
// Try to get format from CLI/config file. Else use the default format (XCODE)
Format format = Format.XCODE;
if (CLIArgumentParser.formatOptionSet()) {
format = CLIArgumentParser.getFormat();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"