FrenchYeti/dexcalibur

View on GitHub

Showing 948 of 948 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        this.app.route('/api/field/:id')
            .get(function (req, res) {
                // collect
                let dev = {};
                let sign = UT.decodeURI(UT.b64_decode(req.params.id));
Severity: Major
Found in src/WebServer.js and 1 other location - About 7 hrs to fix
src/WebServer.js on lines 1620..1668

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 203.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        this.app.route('/api/method/:id')
            .get(function (req, res) {
                // collect
                let dev = {};
                let callers = [];
Severity: Major
Found in src/WebServer.js and 1 other location - About 7 hrs to fix
src/WebServer.js on lines 1928..1964

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 203.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function runDecompile has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

    runDecompile(pTree, pSource=[], pDepth=0, pStop=false, pClose=false){
        let cont = true, source=pSource, res={ depth:0 }, succ=null, pred=[], d=null, tmp=null;
        let next = [], ifelse=false;
        
        console.log(this.dump(pTree));
Severity: Minor
Found in src/Decompiler.js - About 7 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

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                case OPCODE.IF_GE.byte:                
                    regX = this.getRegisterName(oper.left[0]);
                    regV = this.getRegisterName(oper.left[1]);

                    if(this.simplify>0){
Severity: Major
Found in src/Decompiler.js and 3 other locations - About 7 hrs to fix
src/Decompiler.js on lines 1404..1416
src/Decompiler.js on lines 1417..1429
src/Decompiler.js on lines 1443..1455

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 200.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                case OPCODE.IF_GT.byte:                
                    regX = this.getRegisterName(oper.left[0]);
                    regV = this.getRegisterName(oper.left[1]);

                    if(this.simplify>0){
Severity: Major
Found in src/Decompiler.js and 3 other locations - About 7 hrs to fix
src/Decompiler.js on lines 1404..1416
src/Decompiler.js on lines 1417..1429
src/Decompiler.js on lines 1430..1442

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 200.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                case OPCODE.IF_LT.byte:                
                    regX = this.getRegisterName(oper.left[0]);
                    regV = this.getRegisterName(oper.left[1]);

                    if(this.simplify>0){
Severity: Major
Found in src/Decompiler.js and 3 other locations - About 7 hrs to fix
src/Decompiler.js on lines 1404..1416
src/Decompiler.js on lines 1430..1442
src/Decompiler.js on lines 1443..1455

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 200.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                case OPCODE.IF_NE.byte:                
                    regX = this.getRegisterName(oper.left[0]);
                    regV = this.getRegisterName(oper.left[1]);

                    if(this.simplify>0){
Severity: Major
Found in src/Decompiler.js and 3 other locations - About 7 hrs to fix
src/Decompiler.js on lines 1417..1429
src/Decompiler.js on lines 1430..1442
src/Decompiler.js on lines 1443..1455

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 200.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Class.prototype.toJsonObject = function(filter){
    let obj = new Object(), m=null;
    for(let i in this){
        if(["_","$"].indexOf(i[0])==-1 
            && (typeof this[i] != 'array')
Severity: Minor
Found in src/CoreClass.js - About 7 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 main.js has 459 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const IFC = require("../../../src/InspectorFrontController.js");
var CONST = require("../../../src/CoreConst.js");
const Disassembler = require("../../../src/Disassembler.js");

var Controller =  new IFC.FrontController();
Severity: Minor
Found in inspectors/BytecodeCleaner/service/main.js - About 7 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if(pFields !== null){
                for(let i in pFields){
                    if(typeof this[pFields[i]] == "object"){
                        o[pFields[i]] = this[pFields[i]].toJsonObject();
                    }else{
    Severity: Major
    Found in src/ModelPackage.js and 1 other location - About 7 hrs to fix
    src/CoreClass.js on lines 403..418

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 195.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        if(fields !== null){
            for(let i in fields){
                if(typeof this[fields[i]] == "object"){
                    o[fields[i]] = this[fields[i]].toJsonObject();
                }else{
    Severity: Major
    Found in src/CoreClass.js and 1 other location - About 7 hrs to fix
    src/ModelPackage.js on lines 145..160

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 195.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function import has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        import(pData){
            let index = null, o=null, hook=null, qflag=0;
    
            if(pData.classes.size > 0){
                index = this._db.getIndex("classes");
    Severity: Minor
    Found in inspectors/Saver/SaveManager.js - About 6 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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        rem(pValue, pType, pOption=null){
            switch(pType){
                case OPCODE.REM_LONG_2ADDR.byte:
                case OPCODE.REM_LONG.byte:
                    return ((this.value << 32) | (pOption & 0x00000000FFFFFFFF)) % pValue;
    Severity: Major
    Found in src/SmaliVM.js and 2 other locations - About 6 hrs to fix
    src/SmaliVM.js on lines 289..306
    src/SmaliVM.js on lines 345..361

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 192.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        div(pValue, pType, pOption=null){
            switch(pType){
                case OPCODE.DIV_LONG_2ADDR.byte:
                case OPCODE.DIV_LONG.byte:
                    return ((this.value << 32) | (pOption & 0x00000000FFFFFFFF)) / pValue;
    Severity: Major
    Found in src/SmaliVM.js and 2 other locations - About 6 hrs to fix
    src/SmaliVM.js on lines 289..306
    src/SmaliVM.js on lines 363..379

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 192.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        add(pValue, pType, pOption=null){
            switch(pType){
    
                case OPCODE.ADD_LONG_2ADDR.byte:
                case OPCODE.ADD_LONG.byte:
    Severity: Major
    Found in src/SmaliVM.js and 2 other locations - About 6 hrs to fix
    src/SmaliVM.js on lines 345..361
    src/SmaliVM.js on lines 363..379

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 192.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    BasicBlock has 49 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BasicBlock
    {
        /**
        * @param {Object} config Optional, an object wich can be used in order to initialize the instance 
        * @constructor
    Severity: Minor
    Found in src/CoreClass.js - About 6 hrs to fix

      File BinaryXmlParser.js has 450 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict';
      // Code extracted from https://github.com/openstf/adbkit-apkreader
      const debug = false;
      
      const NodeType = {
      Severity: Minor
      Found in src/libs/BinaryXmlParser.js - About 6 hrs to fix

        Function analyzeBlocks has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

            analyzeBlocks(pMethod){
                
                let blocks =  pMethod.getBasicBlocks();
        
                if(blocks.length == 0) return null;
        Severity: Minor
        Found in src/SmaliVM.js - About 6 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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                        for(let i=0; i<d.length; i++){
                            if(d[i].getException() != null)
                                this.pcmaker.push(`${"    ".repeat(this.depth-1)}}catch(${d[i].getException().name}) ${d[i].getTarget().getCatchLabel()}`);
                            else
                                this.pcmaker.push(`${"    ".repeat(this.depth-1)}}catchall ${d[i].getTarget().getCatchLabel()}`);
        Severity: Major
        Found in src/SmaliVM.js and 1 other location - About 6 hrs to fix
        src/SmaliVM.js on lines 2737..2742

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 190.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                                for(let i=0; i<d.length; i++){
                                    if(d[i].getException() != null)
                                        this.pcmaker.push(`${"    ".repeat(this.depth-1)}}catch(${d[i].getException().name}) ${d[i].getTarget().getCatchLabel()}`);
                                    else
                                        this.pcmaker.push(`${"    ".repeat(this.depth-1)}}catchall ${d[i].getTarget().getCatchLabel()}`);
        Severity: Major
        Found in src/SmaliVM.js and 1 other location - About 6 hrs to fix
        src/SmaliVM.js on lines 2771..2776

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 190.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language