salomax/livremarketplace

View on GitHub

Showing 43 of 1,450 total issues

Function detailFormatter has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                    detailFormatter : function(index, row, element) {

                            var table = $('<table>');
                            $(element).append(table);

Severity: Minor
Found in static/app/purchase/purchase.js - About 1 hr to fix

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

    def cash_flow(n):
        """ Get cash flow.
        """
    
        # Create dict for last 'n' months
    Severity: Minor
    Found in app/dashboard/models.py - 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 bindTable has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            bindTable: function(_data) {
    
                // Construir tabela
                $('table.table-customers').bootstrapTable({
                    uniqueId: 'id',
    Severity: Minor
    Found in static/app/customer/customer.js - About 1 hr to fix

      Function bindTable has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              bindTable: function(_data) {
      
                  // Construir tabela
                  $('table.table-suppliers').bootstrapTable({
                      uniqueId: 'id',
      Severity: Minor
      Found in static/app/supplier/supplier.js - About 1 hr to fix

        Function bindTrackCode has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $.fn.bindTrackCode = function() {
        
                // Get track code by tag attribute
                this.each(function(index, element) {
        
        
        Severity: Minor
        Found in static/app/postal/postal.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

          if (!attachEvent) {
              var requestFrame = (function(){
                var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame ||
                          function(fn){ return window.setTimeout(fn, 20); };
                return function(fn){ return raf(fn); };
          Severity: Critical
          Found in static/js/vendor.min.js - About 1 hr to fix

            Function request has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    request : function(options) {
            
                        // Create promise
                        var deferred = $.Deferred(function(def) {
            
            
            Severity: Minor
            Found in static/js/livremarketplace.js - About 1 hr to fix

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

              def save(purchase):
                  """ Add or update for purchase.
                  """
              
                  # Get parent
              Severity: Minor
              Found in app/purchase/models.py - About 1 hr to fix

                Function deferred has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            var deferred = $.Deferred(function(def) {
                
                                // fn success
                                var success = function(response) {
                
                
                Severity: Minor
                Found in static/js/livremarketplace.js - About 1 hr to fix

                  Function submitHandler has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                  submitHandler: function(form, event) {
                  
                                      // não submete form
                                      event.preventDefault();
                  
                  
                  Severity: Minor
                  Found in static/app/purchase/purchase.js - About 1 hr to fix

                    Function activate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        activate: function (toggleBtn) {
                          //Get the screen sizes
                          var screenSizes = $.AdminLTE.options.screenSizes;
                    
                          //Enable sidebar toggle
                    Severity: Minor
                    Found in static/js/vendor.min.js - About 1 hr to fix

                      Function populate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          $.fn.populate = function(data) {
                      
                              var _form = $(this);
                      
                              // Validate
                      Severity: Minor
                      Found in static/js/livremarketplace.js - About 1 hr to fix

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

                          $.AdminLTE.tree = function (menu) {
                            var _this = this;
                            var animationSpeed = $.AdminLTE.options.animationSpeed;
                            $(document).on('click', menu + ' li a', function (e) {
                              //Get the clicked link and the next element
                        Severity: Minor
                        Found in static/js/vendor.min.js - About 1 hr to fix

                          Function showCashFlowChart has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              var showCashFlowChart = function(count) {
                          
                                  $('#cash_flow-chart').html(LOADING);
                          
                                  // Carregar informações do fluxo de caixa a partir do 'n'
                          Severity: Minor
                          Found in static/app/dashboard/dashboard.js - About 1 hr to fix

                            Function which has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def which(name, flags=os.X_OK):
                                """Search PATH for executable files with the given name.
                                On newer versions of MS-Windows, the PATHEXT environment variable will be
                                set to the list of file extensions for files considered executable. This
                                will normally include things like ".EXE". This fuction will also find files
                            Severity: Minor
                            Found in app_test/test_utils.py - About 55 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 load_tests has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def load_tests(import_location):
                                """Loads all tests for modules and adds them to a single test suite.
                                Args:
                                  import_location: String; used to determine how the endpoints_proto_datastore
                                      package is imported.
                            Severity: Minor
                            Found in livremarketplace_test.py - About 55 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 tokenize_autocomplete has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def tokenize_autocomplete(phrase):
                                a = []
                                for word in phrase.split():
                                    j = 1
                                    while True:
                            Severity: Minor
                            Found in app/util.py - About 55 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 encomenda has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def encomenda(self,numero):
                                    # Usado como referencia o codigo do Guilherme Chapiewski
                                    # https://github.com/guilhermechapiewski/correios-api-py
                            
                                    url = 'http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_ITEMCODE=&P_LINGUA=001&P_TESTE=&P_TIPO=001&P_COD_UNI=%s' % (str(numero),)
                            Severity: Minor
                            Found in app/postal/correios.py - 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

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

                            def get_stats_by_products():
                                """ Get sales statistics
                                """
                            
                                # Get all sales
                            Severity: Minor
                            Found in app/sale/models.py - 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 report_products_by_customers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def report_products_by_customers():
                                """ List products grouped by its customers.
                                """
                            
                                # List all sales
                            Severity: Minor
                            Found in app/sale/models.py - 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

                            Severity
                            Category
                            Status
                            Source
                            Language