The following issues were found

modules/core/misc/java/src/java/core+Size.java
9 issues
Overridable method 'set' called during object construction
Error

Line: 23

                  }

    public Size(double[] vals) {
        set(vals);
    }

    public void set(double[] vals) {
        if (vals != null) {
            width = vals.length > 0 ? vals[0] : 0;

            

Reported by PMD.

Object clone() should be implemented with super.clone()
Error

Line: 44

                      return width <= 0 || height <= 0;
    }

    public Size clone() {
        return new Size(width, height);
    }

    @Override
    public int hashCode() {

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 6

              //javadoc:Size_
public class Size {

    public double width, height;

    public Size(double width, double height) {
        this.width = width;
        this.height = height;
    }

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 6

              //javadoc:Size_
public class Size {

    public double width, height;

    public Size(double width, double height) {
        this.width = width;
        this.height = height;
    }

            

Reported by PMD.

clone() method should be implemented only if implementing Cloneable interface
Error

Line: 44

                      return width <= 0 || height <= 0;
    }

    public Size clone() {
        return new Size(width, height);
    }

    @Override
    public int hashCode() {

            

Reported by PMD.

clone() method should throw CloneNotSupportedException
Error

Line: 44

                      return width <= 0 || height <= 0;
    }

    public Size clone() {
        return new Size(width, height);
    }

    @Override
    public int hashCode() {

            

Reported by PMD.

Use one line for each declaration, it enhances code readability.
Design

Line: 6

              //javadoc:Size_
public class Size {

    public double width, height;

    public Size(double width, double height) {
        this.width = width;
        this.height = height;
    }

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 22

                      height = p.y;
    }

    public Size(double[] vals) {
        set(vals);
    }

    public void set(double[] vals) {
        if (vals != null) {

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 26

                      set(vals);
    }

    public void set(double[] vals) {
        if (vals != null) {
            width = vals.length > 0 ? vals[0] : 0;
            height = vals.length > 1 ? vals[1] : 0;
        } else {
            width = 0;

            

Reported by PMD.

platforms/android/ndk-22.config.py
9 issues
Undefined variable 'ABI'
Error

Line: 2 Column: 5

              ABIs = [
    ABI("2", "armeabi-v7a", None, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON', ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("3", "arm64-v8a",   None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("5", "x86_64",      None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("4", "x86",         None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
]

            

Reported by Pylint.

Undefined variable 'ABI'
Error

Line: 3 Column: 5

              ABIs = [
    ABI("2", "armeabi-v7a", None, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON', ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("3", "arm64-v8a",   None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("5", "x86_64",      None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("4", "x86",         None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
]

            

Reported by Pylint.

Undefined variable 'ABI'
Error

Line: 4 Column: 5

              ABIs = [
    ABI("2", "armeabi-v7a", None, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON', ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("3", "arm64-v8a",   None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("5", "x86_64",      None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("4", "x86",         None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
]

            

Reported by Pylint.

Undefined variable 'ABI'
Error

Line: 5 Column: 5

                  ABI("2", "armeabi-v7a", None, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON', ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("3", "arm64-v8a",   None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("5", "x86_64",      None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("4", "x86",         None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
]

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              ABIs = [
    ABI("2", "armeabi-v7a", None, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON', ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("3", "arm64-v8a",   None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("5", "x86_64",      None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("4", "x86",         None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
]

            

Reported by Pylint.

Line too long (181/100)
Error

Line: 2 Column: 1

              ABIs = [
    ABI("2", "armeabi-v7a", None, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON', ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("3", "arm64-v8a",   None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("5", "x86_64",      None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("4", "x86",         None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
]

            

Reported by Pylint.

Line too long (144/100)
Error

Line: 3 Column: 1

              ABIs = [
    ABI("2", "armeabi-v7a", None, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON', ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("3", "arm64-v8a",   None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("5", "x86_64",      None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("4", "x86",         None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
]

            

Reported by Pylint.

Line too long (144/100)
Error

Line: 4 Column: 1

              ABIs = [
    ABI("2", "armeabi-v7a", None, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON', ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("3", "arm64-v8a",   None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("5", "x86_64",      None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("4", "x86",         None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
]

            

Reported by Pylint.

Line too long (144/100)
Error

Line: 5 Column: 1

                  ABI("2", "armeabi-v7a", None, cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON', ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("3", "arm64-v8a",   None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("5", "x86_64",      None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
    ABI("4", "x86",         None, cmake_vars=dict(ANDROID_GRADLE_PLUGIN_VERSION='4.1.2', GRADLE_VERSION='6.5', KOTLIN_PLUGIN_VERSION='1.5.10')),
]

            

Reported by Pylint.

platforms/android/ndk-10.config.py
9 issues
Undefined variable 'ABI'
Error

Line: 2 Column: 5

              ABIs = [
    ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.8", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
    ABI("1", "armeabi",     "arm-linux-androideabi-4.8"),
    ABI("3", "arm64-v8a",   "aarch64-linux-android-4.9"),
    ABI("5", "x86_64",      "x86_64-4.9"),
    ABI("4", "x86",         "x86-4.8"),
    ABI("7", "mips64",      "mips64el-linux-android-4.9"),
    ABI("6", "mips",        "mipsel-linux-android-4.8")
]

            

Reported by Pylint.

Undefined variable 'ABI'
Error

Line: 3 Column: 5

              ABIs = [
    ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.8", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
    ABI("1", "armeabi",     "arm-linux-androideabi-4.8"),
    ABI("3", "arm64-v8a",   "aarch64-linux-android-4.9"),
    ABI("5", "x86_64",      "x86_64-4.9"),
    ABI("4", "x86",         "x86-4.8"),
    ABI("7", "mips64",      "mips64el-linux-android-4.9"),
    ABI("6", "mips",        "mipsel-linux-android-4.8")
]

            

Reported by Pylint.

Undefined variable 'ABI'
Error

Line: 4 Column: 5

              ABIs = [
    ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.8", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
    ABI("1", "armeabi",     "arm-linux-androideabi-4.8"),
    ABI("3", "arm64-v8a",   "aarch64-linux-android-4.9"),
    ABI("5", "x86_64",      "x86_64-4.9"),
    ABI("4", "x86",         "x86-4.8"),
    ABI("7", "mips64",      "mips64el-linux-android-4.9"),
    ABI("6", "mips",        "mipsel-linux-android-4.8")
]

            

Reported by Pylint.

Undefined variable 'ABI'
Error

Line: 5 Column: 5

                  ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.8", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
    ABI("1", "armeabi",     "arm-linux-androideabi-4.8"),
    ABI("3", "arm64-v8a",   "aarch64-linux-android-4.9"),
    ABI("5", "x86_64",      "x86_64-4.9"),
    ABI("4", "x86",         "x86-4.8"),
    ABI("7", "mips64",      "mips64el-linux-android-4.9"),
    ABI("6", "mips",        "mipsel-linux-android-4.8")
]

            

Reported by Pylint.

Undefined variable 'ABI'
Error

Line: 6 Column: 5

                  ABI("1", "armeabi",     "arm-linux-androideabi-4.8"),
    ABI("3", "arm64-v8a",   "aarch64-linux-android-4.9"),
    ABI("5", "x86_64",      "x86_64-4.9"),
    ABI("4", "x86",         "x86-4.8"),
    ABI("7", "mips64",      "mips64el-linux-android-4.9"),
    ABI("6", "mips",        "mipsel-linux-android-4.8")
]

            

Reported by Pylint.

Undefined variable 'ABI'
Error

Line: 7 Column: 5

                  ABI("3", "arm64-v8a",   "aarch64-linux-android-4.9"),
    ABI("5", "x86_64",      "x86_64-4.9"),
    ABI("4", "x86",         "x86-4.8"),
    ABI("7", "mips64",      "mips64el-linux-android-4.9"),
    ABI("6", "mips",        "mipsel-linux-android-4.8")
]

            

Reported by Pylint.

Undefined variable 'ABI'
Error

Line: 8 Column: 5

                  ABI("5", "x86_64",      "x86_64-4.9"),
    ABI("4", "x86",         "x86-4.8"),
    ABI("7", "mips64",      "mips64el-linux-android-4.9"),
    ABI("6", "mips",        "mipsel-linux-android-4.8")
]

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              ABIs = [
    ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.8", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
    ABI("1", "armeabi",     "arm-linux-androideabi-4.8"),
    ABI("3", "arm64-v8a",   "aarch64-linux-android-4.9"),
    ABI("5", "x86_64",      "x86_64-4.9"),
    ABI("4", "x86",         "x86-4.8"),
    ABI("7", "mips64",      "mips64el-linux-android-4.9"),
    ABI("6", "mips",        "mipsel-linux-android-4.8")
]

            

Reported by Pylint.

Line too long (111/100)
Error

Line: 2 Column: 1

              ABIs = [
    ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.8", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
    ABI("1", "armeabi",     "arm-linux-androideabi-4.8"),
    ABI("3", "arm64-v8a",   "aarch64-linux-android-4.9"),
    ABI("5", "x86_64",      "x86_64-4.9"),
    ABI("4", "x86",         "x86-4.8"),
    ABI("7", "mips64",      "mips64el-linux-android-4.9"),
    ABI("6", "mips",        "mipsel-linux-android-4.8")
]

            

Reported by Pylint.

modules/videoio/misc/python/test/test_videoio.py
9 issues
Unable to import 'cv2'
Error

Line: 5 Column: 1

              from __future__ import print_function

import numpy as np
import cv2 as cv

from tests_common import NewOpenCVTests

class Bindings(NewOpenCVTests):


            

Reported by Pylint.

Unable to import 'tests_common'
Error

Line: 7 Column: 1

              import numpy as np
import cv2 as cv

from tests_common import NewOpenCVTests

class Bindings(NewOpenCVTests):

    def check_name(self, name):
        #print(name)

            

Reported by Pylint.

Unused numpy imported as np
Error

Line: 4 Column: 1

              #!/usr/bin/env python
from __future__ import print_function

import numpy as np
import cv2 as cv

from tests_common import NewOpenCVTests

class Bindings(NewOpenCVTests):

            

Reported by Pylint.

Unnecessary semicolon
Error

Line: 17 Column: 1

                      self.assertFalse(name == "")

    def test_registry(self):
        self.check_name(cv.videoio_registry.getBackendName(cv.CAP_ANY));
        self.check_name(cv.videoio_registry.getBackendName(cv.CAP_FFMPEG))
        self.check_name(cv.videoio_registry.getBackendName(cv.CAP_OPENCV_MJPEG))
        backends = cv.videoio_registry.getBackends()
        for backend in backends:
            self.check_name(cv.videoio_registry.getBackendName(backend))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python
from __future__ import print_function

import numpy as np
import cv2 as cv

from tests_common import NewOpenCVTests

class Bindings(NewOpenCVTests):

            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

              
from tests_common import NewOpenCVTests

class Bindings(NewOpenCVTests):

    def check_name(self, name):
        #print(name)
        self.assertFalse(name == None)
        self.assertFalse(name == "")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 5

              
class Bindings(NewOpenCVTests):

    def check_name(self, name):
        #print(name)
        self.assertFalse(name == None)
        self.assertFalse(name == "")

    def test_registry(self):

            

Reported by Pylint.

Comparison 'name == None' should be 'name is None'
Error

Line: 13 Column: 26

              
    def check_name(self, name):
        #print(name)
        self.assertFalse(name == None)
        self.assertFalse(name == "")

    def test_registry(self):
        self.check_name(cv.videoio_registry.getBackendName(cv.CAP_ANY));
        self.check_name(cv.videoio_registry.getBackendName(cv.CAP_FFMPEG))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 5

                      self.assertFalse(name == None)
        self.assertFalse(name == "")

    def test_registry(self):
        self.check_name(cv.videoio_registry.getBackendName(cv.CAP_ANY));
        self.check_name(cv.videoio_registry.getBackendName(cv.CAP_FFMPEG))
        self.check_name(cv.videoio_registry.getBackendName(cv.CAP_OPENCV_MJPEG))
        backends = cv.videoio_registry.getBackends()
        for backend in backends:

            

Reported by Pylint.

modules/core/misc/java/src/java/core+Range.java
9 issues
Overridable method 'set' called during object construction
Error

Line: 18

                  }

    public Range(double[] vals) {
        set(vals);
    }

    public void set(double[] vals) {
        if (vals != null) {
            start = vals.length > 0 ? (int) vals[0] : 0;

            

Reported by PMD.

Object clone() should be implemented with super.clone()
Error

Line: 54

                      return new Range(start + delta, end + delta);
    }

    public Range clone() {
        return new Range(start, end);
    }

    @Override
    public int hashCode() {

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 6

              //javadoc:Range
public class Range {

    public int start, end;

    public Range(int s, int e) {
        this.start = s;
        this.end = e;
    }

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 6

              //javadoc:Range
public class Range {

    public int start, end;

    public Range(int s, int e) {
        this.start = s;
        this.end = e;
    }

            

Reported by PMD.

clone() method should throw CloneNotSupportedException
Error

Line: 54

                      return new Range(start + delta, end + delta);
    }

    public Range clone() {
        return new Range(start, end);
    }

    @Override
    public int hashCode() {

            

Reported by PMD.

clone() method should be implemented only if implementing Cloneable interface
Error

Line: 54

                      return new Range(start + delta, end + delta);
    }

    public Range clone() {
        return new Range(start, end);
    }

    @Override
    public int hashCode() {

            

Reported by PMD.

Use one line for each declaration, it enhances code readability.
Design

Line: 6

              //javadoc:Range
public class Range {

    public int start, end;

    public Range(int s, int e) {
        this.start = s;
        this.end = e;
    }

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 17

                      this(0, 0);
    }

    public Range(double[] vals) {
        set(vals);
    }

    public void set(double[] vals) {
        if (vals != null) {

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 21

                      set(vals);
    }

    public void set(double[] vals) {
        if (vals != null) {
            start = vals.length > 0 ? (int) vals[0] : 0;
            end = vals.length > 1 ? (int) vals[1] : 0;
        } else {
            start = 0;

            

Reported by PMD.

modules/core/misc/java/src/java/core+Point.java
9 issues
Overridable method 'set' called during object construction
Error

Line: 19

              
    public Point(double[] vals) {
        this();
        set(vals);
    }

    public void set(double[] vals) {
        if (vals != null) {
            x = vals.length > 0 ? vals[0] : 0;

            

Reported by PMD.

Object clone() should be implemented with super.clone()
Error

Line: 32

                      }
    }

    public Point clone() {
        return new Point(x, y);
    }

    public double dot(Point p) {
        return x * p.x + y * p.y;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 6

              //javadoc:Point_
public class Point {

    public double x, y;

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 6

              //javadoc:Point_
public class Point {

    public double x, y;

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }

            

Reported by PMD.

clone() method should throw CloneNotSupportedException
Error

Line: 32

                      }
    }

    public Point clone() {
        return new Point(x, y);
    }

    public double dot(Point p) {
        return x * p.x + y * p.y;

            

Reported by PMD.

clone() method should be implemented only if implementing Cloneable interface
Error

Line: 32

                      }
    }

    public Point clone() {
        return new Point(x, y);
    }

    public double dot(Point p) {
        return x * p.x + y * p.y;

            

Reported by PMD.

Use one line for each declaration, it enhances code readability.
Design

Line: 6

              //javadoc:Point_
public class Point {

    public double x, y;

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 17

                      this(0, 0);
    }

    public Point(double[] vals) {
        this();
        set(vals);
    }

    public void set(double[] vals) {

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 22

                      set(vals);
    }

    public void set(double[] vals) {
        if (vals != null) {
            x = vals.length > 0 ? vals[0] : 0;
            y = vals.length > 1 ? vals[1] : 0;
        } else {
            x = 0;

            

Reported by PMD.

modules/ts/misc/concatlogs.py
9 issues
Uses of a deprecated module 'optparse'
Error

Line: 3 Column: 1

              #!/usr/bin/env python

from optparse import OptionParser
import glob, sys, os, re

if __name__ == "__main__":
    parser = OptionParser()
    parser.add_option("-o", "--output", dest="output", help="output file name", metavar="FILENAME", default=None)
    (options, args) = parser.parse_args()

            

Reported by Pylint.

No exception type(s) specified
Error

Line: 35 Column: 9

                          idx1 = text.find("<tbody>") + len("<tbody>")
            idx2 = html.rfind("</tbody>")
            html = html[:idx2] + re.sub(r"[ \t\n\r]+", " ", text[idx1:])
        except:
            pass

    if html:
        idx1 = text.find("<title>") + len("<title>")
        idx2 = html.find("</title>")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python

from optparse import OptionParser
import glob, sys, os, re

if __name__ == "__main__":
    parser = OptionParser()
    parser.add_option("-o", "--output", dest="output", help="output file name", metavar="FILENAME", default=None)
    (options, args) = parser.parse_args()

            

Reported by Pylint.

Multiple imports on one line (glob, sys, os, re)
Error

Line: 4 Column: 1

              #!/usr/bin/env python

from optparse import OptionParser
import glob, sys, os, re

if __name__ == "__main__":
    parser = OptionParser()
    parser.add_option("-o", "--output", dest="output", help="output file name", metavar="FILENAME", default=None)
    (options, args) = parser.parse_args()

            

Reported by Pylint.

Line too long (113/100)
Error

Line: 8 Column: 1

              
if __name__ == "__main__":
    parser = OptionParser()
    parser.add_option("-o", "--output", dest="output", help="output file name", metavar="FILENAME", default=None)
    (options, args) = parser.parse_args()

    if not options.output:
        sys.stderr.write("Error: output file name is not provided")
        exit(-1)

            

Reported by Pylint.

Consider using sys.exit()
Error

Line: 13 Column: 9

              
    if not options.output:
        sys.stderr.write("Error: output file name is not provided")
        exit(-1)

    files = []
    for arg in args:
        if ("*" in arg) or ("?" in arg):
            files.extend([os.path.abspath(f) for f in glob.glob(arg)])

            

Reported by Pylint.

Constant name "html" doesn't conform to UPPER_CASE naming style
Error

Line: 22 Column: 5

                      else:
            files.append(os.path.abspath(arg))

    html = None
    for f in sorted(files):
        try:
            fobj = open(f)
            if not fobj:
                continue

            

Reported by Pylint.

Try, Except, Pass detected.
Security

Line: 35
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b110_try_except_pass.html

                          idx1 = text.find("<tbody>") + len("<tbody>")
            idx2 = html.rfind("</tbody>")
            html = html[:idx2] + re.sub(r"[ \t\n\r]+", " ", text[idx1:])
        except:
            pass

    if html:
        idx1 = text.find("<title>") + len("<title>")
        idx2 = html.find("</title>")

            

Reported by Bandit.

Consider using sys.exit()
Error

Line: 45 Column: 9

                      open(options.output, "w").write(html)
    else:
        sys.stderr.write("Error: no input data")
        exit(-1)

            

Reported by Pylint.

modules/python/test/test_copytomask.py
9 issues
Unable to import 'cv2'
Error

Line: 11 Column: 1

              from __future__ import print_function

import numpy as np
import cv2 as cv
import sys

from tests_common import NewOpenCVTests

class copytomask_test(NewOpenCVTests):

            

Reported by Pylint.

Unused import sys
Error

Line: 12 Column: 1

              
import numpy as np
import cv2 as cv
import sys

from tests_common import NewOpenCVTests

class copytomask_test(NewOpenCVTests):
    def test_copytomask(self):

            

Reported by Pylint.

standard import "import sys" should be placed before "import numpy as np"
Error

Line: 12 Column: 1

              
import numpy as np
import cv2 as cv
import sys

from tests_common import NewOpenCVTests

class copytomask_test(NewOpenCVTests):
    def test_copytomask(self):

            

Reported by Pylint.

Class name "copytomask_test" doesn't conform to PascalCase naming style
Error

Line: 16 Column: 1

              
from tests_common import NewOpenCVTests

class copytomask_test(NewOpenCVTests):
    def test_copytomask(self):

        img = self.get_sample('python/images/baboon.png', cv.IMREAD_COLOR)
        eps = 0.


            

Reported by Pylint.

Missing class docstring
Error

Line: 16 Column: 1

              
from tests_common import NewOpenCVTests

class copytomask_test(NewOpenCVTests):
    def test_copytomask(self):

        img = self.get_sample('python/images/baboon.png', cv.IMREAD_COLOR)
        eps = 0.


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 5

              from tests_common import NewOpenCVTests

class copytomask_test(NewOpenCVTests):
    def test_copytomask(self):

        img = self.get_sample('python/images/baboon.png', cv.IMREAD_COLOR)
        eps = 0.

        #Create mask using inRange

            

Reported by Pylint.

Variable name "valeurBGRinf" doesn't conform to snake_case naming style
Error

Line: 23 Column: 9

                      eps = 0.

        #Create mask using inRange
        valeurBGRinf = np.array([0,0,100])
        valeurBGRSup = np.array([70, 70,255])
        maskRed = cv.inRange(img, valeurBGRinf, valeurBGRSup)
        #New binding
        dstcv = np.ndarray(np.array((2, 2, 1))*img.shape, dtype=img.dtype)
        dstcv.fill(255)

            

Reported by Pylint.

Variable name "valeurBGRSup" doesn't conform to snake_case naming style
Error

Line: 24 Column: 9

              
        #Create mask using inRange
        valeurBGRinf = np.array([0,0,100])
        valeurBGRSup = np.array([70, 70,255])
        maskRed = cv.inRange(img, valeurBGRinf, valeurBGRSup)
        #New binding
        dstcv = np.ndarray(np.array((2, 2, 1))*img.shape, dtype=img.dtype)
        dstcv.fill(255)
        cv.copyTo(img, maskRed, dstcv[:img.shape[0],:img.shape[1],:])

            

Reported by Pylint.

Variable name "maskRed" doesn't conform to snake_case naming style
Error

Line: 25 Column: 9

                      #Create mask using inRange
        valeurBGRinf = np.array([0,0,100])
        valeurBGRSup = np.array([70, 70,255])
        maskRed = cv.inRange(img, valeurBGRinf, valeurBGRSup)
        #New binding
        dstcv = np.ndarray(np.array((2, 2, 1))*img.shape, dtype=img.dtype)
        dstcv.fill(255)
        cv.copyTo(img, maskRed, dstcv[:img.shape[0],:img.shape[1],:])
        #using numpy

            

Reported by Pylint.

modules/objdetect/misc/java/test/QRCodeDetectorTest.java
9 issues
Avoid throwing raw exception types.
Design

Line: 24

              
        testDataPath = System.getenv(ENV_OPENCV_TEST_DATA_PATH);
        if (testDataPath == null)
            throw new Exception(ENV_OPENCV_TEST_DATA_PATH + " has to be defined!");
    }

    public void testDetectAndDecode() {
        Mat img = Imgcodecs.imread(testDataPath + "/cv/qrcode/link_ocv.jpg");
        assertFalse(img.empty());

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 16

              public class QRCodeDetectorTest extends OpenCVTestCase {

    private final static String ENV_OPENCV_TEST_DATA_PATH = "OPENCV_TEST_DATA_PATH";
    private String testDataPath;

    @Override
    protected void setUp() throws Exception {
        super.setUp();


            

Reported by PMD.

JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 18

                  private final static String ENV_OPENCV_TEST_DATA_PATH = "OPENCV_TEST_DATA_PATH";
    private String testDataPath;

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        testDataPath = System.getenv(ENV_OPENCV_TEST_DATA_PATH);
        if (testDataPath == null)

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 27

                          throw new Exception(ENV_OPENCV_TEST_DATA_PATH + " has to be defined!");
    }

    public void testDetectAndDecode() {
        Mat img = Imgcodecs.imread(testDataPath + "/cv/qrcode/link_ocv.jpg");
        assertFalse(img.empty());
        QRCodeDetector detector = new QRCodeDetector();
        assertNotNull(detector);
        String output = detector.detectAndDecode(img);

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 27

                          throw new Exception(ENV_OPENCV_TEST_DATA_PATH + " has to be defined!");
    }

    public void testDetectAndDecode() {
        Mat img = Imgcodecs.imread(testDataPath + "/cv/qrcode/link_ocv.jpg");
        assertFalse(img.empty());
        QRCodeDetector detector = new QRCodeDetector();
        assertNotNull(detector);
        String output = detector.detectAndDecode(img);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 29

              
    public void testDetectAndDecode() {
        Mat img = Imgcodecs.imread(testDataPath + "/cv/qrcode/link_ocv.jpg");
        assertFalse(img.empty());
        QRCodeDetector detector = new QRCodeDetector();
        assertNotNull(detector);
        String output = detector.detectAndDecode(img);
        assertEquals(output, "https://opencv.org/");
    }

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 36

                      assertEquals(output, "https://opencv.org/");
    }

    public void testDetectAndDecodeMulti() {
        Mat img = Imgcodecs.imread(testDataPath + "/cv/qrcode/multiple/6_qrcodes.png");
        assertFalse(img.empty());
        QRCodeDetector detector = new QRCodeDetector();
        assertNotNull(detector);
        List < String > output = new ArrayList< String >();

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 36

                      assertEquals(output, "https://opencv.org/");
    }

    public void testDetectAndDecodeMulti() {
        Mat img = Imgcodecs.imread(testDataPath + "/cv/qrcode/multiple/6_qrcodes.png");
        assertFalse(img.empty());
        QRCodeDetector detector = new QRCodeDetector();
        assertNotNull(detector);
        List < String > output = new ArrayList< String >();

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 38

              
    public void testDetectAndDecodeMulti() {
        Mat img = Imgcodecs.imread(testDataPath + "/cv/qrcode/multiple/6_qrcodes.png");
        assertFalse(img.empty());
        QRCodeDetector detector = new QRCodeDetector();
        assertNotNull(detector);
        List < String > output = new ArrayList< String >();
        boolean result = detector.detectAndDecodeMulti(img, output);
        assertTrue(result);

            

Reported by PMD.

modules/js/generator/templates.py
9 issues
Missing module docstring
Error

Line: 1 Column: 1

              ###############################################################################
#
#  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
#
#  By downloading, copying, installing or using the software you agree to this license.
#  If you do not agree to this license, do not download, install,
#  copy or use the software.
#
#

            

Reported by Pylint.

Line too long (109/100)
Error

Line: 99 Column: 1

                  Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined())
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined())
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&
                    $arg4.isUndefined())
            return $cpp_call;

            

Reported by Pylint.

Line too long (111/100)
Error

Line: 102 Column: 1

                  Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined())
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&
                    $arg4.isUndefined())
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&
                    $arg4.isUndefined() && $arg5.isUndefined() )

            

Reported by Pylint.

Line too long (111/100)
Error

Line: 106 Column: 1

                                  $arg4.isUndefined())
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&
                    $arg4.isUndefined() && $arg5.isUndefined() )
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&
                    $arg4.isUndefined() && $arg5.isUndefined() && $arg6.isUndefined() )

            

Reported by Pylint.

Line too long (111/100)
Error

Line: 110 Column: 1

                                  $arg4.isUndefined() && $arg5.isUndefined() )
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&
                    $arg4.isUndefined() && $arg5.isUndefined() && $arg6.isUndefined() )
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&
                    $arg4.isUndefined() && $arg5.isUndefined()&& $arg6.isUndefined()  && $arg7.isUndefined())

            

Reported by Pylint.

Line too long (111/100)
Error

Line: 114 Column: 1

                                  $arg4.isUndefined() && $arg5.isUndefined() && $arg6.isUndefined() )
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&
                    $arg4.isUndefined() && $arg5.isUndefined()&& $arg6.isUndefined()  && $arg7.isUndefined())
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&
                    $arg4.isUndefined() && $arg5.isUndefined()&& $arg6.isUndefined()  && $arg7.isUndefined() &&

            

Reported by Pylint.

Line too long (111/100)
Error

Line: 118 Column: 1

                                  $arg4.isUndefined() && $arg5.isUndefined()&& $arg6.isUndefined()  && $arg7.isUndefined())
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&
                    $arg4.isUndefined() && $arg5.isUndefined()&& $arg6.isUndefined()  && $arg7.isUndefined() &&
                    $arg8.isUndefined())
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&

            

Reported by Pylint.

Line too long (111/100)
Error

Line: 123 Column: 1

                                  $arg8.isUndefined())
            return $cpp_call;
        else $next"""),
    Template("""if ($arg0.isUndefined() && $arg1.isUndefined() && $arg2.isUndefined() && $arg3.isUndefined() &&
                    $arg4.isUndefined() && $arg5.isUndefined()&& $arg6.isUndefined()  && $arg7.isUndefined()&&
                    $arg8.isUndefined() && $arg9.isUndefined())
            return $cpp_call;
        else $next""")]


            

Reported by Pylint.

Line too long (104/100)
Error

Line: 163 Column: 1

                      .constructor(select_overload<$ret($args)$const>(&$cpp_name)$optional)""")

smart_ptr_ctr_overload_template = Template("""
        .smart_ptr_constructor("$ptr_type", select_overload<$ret($args)$const>(&$cpp_name)$optional)""")

function_template = Template("""
        .function("$js_name", &$cpp_name)""")

static_function_template = Template("""

            

Reported by Pylint.