540co/epa-rfi-backend

View on GitHub

Showing 12 of 26 total issues

Function EpaRepository has 202 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function EpaRepository(client, Transformer){

  var _index = 'epa-release';
  var _type = 'records';
  var self = this;
Severity: Major
Found in src/Epa/EpaRepository.js - About 1 day to fix

    Function exports has 155 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(Transformer){
    
      var TriTransformer = new Transformer(function(model){
    
        for(var x in model){
    Severity: Major
    Found in src/Epa/TriTransformer.js - About 6 hrs to fix

      Function TriTransformer has 152 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var TriTransformer = new Transformer(function(model){
      
          for(var x in model){
            if(model[x] == ""){
              model[x] = null;
      Severity: Major
      Found in src/Epa/TriTransformer.js - About 6 hrs to fix

        Function exports has 131 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(app, Responder, Repo, DotObjectTransformer){
        
          function getFields(req){
            return req.query.fields ? req.query.fields.split(',') : [];
          }
        Severity: Major
        Found in src/Epa/routes.js - About 5 hrs to fix

          Function exports has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = function(Transformer){
          
            var TriTransformer = new Transformer(function(model){
          
              for(var x in model){
          Severity: Minor
          Found in src/Epa/TriTransformer.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 getFacilities has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            this.getFacilities = function(options, callback){
              var fields = [];
          
              if(options.fields){
                  options.fields.forEach(function(field){
          Severity: Major
          Found in src/Epa/EpaRepository.js - About 2 hrs to fix

            Function EpaServiceProvider has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function EpaServiceProvider(){
            
              var _register = function(Container){
                _registerElasticClient(Container);
                _registerConverter(Container);
            Severity: Major
            Found in src/Epa/EpaServiceProvider.js - About 2 hrs to fix

              Function FieldLimitingInterceptor has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var FieldLimitingInterceptor = interceptor(function(req, res){
                return {
                  // Only JSON responses will be intercepted
                  isInterceptable: function(){
                    var isJson = /application\/json/.test(res.get('Content-Type'));
              Severity: Minor
              Found in src/Middleware/FieldLimiting.js - About 1 hr to fix

                Function FieldLimitingInterceptor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                var FieldLimitingInterceptor = interceptor(function(req, res){
                  return {
                    // Only JSON responses will be intercepted
                    isInterceptable: function(){
                      var isJson = /application\/json/.test(res.get('Content-Type'));
                Severity: Minor
                Found in src/Middleware/FieldLimiting.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 EpaRepository has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                function EpaRepository(client, Transformer){
                
                  var _index = 'epa-release';
                  var _type = 'records';
                  var self = this;
                Severity: Minor
                Found in src/Epa/EpaRepository.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 _createQuery has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  var _createQuery = function(groupBy, oper, fields, filters){
                    var obj = {};
                
                    // If summing
                    if(oper == 'sum' || oper == 'avg'){
                Severity: Minor
                Found in src/Epa/EpaRepository.js - About 1 hr to fix

                  Function intercept has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      intercept: function(body, send) {
                        var json = JSON.parse(body);
                  
                        if(! json.hasOwnProperty('data')){
                          send(body);
                  Severity: Minor
                  Found in src/Middleware/FieldLimiting.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language