Promact/slack-erp-custom-integration-mvc

View on GitHub

Showing 196 of 517 total issues

Avoid deeply nested control flow statements.
Open

                                    if (answer != null)
                                    {
                                        // if previous question was comment of task and answer was not null/wrong value then answer will ask next question
                                        taskDetails.Comment = answer;
                                        userAndTaskMailDetailsWithAccessToken.QuestionText = nextQuestion.QuestionStatement;

    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)

      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

                                    foreach (var channel in channels.Channels)
                                    {
                                        _logger.Info("Channel:" + channel);
                                        await AddChannelGroupAsync(channel);
                                    }

          Avoid deeply nested control flow statements.
          Open

                                              if (answer != null)
                                              {
                                                  taskDetails.Description = answer;
                                                  userAndTaskMailDetailsWithAccessToken.QuestionText = nextQuestion.QuestionStatement;
                                                  taskDetails.QuestionId = nextQuestion.Id;

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

                    Task<List<TaskMailReportAc>> TaskMailDetailsReportSelectedDateAsync(string userId, string userName, string role, string createdOn, string loginId, DateTime selectedDate);

              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 (scrum != null)
                                            {
                                                _scrumDataRepository.Delete(scrum.Id);
                                                int scrumDelete = await _scrumDataRepository.SaveChangesAsync();
                                                if (scrumDelete == 1)

                  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

                                                            if (slackRequest.Count > 4)
                                                            {
                                                                isAdmin = await _oauthCallsRepository.UserIsAdminAsync(userId, accessToken);
                                                                _logger.Debug("LeaveApplyAsync User is admin : " + isAdmin);
                                                                if (isAdmin)

                      Avoid deeply nested control flow statements.
                      Open

                                                          if (taskMailStatusConvertResult)
                                                          {
                                                              // if previous question was status of task and it was not null/wrong value then answer will ask next question
                                                              taskDetails.Status = status;
                                                              userAndTaskMailDetailsWithAccessToken.QuestionText = nextQuestion.QuestionStatement;

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

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

                          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)

                            Avoid deeply nested control flow statements.
                            Open

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

                              Function transform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  transform(leaveReports: LeaveReport[], employeeName: string, role: string)  {
                                      if (employeeName === undefined || employeeName === "" && (role === undefined || role === "" || role === null)) {
                                          return leaveReports;
                                      }
                                      if (role === undefined || role === "") {
                              Severity: Minor
                              Found in Slack.Automation/Promact.Erp.Web/app/leaveReport/filter.pipe.ts - 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

                              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 (scrumStatus == ScrumStatus.OnGoing)
                                                            {
                                                                if (await CheckUserAsync(slackUserId, users, project.TeamLeaderId))
                                                                    returnMsg = await MarkLeaveAsync(users, scrum.Id, applicant, questions, scrum.ProjectId, slackUserId, applicantId);
                                                                else

                                  Avoid deeply nested control flow statements.
                                  Open

                                                                      if (sendEmailConfirmationConvertResult)
                                                                      {
                                                                          taskDetails.SendEmailConfirmation = confirmation;
                                                                          switch (confirmation)
                                                                          {

                                    Avoid deeply nested control flow statements.
                                    Open

                                                                    case SlackAction.issues:
                                                                        {
                                                                            RedmineAction redmineAction;
                                                                            if (RedmineAction.TryParse(text[1], out redmineAction))
                                                                            {

                                      Avoid deeply nested control flow statements.
                                      Open

                                                                      case SlackAction.projects:
                                                                          await GetRedmineProjectList(user);
                                                                          break;
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language