Promact/slack-erp-custom-integration-mvc

View on GitHub

Showing 196 of 517 total issues

Method TaskMailDetailsReportTeamLeaderAsync has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        [Fact, Trait("Category", "Required")]
        public async Task TaskMailDetailsReportTeamLeaderAsync()
        {
            await CreateUserAndMockingHttpContextToReturnAccessToken();
            var userResponse = Task.FromResult(_stringConstant.UserDetailsFromOauthServer);
Severity: Minor
Found in Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs - About 1 hr to fix

    Method LeaveReportDetailsAsync has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public async Task <IEnumerable<LeaveReportDetails>> LeaveReportDetailsAsync(string employeeId)
            {
                //Get user details
                User user = await GetEmployeeByIdAsync(employeeId);
                List<LeaveReportDetails> leaveReportDetails = new List<LeaveReportDetails>();

      Method TaskMailDetailsForSelectedDateForTeamLeaderAsync has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              [Fact, Trait("Category", "Required")]
              public async Task TaskMailDetailsForSelectedDateForTeamLeaderAsync()
              {
                  await CreateUserAndMockingHttpContextToReturnAccessToken();
                  var userResponse = Task.FromResult(_stringConstant.UserDetailsFromOauthServer);
      Severity: Minor
      Found in Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs - About 1 hr to fix

        Method ConfigureMap has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public static IMapper ConfigureMap()
                {
                    MapperConfiguration config = new MapperConfiguration(cfg =>
                    {
                        cfg.CreateMap<SlackUserDetails, SlackUserDetailAc>();

          Method MarkLeaveAsync has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  private async Task<string> MarkLeaveAsync(List<User> users, int scrumId, string applicant, List<Question> questions, int projectId, string slackUserId, string applicantId)

            Method ProcessExpectedUserResultAsync has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    private async Task<string> ProcessExpectedUserResultAsync(User user, string applicantId, List<User> users, int projectId, string applicant, int scrumId, List<Question> questions)

              Method GetTaskMailReportAsync has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      private async Task<TaskMailReportAc> GetTaskMailReportAsync(string userId, string role, string userName, int taskId, DateTime createdOn, DateTime maxDate, DateTime minDate)

                Avoid deeply nested control flow statements.
                Open

                                            if (await CheckUserAsync(slackUserId, users, project.TeamLeaderId))
                                            {
                                                switch (scrumCommand)
                                                {
                                                    case ScrumActions.halt:

                  Avoid deeply nested control flow statements.
                  Open

                                              if (scrum != null)
                                              {
                                                  _logger.Info(scrum?.ScrumDate);
                                                  if (!scrum.IsHalted)
                                                      return scrum.IsOngoing ? ScrumStatus.OnGoing : ScrumStatus.Completed;

                    Avoid deeply nested control flow statements.
                    Open

                                                if (validDate)
                                                {
                                                    await _leaveRepository.UpdateLeaveAsync(leave);
                                                    _logger.Debug("UpdateSickLeaveAsync leave updated successfully");
                                                    replyText = string.Format(_stringConstant.ReplyTextForSickLeaveUpdate

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (project.TeamLeader.IsActive)
                                                  {
                                                      //command to link
                                                      if (String.Compare(command, _stringConstant.Link, StringComparison.OrdinalIgnoreCase) == 0)
                                                          return await LinkAsync(slackChannelId, givenProjectName, project);

                        Method GetTaskMailReport has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                private TaskMailReportAc GetTaskMailReport(string userId, string role, string userName, DateTime createdOn, DateTime maxDate, DateTime minDate)

                          Avoid deeply nested control flow statements.
                          Open

                                                      if (string.IsNullOrEmpty(status))
                                                      {
                                                          TemporaryScrumDetails temporaryScrumDetails = await FetchTemporaryScrumDetailsAsync(scrum.Id);
                                                          User user = users.First(x => x.SlackUserId == temporaryScrumDetails.SlackUserId);
                                                          if (temporaryScrumDetails.QuestionId != null)

                            Avoid deeply nested control flow statements.
                            Open

                                                            case ScrumStatus.OnGoing:
                                                                List<Question> questions = await _botQuestionRepository.GetQuestionsByTypeAsync(BotQuestionType.Scrum);
                                                                if (scrum != null)
                                                                    returnMessage = await GetReplyToUserAsync(users, project.Id, scrum.Id, slackUserId, slackUserName, questions);
                                                                else

                              Avoid deeply nested control flow statements.
                              Open

                                                              default:
                                                                  returnMessage = ReplyStatusofScrumToClient(scrumStatus);
                                                                  break;

                                Avoid deeply nested control flow statements.
                                Open

                                                            foreach (var channel in groups.Groups)
                                                            {
                                                                _logger.Info("Group:" + channel);
                                                                await AddChannelGroupAsync(channel);
                                                                _logger.Debug("Slack User Id  : " + (await _userManager.FindByEmailAsync(applicationUser.Email)).SlackUserId);

                                  Method AssignAnswersAsync has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                                  Open

                                          private async Task<EmployeeScrumDetails> AssignAnswersAsync(Scrum scrum, DateTime scrumDate, User user)
                                          {
                                              _logger.Debug("Assign Answers Async: " + scrumDate);
                                              EmployeeScrumDetails employeeScrumDetail = new EmployeeScrumDetails();
                                              //Fetch all the scrum answers for a particular employee

                                  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

                                  Avoid deeply nested control flow statements.
                                  Open

                                                                          if (newUser.Id != null)
                                                                          {
                                                                              // Method to check more than one leave cannot be applied on that date
                                                                              bool validDate = await LeaveDateDuplicate(newUser.Id, startDate, null);
                                                                              if (!validDate)

                                    Method ExpectedUserAsync has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                            private async Task<string> ExpectedUserAsync(int scrumId, List<Question> questions, List<User> users, string applicant, string applicantId, int projectId)

                                      Method GetTaskReportAsync has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                              private async Task<TaskMailReportAc> GetTaskReportAsync(string userId, string role, string userName, DateTime selectedDate, DateTime maxDate, DateTime minDate)
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language