wonderkiln/CameraKit-Android

View on GitHub

Showing 62 of 91 total issues

Method dispatchEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public void dispatchEvent(@NonNull CameraKitEvent event) throws IllegalAccessException, InvocationTargetException {
            List<MethodHolder> baseMethods = methods.get(CameraKitEvent.class);
            if (baseMethods != null) {
                for (MethodHolder methodHolder : baseMethods) {
                    methodHolder.getMethod().invoke(methodHolder.getBinding(), event);
Severity: Minor
Found in camerakit/src/main/events/com/wonderkiln/camerakit/EventDispatcher.java - About 25 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 setFacing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    void setFacing(@Facing int facing) {
        synchronized (mCameraLock) {
            int internalFacing = new ConstantMapper.Facing(facing).map();
            if (internalFacing == -1) {
Severity: Minor
Found in camerakit/src/main/api16/com/wonderkiln/camerakit/Camera1.java - About 25 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

Severity
Category
Status
Source
Language