FrenchYeti/dexcalibur

View on GitHub
src/AdbWrapper.js

Summary

Maintainability
D
2 days
Test Coverage

Function parseDeviceList has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    async parseDeviceList( pDeviceListStr){
        let dev = [], ret=null,re=null, data=null, id=null, device=null, token=null;
        let bridge = null;

        Logger.debug(pDeviceListStr);
Severity: Minor
Found in src/AdbWrapper.js - About 4 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

File AdbWrapper.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const Process = require("child_process");
const _path_ = require('path');

const UT = require("./Utils.js");
const Device = require("./Device.js");
Severity: Minor
Found in src/AdbWrapper.js - About 4 hrs to fix

    Function parseDeviceList has 94 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        async parseDeviceList( pDeviceListStr){
            let dev = [], ret=null,re=null, data=null, id=null, device=null, token=null;
            let bridge = null;
    
            Logger.debug(pDeviceListStr);
    Severity: Major
    Found in src/AdbWrapper.js - About 3 hrs to fix

      AdbWrapper has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class AdbWrapper
      {
          static USB_TRANSPORT = 'U';
          static TCP_TRANSPORT = 'T';
          
      Severity: Minor
      Found in src/AdbWrapper.js - About 3 hrs to fix

        Function setup has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            setup(pDeviceID = null, pReturnString =  true){
                let cmd=null;
        
                if(pReturnString)
                    cmd = this.path;
        Severity: Minor
        Found in src/AdbWrapper.js - 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

        Function parsePackageList has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            parsePackageList( pPackageListStr, pOptions=''){
                var reg = new RegExp("^package:(?<apk_name>.*)");
                var packages = [];
        
                if(pPackageListStr.indexOf("error:")==0){
        Severity: Minor
        Found in src/AdbWrapper.js - About 1 hr to fix

          Function setup has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              setup(pDeviceID = null, pReturnString =  true){
                  let cmd=null;
          
                  if(pReturnString)
                      cmd = this.path;
          Severity: Minor
          Found in src/AdbWrapper.js - About 1 hr to fix

            Function toJsonObject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                toJsonObject( pExcludeList={}){
                    let o = new Object();
            
                    for(let i in this){
                        if(pExcludeList[i] === false) continue;
            Severity: Minor
            Found in src/AdbWrapper.js - 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

            There are no issues that match your filters.

            Category
            Status