CoditEU/lunchorder

View on GitHub

Showing 63 of 149 total issues

Method AddBiteMeMenu has 1163 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        [Test]
        public async Task AddBiteMeMenu()
        {
            var menuVendor = new MenuVendor
            {

    File DocumentDbRepositoryTest.cs has 1840 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;
    using System.Threading.Tasks;

      Method AddMenu has 344 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              [Test]
              public async Task AddMenu()
              {
                  var menuVendor = new MenuVendor
                  {

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

        function updateUserBalance(userBalanceAudit) {
        
            var context = getContext();
            var collection = context.getCollection();
        
        

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

        function addUserOrder(vendorOrderId, docDbVendorOrderHistoryEntries, docDbUserOrderHistory, lastOrder) {
            if (!docDbVendorOrderHistoryEntries || !docDbVendorOrderHistoryEntries.length) {
                throw new Error('There are no entries to insert');
            }
        
        
        Severity: Minor
        Found in backend/WebApi/Lunchorder.Dal/Seed/Stored Procedures/addUserOrder.js - About 5 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 BadgeService.cs has 370 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        using System;
        using System.Collections.Generic;
        using System.Linq;
        using AutoMapper;
        using Lunchorder.Common.Interfaces;
        Severity: Minor
        Found in backend/WebApi/Lunchorder.Api/Infrastructure/Services/BadgeService.cs - About 4 hrs to fix

          Method CalculateStatistics has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
          Open

                  [Test]
                  public async Task CalculateStatistics()
                  {
                      // todo loop all users.
                      var allUsersQuery = DocumentDbBase.DocumentStore.GetItems<ApplicationUser>(x => x.Type == DocumentDbType.User);

          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

          Method CreateVendorHistory has 104 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public static string CreateVendorHistory(IConfigurationService configurationService, VendorOrderHistory vendorOrderHistory)
                  {
                      using (var stringWriter = new StringWriter())
                      {
                          using (HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter))
          Severity: Major
          Found in backend/WebApi/Lunchorder.Common/HtmlHelper.cs - About 4 hrs to fix

            Function updateUserBalance has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

            function updateUserBalance(platformUserList) {
            
                var context = getContext();
                var collection = context.getCollection();
            
            
            Severity: Minor
            Found in backend/WebApi/Lunchorder.Dal/Seed/Stored Procedures/addToUserList.js - About 4 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 deserialize has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                    deserialize(input: any): Menu {
                            if (!input) return;
            
                            this.id = input.id;
                            this.enabled = input.enabled;
            Severity: Minor
            Found in frontend/src/app/domain/dto/menu.ts - 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

            Class AuthorizationControllerTestBase has 28 methods (exceeds 20 allowed). Consider refactoring.
            Open

                public class AuthorizationControllerTestBase : ControllerTestBase
                {
                    public async Task<TokenResponse> AuthorizeUser(string username, string password)
                    {
                        var httpContent = AuthorizeHttpContentRequest(username, password);

              Method CalculateStatistics has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      [Test]
                      public async Task CalculateStatistics()
                      {
                          // todo loop all users.
                          var allUsersQuery = DocumentDbBase.DocumentStore.GetItems<ApplicationUser>(x => x.Type == DocumentDbType.User);

                Function addUserOrder has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function addUserOrder(vendorOrderId, docDbVendorOrderHistoryEntries, docDbUserOrderHistory, lastOrder) {
                    if (!docDbVendorOrderHistoryEntries || !docDbVendorOrderHistoryEntries.length) {
                        throw new Error('There are no entries to insert');
                    }
                
                
                Severity: Major
                Found in backend/WebApi/Lunchorder.Dal/Seed/Stored Procedures/addUserOrder.js - About 3 hrs to fix

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

                  function migrateUsers() {
                  
                      var context = getContext();
                      var collection = context.getCollection();
                  
                  
                  Severity: Minor
                  Found in backend/WebApi/Lunchorder.Dal/Seed/Stored Procedures/migrateUsers.js - 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 bulkDeleteSproc has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function bulkDeleteSproc(query) {
                      var collection = getContext().getCollection();
                      var collectionLink = collection.getSelfLink();
                      var response = getContext().getResponse();
                      var responseBody = {

                  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 updateUserBalance has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function updateUserBalance(userBalanceAudit) {
                  
                      var context = getContext();
                      var collection = context.getCollection();
                  
                  

                    Class DocumentDbRepository has 24 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        public class DocumentDbRepository : IDatabaseRepository
                        {
                            private readonly IDocumentStore _documentStore;
                            private readonly IMapper _mapper;
                    
                    
                    Severity: Minor
                    Found in backend/WebApi/Lunchorder.Dal/DocumentDbRepository.cs - About 2 hrs to fix

                      Function updateUserPicture has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function updateUserPicture(userId, userPictureUrl) {
                      
                          var context = getContext();
                          var collection = context.getCollection();
                      
                      

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

                      function upgradeUserHistory() {
                      
                          var context = getContext();
                          var collection = context.getCollection();
                      
                      

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

                      function updateUserBalance(vendorOrderHistoryId) {
                      
                          var context = getContext();
                          var collection = context.getCollection();
                      
                      

                      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