WebicityBrowser/Webicity

View on GitHub

Showing 455 of 459 total issues

Method consumeAListOfDeclarations has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

private CSSRule[] consumeAListOfDeclarations(TokenStream stream) {
List<CSSRule> declarations = new ArrayList<>();
while (true) {
TokenLike token = stream.peek();
if (token instanceof WhitespaceToken || token instanceof SemicolonToken) {

Similar blocks of code found in 3 locations. Consider refactoring.
Open

package com.github.webicitybrowser.spiderhtml.tokenize;
 
import java.io.IOException;
import java.util.function.Consumer;
 
SpiderHTML/src/main/java/com/github/webicitybrowser/spiderhtml/tokenize/RawTextEndTagOpenState.java on lines 1..37
SpiderHTML/src/main/java/com/github/webicitybrowser/spiderhtml/tokenize/ScriptDataEndTagOpenState.java on lines 1..37

Similar blocks of code found in 3 locations. Consider refactoring.
Open

package com.github.webicitybrowser.spiderhtml.tokenize;
 
import java.io.IOException;
import java.util.function.Consumer;
 
SpiderHTML/src/main/java/com/github/webicitybrowser/spiderhtml/tokenize/RCDataEndTagOpenState.java on lines 1..37
SpiderHTML/src/main/java/com/github/webicitybrowser/spiderhtml/tokenize/RawTextEndTagOpenState.java on lines 1..37

Similar blocks of code found in 3 locations. Consider refactoring.
Open

package com.github.webicitybrowser.spiderhtml.tokenize;
 
import java.io.IOException;
import java.util.function.Consumer;
 
SpiderHTML/src/main/java/com/github/webicitybrowser/spiderhtml/tokenize/RCDataEndTagOpenState.java on lines 1..37
SpiderHTML/src/main/java/com/github/webicitybrowser/spiderhtml/tokenize/ScriptDataEndTagOpenState.java on lines 1..37

Similar blocks of code found in 2 locations. Consider refactoring.
Open

private Component createActionButtonsContainer() {
Component[] buttons = new Component[] {
createMinimizeButton(),
createRestoreButton(),
createXButton()
WebicityBrowser/src/main/java/com/github/webicitybrowser/webicitybrowser/gui/binding/TabGUI.java on lines 96..114

Method resolveDirective has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

@SuppressWarnings("unchecked")
private <T extends Directive> Optional<T> resolveDirective(Class<T> directiveClass) {
// TODO: Invalidate derivations
if (derivers.containsKey(directiveClass)) {
DirectiveDeriver<T> deriver = (DirectiveDeriver<T>) derivers.get(directiveClass);

Similar blocks of code found in 2 locations. Consider refactoring.
Open

private Component createNavigationButtonsContainer() {
Component[] buttons = new Component[] {
createBackButton(),
createReloadButton(),
createForwardButton()
WebicityBrowser/src/main/java/com/github/webicitybrowser/webicitybrowser/gui/binding/WindowGUI.java on lines 156..174

Method lookahead has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

public String lookahead(int num) throws IOException {
clearDeadBuffers();
if (num < 0) {
throw new IllegalArgumentException("num must be non-negative");
} else if (num == 0) {

Method getFittingText has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

public TextUnit getFittingText(float inlineSize, boolean forceFit) {
if (completed()) {
throw new IllegalStateException("Already completed");
}
 
 

Similar blocks of code found in 2 locations. Consider refactoring.
Open

package com.github.webicitybrowser.webicitybrowser.gui.colors;
 
import com.github.webicitybrowser.thready.color.Colors;
import com.github.webicitybrowser.thready.color.colors.RGBA8Color;
import com.github.webicitybrowser.thready.color.format.ColorFormat;
WebicityBrowser/src/main/java/com/github/webicitybrowser/webicitybrowser/gui/colors/PrivateColors.java on lines 1..52

Similar blocks of code found in 2 locations. Consider refactoring.
Open

package com.github.webicitybrowser.webicitybrowser.gui.colors;
 
import com.github.webicitybrowser.thready.color.Colors;
import com.github.webicitybrowser.thready.color.colors.RGBA8Color;
import com.github.webicitybrowser.thready.color.format.ColorFormat;
WebicityBrowser/src/main/java/com/github/webicitybrowser/webicitybrowser/gui/colors/NormalColors.java on lines 1..52

Method consumeAURLToken has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public static Token consumeAURLToken(ReaderHandle reader) throws IOException {
StringBuilder url = new StringBuilder();
while (SharedTokenizer.isWhitespace(reader.peek())) {
reader.read();
}

    Method getNextSiblings has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    public static <T, U> BitSet getNextSiblings(BitSet current, CSSOMTraverseContext<T, U> context) {
    BitSet siblings = new BitSet();
    for (int i = 0; i < current.size(); i++) {
    if (!current.get(i)) continue;
    T currentNode = context.allParticipants().get(i);

    Method getSubsequentSiblings has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    public static <T, U> BitSet getSubsequentSiblings(BitSet current, CSSOMTraverseContext<T, U> context) {
    BitSet siblings = new BitSet();
    for (int i = 0; i < current.size(); i++) {
    if (!current.get(i)) continue;
    T currentNode = context.allParticipants().get(i);

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    package com.github.webicitybrowser.spiderhtml.tokenize;
     
    import java.io.IOException;
    import java.util.function.Consumer;
     
    SpiderHTML/src/main/java/com/github/webicitybrowser/spiderhtml/tokenize/ScriptDataState.java on lines 1..40

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    package com.github.webicitybrowser.spiderhtml.tokenize;
     
    import java.io.IOException;
    import java.util.function.Consumer;
     
    SpiderHTML/src/main/java/com/github/webicitybrowser/spiderhtml/tokenize/RawTextLessThanSignState.java on lines 1..36

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    package com.github.webicitybrowser.spiderhtml.tokenize;
     
    import java.io.IOException;
    import java.util.function.Consumer;
     
    SpiderHTML/src/main/java/com/github/webicitybrowser/spiderhtml/tokenize/RawTextState.java on lines 1..40

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    package com.github.webicitybrowser.spiderhtml.tokenize;
     
    import java.io.IOException;
    import java.util.function.Consumer;
     
    SpiderHTML/src/main/java/com/github/webicitybrowser/spiderhtml/tokenize/RCDataLessThanSignState.java on lines 1..36

    Method decode has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    public int[] decode(byte[] buffer, Charset fallbackEncoding) throws IOException {
    ByteBuffer byteBuffer = ByteBuffer.wrap(buffer);
    if (encoding == null) {
    this.encoding = bomSniff(byteBuffer);
    encoding = encoding != null ? encoding : fallbackEncoding;

      Method build has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      @Override
      public Flag build() {
      final boolean mandatory = this.mandatory;
      final int arguments = this.numberRequiredArguments;
      final int optionalArguments = this.numberOptionalArguments;
      Severity: Minor
      Found in GetOpts/src/main/java/everyos/api/getopts/imp/FlagBuilderImp.java - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language