FrenchYeti/dexcalibur

View on GitHub
src/SmaliParser.js

Summary

Maintainability
F
1 wk
Test Coverage

Function method has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
Open

    method(src, raw_src, src_line){
        if(this.state != SML_METH) return null;
        
        let sml=src, hdl=null, catchStmt=null, tmp=null;

Severity: Minor
Found in src/SmaliParser.js - About 1 day 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 SmaliParser.js has 555 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const _fs_ = require('fs');
const _es_ = require('event-stream');


var ut = require("./Utils.js"); 
Severity: Major
Found in src/SmaliParser.js - About 1 day to fix

    Function method has 199 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        method(src, raw_src, src_line){
            if(this.state != SML_METH) return null;
            
            let sml=src, hdl=null, catchStmt=null, tmp=null;
    
    
    Severity: Major
    Found in src/SmaliParser.js - About 7 hrs to fix

      Function modifier has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          modifier(src){
              if(src instanceof String) src=src.split(LEX.TOKEN.SPACE);
              let mod = new Accessor.AccessFlags() , next=true;
      
              //if(src.length<2) return ERR_PARSE;
      Severity: Major
      Found in src/SmaliParser.js - About 2 hrs to fix

        Function parse has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            parse(src){
                let ls=src.split(EOL), ln=null, sml=null, obj=null;
            
                //console.log(ls);
                for(let l=0; l<ls.length; l++){
        Severity: Major
        Found in src/SmaliParser.js - About 2 hrs to fix

          Function parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              parse(src){
                  let ls=src.split(EOL), ln=null, sml=null, obj=null;
              
                  //console.log(ls);
                  for(let l=0; l<ls.length; l++){
          Severity: Minor
          Found in src/SmaliParser.js - About 1 hr 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 type has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              type(src){
                  let i=0,l=-1,types=[],s=src,fqn=null,isArray=false;
          
                  while(i<src.length){
                      if(src[i]==LEX.TOKEN.ARRAY){
          Severity: Minor
          Found in src/SmaliParser.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                else if(this.__tmp_block.stack.length>0){
                                    this.__tmp_meth.appendBlock(this.__tmp_block, this.__appendBlock_callback);
                                    this.__tmp_block = new CLASS.BasicBlock();
                                    this.__tmp_block.setAsGotoBlock(sml[0].split('_')[1]);
                                }
            Severity: Major
            Found in src/SmaliParser.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if(this.__tmp_block.width!=null){
                                          this.__tmp_meth.appendBlock(this.__tmp_block, this.__appendBlock_callback);
                                          this.__tmp_block = new CLASS.BasicBlock();
                                          this.__tmp_block.setAsGotoBlock(sml[0].split('_')[1]);
                                      }else{
              Severity: Major
              Found in src/SmaliParser.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                else if(sml[0].indexOf(':try_end')>-1){
                                    this.__tmp_block.setTryEndName(sml[0]);
                
                                    if(this.__tmp_block != null){
                                        this.__tmp_meth.appendBlock(this.__tmp_block, this.__appendBlock_callback);
                Severity: Major
                Found in src/SmaliParser.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if(this.__tmp_block instanceof CLASS.DataBlock || this.__tmp_block.stack.length>0){
                                          this.__tmp_meth.appendBlock(this.__tmp_block, this.__appendBlock_callback);
                                          this.__tmp_block = new CLASS.BasicBlock();
                                      }
                  Severity: Major
                  Found in src/SmaliParser.js - About 45 mins to fix

                    Function makeFnHashcode has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        makeFnHashcode: function(modif,cls,name,args,ret){
                    Severity: Minor
                    Found in src/SmaliParser.js - About 35 mins to fix

                      Function type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          type(src){
                              let i=0,l=-1,types=[],s=src,fqn=null,isArray=false;
                      
                              while(i<src.length){
                                  if(src[i]==LEX.TOKEN.ARRAY){
                      Severity: Minor
                      Found in src/SmaliParser.js - About 35 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

                      Function modifier has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          modifier(src){
                              if(src instanceof String) src=src.split(LEX.TOKEN.SPACE);
                              let mod = new Accessor.AccessFlags() , next=true;
                      
                              //if(src.length<2) return ERR_PARSE;
                      Severity: Minor
                      Found in src/SmaliParser.js - 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

                      Function annotation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          annotation(src){
                              if(this.state != SML_ANNO) return null;
                      
                              let sml=[], hdl=null;
                      
                      
                      Severity: Minor
                      Found in src/SmaliParser.js - 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

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

                                      else if(sml[0].indexOf(LEX.LABEL.SSWITCH)==0){
                      
                                          if(this.__tmp_block != null
                                              && (this.__tmp_block instanceof CLASS.DataBlock 
                                                  || this.__tmp_block.stack.length > 0)){
                      Severity: Major
                      Found in src/SmaliParser.js and 1 other location - About 3 hrs to fix
                      src/SmaliParser.js on lines 608..675

                      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 116.

                      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

                                      else if(sml[0].indexOf(':catchall')>-1){
                      
                                          if(this.__tmp_block != null 
                                              && ( this.__tmp_block instanceof CLASS.DataBlock 
                                                  || this.__tmp_block.stack.length > 0 )){
                      Severity: Major
                      Found in src/SmaliParser.js and 1 other location - About 3 hrs to fix
                      src/SmaliParser.js on lines 543..675

                      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 116.

                      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(this.__tmp_block instanceof CLASS.DataBlock || this.__tmp_block.stack.length>0){
                                              this.__tmp_meth.appendBlock(this.__tmp_block, this.__appendBlock_callback);
                                              this.__tmp_block = new CLASS.BasicBlock();
                                          }
                      Severity: Major
                      Found in src/SmaliParser.js and 1 other location - About 1 hr to fix
                      src/SmaliParser.js on lines 506..509

                      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 83.

                      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(this.__tmp_block instanceof CLASS.DataBlock || this.__tmp_block.stack.length>0){
                                              this.__tmp_meth.appendBlock(this.__tmp_block, this.__appendBlock_callback);
                                              this.__tmp_block = new CLASS.BasicBlock();
                                          }
                      Severity: Major
                      Found in src/SmaliParser.js and 1 other location - About 1 hr to fix
                      src/SmaliParser.js on lines 470..473

                      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 83.

                      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

                                          else if(this.__tmp_block.stack.length>0){
                                              this.__tmp_meth.appendBlock(this.__tmp_block, this.__appendBlock_callback);
                                              this.__tmp_block = new CLASS.BasicBlock();
                                              this.__tmp_block.setAsGotoBlock(sml[0].split('_')[1]);
                                          }
                      Severity: Major
                      Found in src/SmaliParser.js and 1 other location - About 1 hr to fix
                      src/SmaliParser.js on lines 480..491

                      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 77.

                      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

                                              if(this.__tmp_block.width!=null){
                                                  this.__tmp_meth.appendBlock(this.__tmp_block, this.__appendBlock_callback);
                                                  this.__tmp_block = new CLASS.BasicBlock();
                                                  this.__tmp_block.setAsGotoBlock(sml[0].split('_')[1]);
                                              }else{
                      Severity: Major
                      Found in src/SmaliParser.js and 1 other location - About 1 hr to fix
                      src/SmaliParser.js on lines 493..501

                      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 77.

                      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

                      There are no issues that match your filters.

                      Category
                      Status