jstacoder/flask-tasks

View on GitHub

Showing 50 of 50 total issues

Function ProjListCtrl has 247 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ProjListCtrl(project,$rootScope,$scope,updateTask,$q,$timeout,$modal,addTaskToProject,deleteTask,socket,p){
    var self = this,
        channel = p.subscribe('task_event');


Severity: Major
Found in flask_tasks/static/js/app/projects/list.js - About 1 day to fix

    File app.js has 439 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    var app = window.angular.module('app',[
            'ngRoute','ipCookie','ngResource','app.socket',
            'ui.bootstrap','app.routes','app.projects',
    Severity: Minor
    Found in flask_tasks/static/js/app.js - About 6 hrs to fix

      Function TaskCtrl has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function TaskCtrl(project,task,activeTasks,$routeParams,$route,$location,$window,$interpolate,$scope){
          var self = this,
              projectUrlFunc = $interpolate('/app/project/{{ pid }}'),
              changeFunc = $interpolate('/app/project/{{ pid }}/{{ tid }}');
      
      
      Severity: Major
      Found in flask_tasks/static/js/app/projects.js - About 4 hrs to fix

        File list.js has 328 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* global angular,getProjFromRoot */
        var app = angular.module('app.projects.list',[]);
        
        app.controller('ProjListCtrl',ProjListCtrl)
           .factory('updateTask',updateTask)
        Severity: Minor
        Found in flask_tasks/static/js/app/projects/list.js - About 3 hrs to fix

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

              def test_delete_task_success(self):
                  data = dict(item_id=2)
                  res = self.client.post('/api/v1/tasks/delete',data=data).data
                  want = json.loads(json.dumps(DELETE_TASK_SUCCESS_API_RESPONSE))
                  self.assertEquals(json.loads(res),want)
          Severity: Major
          Found in tests.py and 1 other location - About 3 hrs to fix
          tests.py on lines 175..179

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

          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

              def test_delete_task_not_found(self):
                  data = dict(item_id=5555)
                  res = self.client.post('/api/v1/tasks/delete',data=data).data
                  want = json.loads(json.dumps(DELETE_TASK_NOT_FOUND_API_RESPONSE))
                  self.assertEquals(json.loads(res),want)
          Severity: Major
          Found in tests.py and 1 other location - About 3 hrs to fix
          tests.py on lines 169..173

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

          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

          TestTaskApiTestCase has 27 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class TestTaskApiTestCase(BaseCase):
              maxDiff = None
          
              def url_for(self,*args,**kwargs):
                  rtn = ''
          Severity: Minor
          Found in tests.py - About 3 hrs to fix

            Function post has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                def post(self):
                    default_result = jsonify(success=False,error='there was an error')
                    updated = False
                    result = None
                    self._process_post()
            Severity: Minor
            Found in flask_tasks/tasks/api/views.py - 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

            Function mainTest has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                mainTest = function(){ /*var document = require('jsdom').jsdom('<html><head></head><body></body></html>'), window = document.defaultView; require('angular'); require('./socket.io.js'); window.io = require('socket.io-client');*/
                require('./flask_tasks/static/js/app.js'); 
                require('./flask_tasks/static/js/app/projects.js'); 
                require('./flask_tasks/static/js/app/tasks.js');
                require('./flask_tasks/static/js/app/routes.js');
            Severity: Major
            Found in jstests.js - About 2 hrs to fix

              Function routeConfigFn has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function routeConfigFn($routeProvider,$locationProvider){
                  $routeProvider.when('/app',{
                      templateUrl:'/static/partials/home.html',
                      resolve:{
                          projects:['projectManager',function(projectManager){
              Severity: Major
              Found in flask_tasks/static/js/app/routes.js - About 2 hrs to fix

                Function bsCheckBox has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function bsCheckBox(){
                    return {
                        restrict:"A",
                        require:"?^ngModel",
                        link:bsCheckBoxLinkFn,
                Severity: Major
                Found in flask_tasks/static/js/app.js - About 2 hrs to fix

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

                  app.factory('projectFactory',projectFactory)
                      .factory('getProject',getProject)
                      .factory('getActiveProjects',getActiveProjects)
                      .factory('sortByPriority',sortByPriority)
                      .factory('completeTask',completeTask)
                  Severity: Major
                  Found in flask_tasks/static/js/app/projects.js and 1 other location - About 2 hrs to fix
                  flask_tasks/static/js/app.js on lines 154..162

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

                  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

                          angular.forEach(self.project.tasks,function(itm){
                              if(!itm.complete){
                                  active.push(itm);
                                  if(parseInt(id)==itm.id){
                                      idx = active.length-1;
                  Severity: Major
                  Found in flask_tasks/static/js/app/projects.js and 1 other location - About 2 hrs to fix
                  flask_tasks/static/js/app/projects.js on lines 89..96

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

                  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

                          angular.forEach(self.project.tasks,function(itm){
                              if(!itm.complete){
                                  active.push(itm);
                                  if(parseInt(id)==itm.id){
                                      idx = active.length-1;
                  Severity: Major
                  Found in flask_tasks/static/js/app/projects.js and 1 other location - About 2 hrs to fix
                  flask_tasks/static/js/app/projects.js on lines 76..83

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

                  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

                  app.controller('MainCtrl',MainCtrl)
                     .directive('closingAlert',closingAlert)
                     .directive('hoverColor',hoverColor)
                     .directive('bsPanel',bsPanel)
                     .directive('bsAlert',bsAlert)
                  Severity: Major
                  Found in flask_tasks/static/js/app.js and 1 other location - About 2 hrs to fix
                  flask_tasks/static/js/app/projects.js on lines 5..13

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

                  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 ProjListCtrl has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function ProjListCtrl(project,$rootScope,$scope,updateTask,$q,$timeout,$modal,addTaskToProject,deleteTask,socket,p){
                      var self = this,
                          channel = p.subscribe('task_event');
                  
                  
                  
                  Severity: Minor
                  Found in flask_tasks/static/js/app/projects/list.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

                  File projects.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  'use strict';
                  
                  var app = angular.module('app.projects',[]);
                  
                  app.factory('projectFactory',projectFactory)
                  Severity: Minor
                  Found in flask_tasks/static/js/app/projects.js - About 2 hrs to fix

                    Function AddProjCtrl has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function AddProjCtrl(projects,deleteProject,removeProjectFromRoot,addProjectToRoot,addProject,$modal,$scope,projectPage){
                        var self = this;
                        self.projects = projects;
                        self.project = {};
                    
                    
                    Severity: Major
                    Found in flask_tasks/static/js/app/projects/add.js - About 2 hrs to fix

                      Function bsCheckBoxLinkFn has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function bsCheckBoxLinkFn(scope,ele,attrs,ctrl){
                                  console.log(arguments);
                                  var cls = ele.attr('class'),
                                      newEl = angular.element(document.createElement('span'))
                                                 .addClass('fa')
                      Severity: Major
                      Found in flask_tasks/static/js/app.js - About 2 hrs to fix

                        Function ProjCtrl has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function ProjCtrl(project,$location,$interpolate,sortByPriority,completeTask,$window,$q,$rootScope){
                            var self = this,
                                urlFunc = $interpolate('/app/project/{{ pid }}/{{ tid }}');
                        
                            self.project = project;
                        Severity: Major
                        Found in flask_tasks/static/js/app/projects.js - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language