Promact/slack-erp-custom-integration-mvc

View on GitHub

Showing 196 of 517 total issues

Class TaskMailRepositoryTest has 42 methods (exceeds 20 allowed). Consider refactoring.
Open

    public class TaskMailRepositoryTest
    {
        #region Private Variables
        private readonly IComponentContext _componentContext;
        private readonly ITaskMailRepository _taskMailRepository;
Severity: Minor
Found in Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs - About 5 hrs to fix

    File RedmineRepository.cs has 401 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    using System;
    using System.Threading.Tasks;
    using Promact.Erp.DomainModel.ApplicationClass.SlackRequestAndResponse;
    using Promact.Erp.DomainModel.DataRepository;
    using Promact.Erp.DomainModel.Models;

      File TaskMailRepository.cs has 388 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      using Promact.Core.Repository.OauthCallsRepository;
      using Promact.Erp.DomainModel.Models;
      using System;
      using System.Threading.Tasks;
      using System.Linq;

        Method Initialize has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
        Open

        public virtual void Initialize()
        {
            if ((this.Errors.HasErrors == false))
            {
        bool FromDateValueAcquired = false;
        Severity: Minor
        Found in Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApplication.cs - 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

        Method Initialize has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
        Open

        public virtual void Initialize()
        {
            if ((this.Errors.HasErrors == false))
            {
        bool FromDateValueAcquired = false;

        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 Initialize has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
        Open

        public virtual void Initialize()
        {
            if ((this.Errors.HasErrors == false))
            {
        bool FromDateValueAcquired = false;

        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 ScrumAsync has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring.
        Open

                private async Task<string> ScrumAsync(int projectId, string slackUserName, string parameter, string slackUserId)
                {
                    //because any command outside the scrum time must not be entertained except with the replies like "scrum is concluded","scrum has not started" or "scrum has not started".
                    Scrum scrum = await GetScrumAsync(projectId);
                    ScrumActions scrumCommand = (ScrumActions)Enum.Parse(typeof(ScrumActions), parameter);

        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 ScrumSetUpRepositoryTest.cs has 342 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        using Autofac;
        using Moq;
        using Promact.Core.Repository.BotQuestionRepository;
        using Promact.Erp.DomainModel.Models;
        using System;
        Severity: Minor
        Found in Slack.Automation/Promact.Core.Test/ScrumSetUpRepositoryTest.cs - About 4 hrs to fix

          Method Initialize has 103 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          public virtual void Initialize()
          {
              if ((this.Errors.HasErrors == false))
              {
          bool FromDateValueAcquired = false;

            Method Initialize has 103 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            public virtual void Initialize()
            {
                if ((this.Errors.HasErrors == false))
                {
            bool FromDateValueAcquired = false;

              Method Initialize has 103 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              public virtual void Initialize()
              {
                  if ((this.Errors.HasErrors == false))
                  {
              bool FromDateValueAcquired = false;
              Severity: Major
              Found in Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApplication.cs - About 4 hrs to fix

                Method GetQuestionAsync has a Cognitive Complexity of 43 (exceeds 20 allowed). Consider refactoring.
                Open

                        private async Task<string> GetQuestionAsync(int scrumId, List<Question> questions, List<User> users, int projectId)
                        {
                            List<ScrumAnswer> scrumAnswers = _scrumAnswerDataRepository.FetchAsync(x => x.ScrumId == scrumId).Result.ToList();
                            User user = new User();
                            TemporaryScrumDetails temporaryScrumDetails = await FetchTemporaryScrumDetailsAsync(scrumId);

                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 TaskMail.cs has 329 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                namespace Promact.Erp.Util.Email_Templates
                {
                    using System.Linq;
                    using System.Text;
                    using System.Collections.Generic;
                Severity: Minor
                Found in Slack.Automation/Promact.Erp.Util/Email Templates/TaskMail.cs - About 3 hrs to fix

                  Method Initialize has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public void Initialize()
                          {
                              user.Id = _stringConstant.StringIdForTest;
                              user.Email = _stringConstant.EmailForTest;
                              user.FirstName = _stringConstant.FirstNameForTest;
                  Severity: Major
                  Found in Slack.Automation/Promact.Core.Test/SlackRepositoryTest.cs - About 3 hrs to fix

                    Method SlackRequestAsync has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public async Task SlackRequestAsync(SlashCommand slashCommand)
                            {
                                // Way to break string by spaces only if spaces are not between quotes
                                var text = _attachmentRepository.SlackText(slashCommand.Text);
                                // Get user details from SlackUserId

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

                          public class ScrumBotRepository : RepositoryBase, IScrumBotRepository
                          {
                      
                              #region Private Variable 
                      
                      

                        File OauthCallsRepositoryTest.cs has 302 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        using Autofac;
                        using Microsoft.AspNet.Identity;
                        using Moq;
                        using Promact.Core.Repository.OauthCallsRepository;
                        using Promact.Core.Repository.ServiceRepository;
                        Severity: Minor
                        Found in Slack.Automation/Promact.Core.Test/OauthCallsRepositoryTest.cs - About 3 hrs to fix

                          Method AddSlackUserInformationAsync has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  public async Task AddSlackUserInformationAsync(string code)
                                  {
                                      string slackOAuthRequest = string.Format(_stringConstant.SlackOauthRequestUrl, _envVariableRepository.SlackOAuthClientId, _envVariableRepository.SlackOAuthClientSecret, code);
                                      string slackOAuthResponse = await _httpClientService.GetAsync(_stringConstant.OAuthAcessUrl, slackOAuthRequest, null, _stringConstant.Bearer);
                                      SlackOAuthResponse slackOAuth = JsonConvert.DeserializeObject<SlackOAuthResponse>(slackOAuthResponse);

                            Method TransformText has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    public virtual string TransformText()
                                    {
                                        this.Write("\n");
                                        this.Write("\n");
                                        this.Write("\n");
                            Severity: Major
                            Found in Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApplication.cs - About 3 hrs to fix

                              Method LeaveDateDuplicate has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                              Open

                                      private async Task<bool> LeaveDateDuplicate(string userId, DateTime startDate, DateTime? endDate)
                                      {
                                          int valid = -1;
                                          bool validIndicator = false;
                                          LeaveRequest lastLeave = new LeaveRequest();

                              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