FluentLenium/FluentLenium

View on GitHub

Showing 142 of 1,951 total issues

Method buildEachElementPredicate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected Predicate<FluentDriver> buildEachElementPredicate(Predicate<FluentWebElement> predicate, boolean defaultValue) {
        Predicate<FluentDriver> untilPredicate = fluent -> {
            if (getElements().size() > 0) {
                for (FluentWebElement element : getElements()) {
                    if (!predicate.test(element)) {

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 newInstance has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

            protected FluentHook<?> newInstance(Class<? extends FluentHook<?>> hookClass, FluentControl fluentControl,
                                                ComponentInstantiator instantiator, Supplier<WebElement> elementSupplier,
                                                Supplier<ElementLocator> locatorSupplier, Supplier<String> toStringSupplier, Object options)

    Method newInstance has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected FluentHook<?> newInstance(Class<? extends FluentHook<?>> hookClass, FluentControl fluentControl,
                                            ComponentInstantiator instantiator, Supplier<WebElement> elementSupplier, Supplier<ElementLocator> locatorSupplier,
                                            Supplier<String> toStringSupplier, Object options)

      Method injectComponent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private void injectComponent(ComponentAndProxy fieldValue, ElementLocator locator, Object container, Field field,
                                       ArrayList<HookDefinition<?>> fieldHookDefinitions) {
              if (fieldValue != null) {
                  LocatorProxies.setHooks(fieldValue.getProxy(), hookChainBuilder, fieldHookDefinitions);
                  try {

      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 on has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public void on(By by, FluentWebElement element, WebDriver driver) {
              if (targetElement != null && (element == null || !targetElement.equals(element.getElement()))) {
                  return;
              }

      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 on has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public void on(FluentWebElement element, WebDriver driver) {
              if (targetElement != null && (element == null || !targetElement.equals(element.getElement()))) {
                  return;
              }

      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 getCauseMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static String getCauseMessage(Exception e) {
              String causeMessage = null;
              Throwable cause = e;
              while (true) {
                  if (cause.getCause() == null || cause.getCause() == cause) {
      Severity: Minor
      Found in fluentlenium-core/src/main/java/io/fluentlenium/utils/ExceptionUtil.java - About 45 mins to fix

      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 logWarningsWhenSeleniumVersionIsWrong has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          static void logWarningsWhenSeleniumVersionIsWrong(Model model) {
              if (model != null) {
                  String seleniumVersion = retrieveVersionFromPom(model);
                  if (seleniumVersion == null) {
                      return;

      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 invoke has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
              Object instanceReturn = null;
              if (instance != null) {
                  instanceReturn = method.invoke(instance, args);

      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 getConstructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static <T> Constructor<T> getConstructor(Class<T> cls, Class<?>... argsTypes) throws NoSuchMethodException {
              if (argsTypes == null || argsTypes.length == 0) {
                  return cls.getDeclaredConstructor();
              }
      
      

      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 isMatchingConstructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private static boolean isMatchingConstructor(Constructor<?> constructor, Class<?>[] argsTypes) {
              Class<?>[] parameterTypes = constructor.getParameterTypes();
              if (parameterTypes.length != argsTypes.length) {
                  return false;
              }

      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 sanitizeBaseUrl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static String sanitizeBaseUrl(String baseUriSpec, String uriSpec) {
              if (baseUriSpec != null) {
                  URI baseUri = URI.create(baseUriSpec);
      
                  try {
      Severity: Minor
      Found in fluentlenium-core/src/main/java/io/fluentlenium/utils/UrlUtils.java - About 45 mins to fix

      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 8 (exceeds 5 allowed). Consider refactoring.
      Open

              public boolean equals(final Object obj) {
                  if (obj == this) {
                      return true;
                  }
      
      

      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 getTestDriver has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static SharedWebDriver getTestDriver(Class<?> testClass, String testName, Supplier<WebDriver> webDriver,
                                                      TriConsumer<Throwable, Class<?>, String> failed,
                                                      Configuration configuration, SharedMutator.EffectiveParameters<?> parameters) {

        Method get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public T get(String name) {
                if (name != null) {
                    synchronized (this) {
                        T factory = factories.get(name);
                        if (factory == null) {

        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 injectComponent has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private void injectComponent(ComponentAndProxy fieldValue, ElementLocator locator, Object container, Field field,
                                         ArrayList<HookDefinition<?>> fieldHookDefinitions) {

          Method testImpl has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private <T> void testImpl(Function<ConfigurationProperties, T> getter, Function<T, Void> setter, T defaultValue,
                                        T value1, T value2) {

            Method newWebDriver has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                public WebDriver newWebDriver(Capabilities capabilities, ConfigurationProperties configuration) {
                    if (!available) {
                        throw new ConfigurationException("WebDriver " + webDriverClassName + " is not available.");
                    }

            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 getList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public List<T> getList() {
                    Object value = this.list.get();
                    if (value == null) {
                        synchronized (this.list) {
                            value = this.list.get();

            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 buildHookDefinition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private <T> HookDefinition<T> buildHookDefinition(Hook hookAnnotation, HookOptions hookOptionsAnnotation,
                                                                  Annotation currentAnnotation) {
                    Class<? extends T> hookOptionsClass =
                            hookOptionsAnnotation == null ? null : (Class<? extends T>) hookOptionsAnnotation.value();
                    T fluentHookOptions = null;

            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

            Severity
            Category
            Status
            Source
            Language