Promact/slack-erp-custom-integration-mvc

View on GitHub

Showing 196 of 517 total issues

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 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 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 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 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 (endDateConvertorResult && reJoinDateConvertorResult)
                                                        {
                                                            // Method to check leave's end date is not beyond start date and re-join date is not beyond end date
                                                            bool validDate = ValidDateTimeForLeave(startDate, endDate, reJoinDate);
                                                            if (validDate)

                  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 (await CheckUserAsync(slackUserId, users, project.TeamLeaderId))
                                              {
                                                  switch (scrumCommand)
                                                  {
                                                      case ScrumActions.halt:

                    Avoid deeply nested control flow statements.
                    Open

                                                        if (sendEmailConfirmationConvertResult)
                                                        {
                                                            taskDetails.SendEmailConfirmation = confirmation;
                                                            userAndTaskMailDetailsWithAccessToken.QuestionText = _stringConstant.ThankYou;
                                                            switch (confirmation)

                      Avoid deeply nested control flow statements.
                      Open

                                                      case ScrumStatus.Halted:
                                                          returnMessage = (scrumCommand == ScrumActions.resume ? _stringConstant.ScrumCannotBeResumed : string.Empty) + string.Format(_stringConstant.InActiveInOAuth, slackUserName);
                                                          break;

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

                                private async Task<List<TaskMailReportAc>> TaskMailsDetailAsync(string userId, string userName, string role, string createdOn, string loginId, DateTime selectedDate)

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

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

                            Avoid deeply nested control flow statements.
                            Open

                                                                if (taskMailHourConvertResult)
                                                                {
                                                                    decimal totalHourSpented = 0;
                                                                    // checking range of hours
                                                                    if (hour > 0 && hour <= Convert.ToInt32(_stringConstant.TaskMailMaximumTime))

                              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 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)

                                  Avoid deeply nested control flow statements.
                                  Open

                                                                  default:
                                                                      returnMessage = ReplyStatusofScrumToClient(scrumStatus);
                                                                      break;

                                    Avoid deeply nested control flow statements.
                                    Open

                                                                foreach (Question question in questions)
                                                                {
                                                                    AddAnswer(scrumId, question.Id, expectedUserId, _stringConstant.Leave, ScrumAnswerStatus.Leave);
                                                                }

                                      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);
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language