wonderkiln/CameraKit-Android

View on GitHub

Showing 91 of 91 total issues

File Camera1.java has 921 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.wonderkiln.camerakit;

import android.graphics.Rect;
import android.graphics.YuvImage;
import android.hardware.Camera;
Severity: Major
Found in camerakit/src/main/api16/com/wonderkiln/camerakit/Camera1.java - About 2 days to fix

File CameraKitView.java has 606 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.camerakit;

import android.Manifest;
import android.app.Activity;
import android.content.Context;
Severity: Major
Found in camerakit/src/main/java/com/camerakit/CameraKitView.java - About 1 day to fix

CameraKitView has 66 methods (exceeds 20 allowed). Consider refactoring.
Open

public class CameraKitView extends GestureLayout {

    /**
     * Request code for a runtime permissions intent.
     */
Severity: Major
Found in camerakit/src/main/java/com/camerakit/CameraKitView.java - About 1 day to fix

Camera1 has 56 methods (exceeds 20 allowed). Consider refactoring.
Open

@SuppressWarnings("deprecation")
public class Camera1 extends CameraImpl {

    private static final String TAG = Camera1.class.getSimpleName();

Severity: Major
Found in camerakit/src/main/api16/com/wonderkiln/camerakit/Camera1.java - About 1 day to fix

CameraView has 50 methods (exceeds 20 allowed). Consider refactoring.
Open

public class CameraView extends CameraViewLayout {

    private static Handler sWorkerHandler;

    static {
Severity: Minor
Found in camerakit/src/main/java/com/wonderkiln/camerakit/CameraView.java - About 7 hrs to fix

File CameraView.java has 445 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.wonderkiln.camerakit;

import static com.wonderkiln.camerakit.CameraKit.Constants.FACING_BACK;
import static com.wonderkiln.camerakit.CameraKit.Constants.FACING_FRONT;
import static com.wonderkiln.camerakit.CameraKit.Constants.FLASH_AUTO;
Severity: Minor
Found in camerakit/src/main/java/com/wonderkiln/camerakit/CameraView.java - About 6 hrs to fix

Method onStart has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public void onStart() {
        if (isInEditMode()) {
            return;
        }

Severity: Minor
Found in camerakit/src/main/java/com/camerakit/CameraKitView.java - About 3 hrs 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 getCameraPreviewResolution has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    Size getCameraPreviewResolution() {
        if (mPreviewSize == null && mCameraParameters != null) {
            TreeSet<Size> sizes = new TreeSet<>();
            for (Camera.Size size : mCameraParameters.getSupportedPreviewSizes()) {
                sizes.add(new Size(size.width, size.height));
Severity: Minor
Found in camerakit/src/main/api16/com/wonderkiln/camerakit/Camera1.java - About 3 hrs 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 getCamcorderProfile has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    private CamcorderProfile getCamcorderProfile(@VideoQuality int videoQuality) {
        CamcorderProfile camcorderProfile = null;
        switch (videoQuality) {
            case CameraKit.Constants.VIDEO_QUALITY_QVGA:
                if (CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_QVGA)) {
Severity: Minor
Found in camerakit/src/main/api16/com/wonderkiln/camerakit/Camera1.java - About 3 hrs 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

BitmapOperator has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

public class BitmapOperator {

    private ByteBuffer handler;

    private BitmapOperator() {
Severity: Minor
Found in camerakit/src/main/utils/com/wonderkiln/camerakit/BitmapOperator.java - About 2 hrs to fix

Method setFocus has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    void setFocus(@Focus int focus) {
        synchronized (mCameraLock) {
            this.mFocus = focus;
            switch (focus) {
Severity: Minor
Found in camerakit/src/main/api16/com/wonderkiln/camerakit/Camera1.java - About 2 hrs 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

CameraImpl has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

abstract class CameraImpl {

    protected final EventDispatcher mEventDispatcher;
    protected final PreviewImpl mPreview;

Severity: Minor
Found in camerakit/src/main/base/com/wonderkiln/camerakit/CameraImpl.java - About 2 hrs to fix

Method obtainAttributes has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void obtainAttributes(Context context, AttributeSet attrs) {
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CameraKitView);
        mAdjustViewBounds = a.getBoolean(R.styleable.CameraKitView_android_adjustViewBounds, false);
        mAspectRatio = a.getFloat(R.styleable.CameraKitView_camera_aspectRatio, -1f);

Severity: Major
Found in camerakit/src/main/java/com/camerakit/CameraKitView.java - About 2 hrs to fix

File Camera2.kt has 272 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.camerakit.api.camera2

import android.content.Context
import android.content.Context.CAMERA_SERVICE
import android.graphics.ImageFormat
Severity: Minor
Found in camerakit/src/main/java/com/camerakit/api/camera2/Camera2.kt - About 2 hrs to fix

MainActivity has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

public class MainActivity extends AppCompatActivity implements Toolbar.OnMenuItemClickListener {

    private CameraKitView cameraView;
    private Toolbar toolbar;

Severity: Minor
Found in app/src/main/java/com/camerakit/app/MainActivity.java - About 2 hrs to fix

Method setFocusArea has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    void setFocusArea(float x, float y) {
        synchronized (mCameraLock) {
            if (mCamera != null) {
                Camera.Parameters parameters = getCameraParameters();
Severity: Minor
Found in camerakit/src/main/api16/com/wonderkiln/camerakit/Camera1.java - About 2 hrs 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 onCreate has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

Severity: Major
Found in app/src/main/java/com/camerakit/app/MainActivity.java - About 2 hrs to fix

Method adjustCameraParameters has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void adjustCameraParameters(int currentTry) {
        boolean haveToReadjust = false;
        Camera.Parameters resolutionLess = mCamera.getParameters();

        if (getPreviewResolution() != null) {
Severity: Major
Found in camerakit/src/main/api16/com/wonderkiln/camerakit/Camera1.java - About 2 hrs to fix

Method captureImage has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    void captureImage(final ImageCapturedCallback callback) {
        switch (mMethod) {
            case METHOD_STANDARD:
                synchronized (mCameraLock) {
Severity: Major
Found in camerakit/src/main/api16/com/wonderkiln/camerakit/Camera1.java - About 2 hrs to fix

Method onMeasure has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        if (mAdjustViewBounds) {
            ViewGroup.LayoutParams layoutParams = getLayoutParams();
            if (layoutParams.width == WRAP_CONTENT && layoutParams.height == WRAP_CONTENT) {
Severity: Minor
Found in camerakit/src/main/java/com/camerakit/CameraKitView.java - About 2 hrs 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