FluentLenium/FluentLenium

View on GitHub

Showing 1,951 of 1,951 total issues

Avoid variables with short names like g
Open

            Graphics g = stitchedImage.getGraphics();

ShortVariable

Since: PMD 0.3

Priority: Medium

Categories: Style

Remediation Points: 50000

Fields, local variables, or parameter names that are very short are not helpful to the reader.

Example:

public class Something {
 private int q = 15; // field - too short
 public static void main( String as[] ) { // formal arg - too short
 int r = 20 + q; // local var - too short
 for (int i = 0; i < 10; i++) { // not a violation (inside 'for' loop)
 r += q;
 }
 for (Integer i : numbers) { // not a violation (inside 'for-each' loop)
 r += q;
 }
 }
}

Avoid if (x != y) ..; else ..;
Open

        if (baseUri != null) {
            return uri == null ? baseUri.toString() : baseUri.resolve(uri).toString();
        } else if (uri != null) {
            return uri.toString();
        } else {

ConfusingTernary

Since: PMD 1.9

Priority: Medium

Categories: Style

Remediation Points: 50000

Avoid negation within an 'if' expression with an 'else' clause. For example, rephrase: if (x != y) diff(); else same(); as: if (x == y) same(); else diff();. Most 'if (x != y)' cases without an 'else' are often return cases, so consistent use of this rule makes the code easier to read. Also, this resolves trivial ordering problems, such as 'does the error case go first?' or 'does the common case go first?'.

Example:

boolean bar(int x, int y) {
 return (x != y) ? diff : same;
}

The user-supplied array 'args' is stored directly.
Open

    public ReflectiveWebDriverFactory(String name, Class<? extends WebDriver> webDriverClass, Object... args) {

ArrayIsStoredDirectly

Since: PMD 2.2

Priority: Medium

Categories: Style

Remediation Points: 50000

Constructors and methods receiving arrays should clone objects and store the copy. This prevents future changes from the user from affecting the original array.

Example:

public class Foo {
 private String [] x;
 public void foo (String [] param) {
 // Don't do this, make a copy of the array at least
 this.x=param;
 }
}

Consider simply returning the value vs storing it in local variable 'untilPredicate'
Open

        return untilPredicate;

UnnecessaryLocalBeforeReturn

Since: PMD 3.3

Priority: Medium

Categories: Style

Remediation Points: 50000

Avoid the creation of unnecessary local variables

Example:

public class Foo {
 public int foo() {
 int x = doSomething();
 return x; // instead, just 'return doSomething();'
 }
}

Avoid variables with short names like s
Open

    public void afterGetText(WebElement webElement, WebDriver webDriver, String s) {

ShortVariable

Since: PMD 0.3

Priority: Medium

Categories: Style

Remediation Points: 50000

Fields, local variables, or parameter names that are very short are not helpful to the reader.

Example:

public class Something {
 private int q = 15; // field - too short
 public static void main( String as[] ) { // formal arg - too short
 int r = 20 + q; // local var - too short
 for (int i = 0; i < 10; i++) { // not a violation (inside 'for' loop)
 r += q;
 }
 for (Integer i : numbers) { // not a violation (inside 'for-each' loop)
 r += q;
 }
 }
}

Avoid if (x != y) ..; else ..;
Open

        return (page != null) ? page : fluentWebElement;

ConfusingTernary

Since: PMD 1.9

Priority: Medium

Categories: Style

Remediation Points: 50000

Avoid negation within an 'if' expression with an 'else' clause. For example, rephrase: if (x != y) diff(); else same(); as: if (x == y) same(); else diff();. Most 'if (x != y)' cases without an 'else' are often return cases, so consistent use of this rule makes the code easier to read. Also, this resolves trivial ordering problems, such as 'does the error case go first?' or 'does the common case go first?'.

Example:

boolean bar(int x, int y) {
 return (x != y) ? diff : same;
}

Avoid variables with short names like is
Open

        InputStream is = Files.newInputStream(Paths.get(fileName));

ShortVariable

Since: PMD 0.3

Priority: Medium

Categories: Style

Remediation Points: 50000

Fields, local variables, or parameter names that are very short are not helpful to the reader.

Example:

public class Something {
 private int q = 15; // field - too short
 public static void main( String as[] ) { // formal arg - too short
 int r = 20 + q; // local var - too short
 for (int i = 0; i < 10; i++) { // not a violation (inside 'for' loop)
 r += q;
 }
 for (Integer i : numbers) { // not a violation (inside 'for-each' loop)
 r += q;
 }
 }
}

Avoid variables with short names like g
Open

    private void drawStringMultiLine(Graphics g, String text, int lineWidth) {

ShortVariable

Since: PMD 0.3

Priority: Medium

Categories: Style

Remediation Points: 50000

Fields, local variables, or parameter names that are very short are not helpful to the reader.

Example:

public class Something {
 private int q = 15; // field - too short
 public static void main( String as[] ) { // formal arg - too short
 int r = 20 + q; // local var - too short
 for (int i = 0; i < 10; i++) { // not a violation (inside 'for' loop)
 r += q;
 }
 for (Integer i : numbers) { // not a violation (inside 'for-each' loop)
 r += q;
 }
 }
}

Avoid if (x != y) ..; else ..;
Open

        } else if (uri != null) {
            return uri.toString();
        } else {
            return null;
        }

ConfusingTernary

Since: PMD 1.9

Priority: Medium

Categories: Style

Remediation Points: 50000

Avoid negation within an 'if' expression with an 'else' clause. For example, rephrase: if (x != y) diff(); else same(); as: if (x == y) same(); else diff();. Most 'if (x != y)' cases without an 'else' are often return cases, so consistent use of this rule makes the code easier to read. Also, this resolves trivial ordering problems, such as 'does the error case go first?' or 'does the common case go first?'.

Example:

boolean bar(int x, int y) {
 return (x != y) ? diff : same;
}

Avoid if (x != y) ..; else ..;
Open

        if (mockName != null) {
            return mocks.getOrComputeIfAbsent(mockName, key -> mock(mockType, mockName));
        } else {
            return mocks.getOrComputeIfAbsent(mockType.getCanonicalName(), key -> mock(mockType));
        }

ConfusingTernary

Since: PMD 1.9

Priority: Medium

Categories: Style

Remediation Points: 50000

Avoid negation within an 'if' expression with an 'else' clause. For example, rephrase: if (x != y) diff(); else same(); as: if (x == y) same(); else diff();. Most 'if (x != y)' cases without an 'else' are often return cases, so consistent use of this rule makes the code easier to read. Also, this resolves trivial ordering problems, such as 'does the error case go first?' or 'does the common case go first?'.

Example:

boolean bar(int x, int y) {
 return (x != y) ? diff : same;
}

The user-supplied array 'args' is stored directly.
Open

    public MethodInvocationReflectionFactory(Method method, Object instance, Object... args) {

ArrayIsStoredDirectly

Since: PMD 2.2

Priority: Medium

Categories: Style

Remediation Points: 50000

Constructors and methods receiving arrays should clone objects and store the copy. This prevents future changes from the user from affecting the original array.

Example:

public class Foo {
 private String [] x;
 public void foo (String [] param) {
 // Don't do this, make a copy of the array at least
 this.x=param;
 }
}

Document empty method body
Open

    public void verifyIsLoaded() {

    }

UncommentedEmptyMethodBody

Since: PMD 3.4

Priority: Medium

Categories: Style

Remediation Points: 50000

Uncommented Empty Method Body finds instances where a method body does not contain statements, but there is no comment. By explicitly commenting empty method bodies it is easier to distinguish between intentional (commented) and unintentional empty methods.

Example:

public void doSomething() {
}

Avoid unused local variables such as 'converted'.
Open

            long converted = (Long) value;

UnusedLocalVariable

Since: PMD 0.1

Priority: Medium

Categories: Style

Remediation Points: 50000

Detects when a local variable is declared and/or assigned, but not used.

Example:

public class Foo {
 public void doSomething() {
 int i = 5; // Unused
 }
}

A class which only has private constructors should be final
Open

public class PredefinedDesiredCapabilities {

    private PredefinedDesiredCapabilities() {
        // intentionally blank
    }

ClassWithOnlyPrivateConstructorsShouldBeFinal

Since: PMD 4.1

Priority: High

Categories: Style

Remediation Points: 50000

A class with only private constructors should be final, unless the private constructor is invoked by a inner class.

Example:

public class Foo { //Should be final
 private Foo() { }
}

The user-supplied array 'args' is stored directly.
Open

    public ReflectiveCapabilitiesFactory(String name, Class<? extends Capabilities> capabilitiesClass, Object... args) {

ArrayIsStoredDirectly

Since: PMD 2.2

Priority: Medium

Categories: Style

Remediation Points: 50000

Constructors and methods receiving arrays should clone objects and store the copy. This prevents future changes from the user from affecting the original array.

Example:

public class Foo {
 private String [] x;
 public void foo (String [] param) {
 // Don't do this, make a copy of the array at least
 this.x=param;
 }
}

Avoid variables with short names like s
Open

    public void on(String s, WebDriver driver) {

ShortVariable

Since: PMD 0.3

Priority: Medium

Categories: Style

Remediation Points: 50000

Fields, local variables, or parameter names that are very short are not helpful to the reader.

Example:

public class Something {
 private int q = 15; // field - too short
 public static void main( String as[] ) { // formal arg - too short
 int r = 20 + q; // local var - too short
 for (int i = 0; i < 10; i++) { // not a violation (inside 'for' loop)
 r += q;
 }
 for (Integer i : numbers) { // not a violation (inside 'for-each' loop)
 r += q;
 }
 }
}

Avoid variables with short names like m
Open

        FontMetrics m = g.getFontMetrics();

ShortVariable

Since: PMD 0.3

Priority: Medium

Categories: Style

Remediation Points: 50000

Fields, local variables, or parameter names that are very short are not helpful to the reader.

Example:

public class Something {
 private int q = 15; // field - too short
 public static void main( String as[] ) { // formal arg - too short
 int r = 20 + q; // local var - too short
 for (int i = 0; i < 10; i++) { // not a violation (inside 'for' loop)
 r += q;
 }
 for (Integer i : numbers) { // not a violation (inside 'for-each' loop)
 r += q;
 }
 }
}

New exception is thrown in catch block, original stack trace may be lost
Open

            throw new ChromiumApiNotSupportedException("API supported only by Chrome and Edge", ex.getCause());

PreserveStackTrace

Since: PMD 3.7

Priority: Medium

Categories: Style

Remediation Points: 50000

Throwing a new exception from a catch block without passing the original exception into the new exception will cause the original stack trace to be lost making it difficult to debug effectively.

Example:

public class Foo {
 void good() {
 try{
 Integer.parseInt('a');
 } catch (Exception e) {
 throw new Exception(e); // first possibility to create exception chain
 }
 try {
 Integer.parseInt('a');
 } catch (Exception e) {
 throw (IllegalStateException)new IllegalStateException().initCause(e); // second possibility to create exception chain.
 }
 }
 void bad() {
 try{
 Integer.parseInt('a');
 } catch (Exception e) {
 throw new Exception(e.getMessage());
 }
 }
}

The user-supplied array 'args' is stored directly.
Open

    public void setArgs(Object[] args) {

ArrayIsStoredDirectly

Since: PMD 2.2

Priority: Medium

Categories: Style

Remediation Points: 50000

Constructors and methods receiving arrays should clone objects and store the copy. This prevents future changes from the user from affecting the original array.

Example:

public class Foo {
 private String [] x;
 public void foo (String [] param) {
 // Don't do this, make a copy of the array at least
 this.x=param;
 }
}

Avoid variables with short names like s
Open

    public void afterSwitchToWindow(String s, WebDriver webDriver) {

ShortVariable

Since: PMD 0.3

Priority: Medium

Categories: Style

Remediation Points: 50000

Fields, local variables, or parameter names that are very short are not helpful to the reader.

Example:

public class Something {
 private int q = 15; // field - too short
 public static void main( String as[] ) { // formal arg - too short
 int r = 20 + q; // local var - too short
 for (int i = 0; i < 10; i++) { // not a violation (inside 'for' loop)
 r += q;
 }
 for (Integer i : numbers) { // not a violation (inside 'for-each' loop)
 r += q;
 }
 }
}
Severity
Category
Status
Source
Language