Promact/slack-erp-custom-integration-mvc

View on GitHub
Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs

Summary

Maintainability
F
2 wks
Test Coverage

Method ProcessMessagesAsync has a Cognitive Complexity of 161 (exceeds 20 allowed). Consider refactoring.
Open

        public async Task<string> ProcessMessagesAsync(string slackUserId, string slackChannelId, string message, string scrumBotId)
        {
            _logger.Info(DateTime.UtcNow.Date);
            string replyText = string.Empty;
            SlackUserDetailAc slackUserDetail = await _slackUserDetailRepository.GetByIdAsync(slackUserId);

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

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;

    Method ProcessMessagesAsync has 177 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public async Task<string> ProcessMessagesAsync(string slackUserId, string slackChannelId, string message, string scrumBotId)
            {
                _logger.Info(DateTime.UtcNow.Date);
                string replyText = string.Empty;
                SlackUserDetailAc slackUserDetail = await _slackUserDetailRepository.GetByIdAsync(slackUserId);

      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

      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

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

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

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

                private async Task<ScrumStatus> FetchScrumStatusAsync(ProjectAc project, List<User> users, List<Question> questions)
                {
                    if (project?.Id > 0)
                    {
                        if (project.IsActive)

        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 61 lines of code (exceeds 25 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);

          Method StartScrumAsync has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  private async Task<string> StartScrumAsync(int projectId, List<User> users, ProjectAc project, ScrumStatus scrumStatus)
                  {
                      string replyMessage = string.Empty;
                      List<Question> questionList = await _botQuestionRepository.GetQuestionsByTypeAsync(BotQuestionType.Scrum);
                      //only if scrum has not been conducted in the day can scrum start.

            Method GetQuestionAsync has 52 lines of code (exceeds 25 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);

              Method AddScrumAnswerAsync has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      private async Task<string> AddScrumAnswerAsync(string slackUserName, string message, int? projectId, string slackUserId, bool isLinkCommand)
                      {
                          if (projectId != null)
                          {
                              //today's scrum of the channel 

                Method AddScrumAnswerAsync has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                Open

                        private async Task<string> AddScrumAnswerAsync(string slackUserName, string message, int? projectId, string slackUserId, bool isLinkCommand)
                        {
                            if (projectId != null)
                            {
                                //today's scrum of the channel 

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

                        private async Task<bool> IsScrumStartLeaveLinkCommandAsync(string scrumBotId, string message, string[] messageArray)
                        {
                            if (((String.Compare(messageArray[0], _stringConstant.Leave, StringComparison.OrdinalIgnoreCase) == 0) || (String.Compare(messageArray[0], _stringConstant.Start, StringComparison.OrdinalIgnoreCase) == 0)) && messageArray.Length == 2)
                            {
                                //"<@".Length is 2

                  Method MarkScrumCompleteAsync has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          private async Task<string> MarkScrumCompleteAsync(int scrumId, List<User> users, int questionCount)
                          {
                              //list of scrum answers of the given scrumId            
                              List<ScrumAnswer> scrumAnswers = _scrumAnswerDataRepository.Fetch(x => x.ScrumId == scrumId).OrderBy(x => x.Id).ToList();
                              User user = new User();

                    Method ProcessExpectedUserResultAsync has 40 lines of code (exceeds 25 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)
                            {
                                //the expected user and the interacting user are same and is active
                                if (user?.SlackUserId == applicantId)
                                {

                      Method LeaveAsync has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              private async Task<string> LeaveAsync(int projectId, string slackUserName, string slackUserId, string applicant, string applicantId)
                              {
                                  string returnMsg;
                                  //we will have to check whether the scrum is on going or not before calling FetchScrumStatus()
                                  //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".

                        Method MarkLeaveAsync has 36 lines of code (exceeds 25 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)
                                {
                                    string returnMsg = string.Empty;
                                    User user = users.FirstOrDefault(x => x.SlackUserId == applicantId);
                                    if (user != null)

                          Method MarkLeaveAsync has a Cognitive Complexity of 27 (exceeds 20 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)
                                  {
                                      string returnMsg = string.Empty;
                                      User user = users.FirstOrDefault(x => x.SlackUserId == applicantId);
                                      if (user != null)

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

                                  private async Task<string> LeaveAsync(int projectId, string slackUserName, string slackUserId, string applicant, string applicantId)
                                  {
                                      string returnMsg;
                                      //we will have to check whether the scrum is on going or not before calling FetchScrumStatus()
                                      //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".

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

                                  private string ReplyStatusofScrumToClient(ScrumStatus scrumStatus)
                                  {
                                      string returnMessage;
                                      switch (scrumStatus)
                                      {

                            Method FetchScrumStatusAsync has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    private async Task<ScrumStatus> FetchScrumStatusAsync(ProjectAc project, List<User> users, List<Question> questions)
                                    {
                                        if (project?.Id > 0)
                                        {
                                            if (project.IsActive)

                              Method GetReplyToUserAsync has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      private async Task<string> GetReplyToUserAsync(List<User> users, int projectId, int scrumId, string applicantId, string applicant, List<Question> questions)
                                      {
                                          bool fetchQuestion = false;
                                          User unexpectedUser = users.FirstOrDefault(x => x.SlackUserId == applicantId);
                                          //the user to whom the last question was asked. This user must be called before GetQuestionAsync() is called because if scrum is complete then temporary data is deleted and this user cannot be fetched.

                                Method FetchPreviousDayStatus has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        private string FetchPreviousDayStatus(string userId, int projectId, List<Question> questions)
                                        {
                                            string previousDayStatus = string.Empty;
                                            DateTime date = DateTime.UtcNow.Date;
                                            //previous scrums' Ids of this channel(project)

                                  Method ProcessExpectedUserResultAsync has a Cognitive Complexity of 25 (exceeds 20 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)
                                          {
                                              //the expected user and the interacting user are same and is active
                                              if (user?.SlackUserId == applicantId)
                                              {

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

                                          private async Task<bool> IsScrumStartLeaveLinkCommandAsync(string scrumBotId, string message, string[] messageArray)
                                          {
                                              if (((String.Compare(messageArray[0], _stringConstant.Leave, StringComparison.OrdinalIgnoreCase) == 0) || (String.Compare(messageArray[0], _stringConstant.Start, StringComparison.OrdinalIgnoreCase) == 0)) && messageArray.Length == 2)
                                              {
                                                  //"<@".Length is 2

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

                                          private async Task<string> StartScrumAsync(int projectId, List<User> users, ProjectAc project, ScrumStatus scrumStatus)
                                          {
                                              string replyMessage = string.Empty;
                                              List<Question> questionList = await _botQuestionRepository.GetQuestionsByTypeAsync(BotQuestionType.Scrum);
                                              //only if scrum has not been conducted in the day can scrum start.

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

                                      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

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

                                          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)

                                            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

                                                                              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

                                                                                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 (scrum != null)
                                                                                    {
                                                                                        _logger.Info(scrum?.ScrumDate);
                                                                                        if (!scrum.IsHalted)
                                                                                            return scrum.IsOngoing ? ScrumStatus.OnGoing : ScrumStatus.Completed;

                                                          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

                                                            Consider simplifying this complex logical expression.
                                                            Open

                                                                            if (await IsScrumStartLeaveLinkCommandAsync(scrumBotId, message, messageArray)
                                                                               || String.Compare(message, _stringConstant.ScrumHalt, StringComparison.OrdinalIgnoreCase) == 0
                                                                               || String.Compare(message, _stringConstant.ScrumResume, StringComparison.OrdinalIgnoreCase) == 0
                                                                               || (scrum != null && scrum.IsOngoing && !scrum.IsHalted))
                                                                            {

                                                              Method LeaveAsync has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                              Open

                                                                      private async Task<string> LeaveAsync(int projectId, string slackUserName, string slackUserId, string applicant, string applicantId)

                                                                Method AddAnswer has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                Open

                                                                        private void AddAnswer(int scrumId, int questionId, string userId, string message, ScrumAnswerStatus scrumAnswerStatus)

                                                                  Method AddScrumAnswerAsync has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                  Open

                                                                          private async Task<string> AddScrumAnswerAsync(string slackUserName, string message, int? projectId, string slackUserId, bool isLinkCommand)

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                    return _stringConstant.ProjectChannelNotLinked;

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                  return false;

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                                return _stringConstant.YouAreNotInExistInOAuthServer;

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                          return ScrumStatus.InActiveProject;

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                            return false;

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                                      return string.Format(_stringConstant.InActiveInOAuth, expectedSlackUserAc.Name) + await GetQuestionAsync(scrumId, questions, users, projectId);

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                            return ScrumStatus.NoProject;

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                              return _stringConstant.ScrumNotStarted;

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                        return _stringConstant.UserNotInSlack + await GetQuestionAsync(scrumId, questions, users, projectId);

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                  return reply;

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                    return string.Empty;

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                          return _stringConstant.ScrumAlreadyConducted;

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                                return ScrumStatus.NoEmployee;

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                              return true;

                                                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                Open

                                                                                                                if (!string.IsNullOrEmpty(prevUserAc?.Name))
                                                                                                                {
                                                                                                                    if (prevUserAc.Deleted)
                                                                                                                        //user is not part of the project in OAuth
                                                                                                                        replyMessage = string.Format(_stringConstant.UserNotInProject, prevUserAc.Name);
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 1323..1330

                                                                                                Duplicated Code

                                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                Tuning

                                                                                                This issue has a mass of 88.

                                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                Refactorings

                                                                                                Further Reading

                                                                                                Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                Open

                                                                                                                if (!string.IsNullOrEmpty(prevUser?.Name))
                                                                                                                {
                                                                                                                    if (prevUser.Deleted)//the previous user is not part of the project in OAuth
                                                                                                                        returnMsg += string.Format(_stringConstant.UserNotInProject, prevUser.Name);
                                                                                                
                                                                                                
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 794..804

                                                                                                Duplicated Code

                                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                Tuning

                                                                                                This issue has a mass of 88.

                                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                Refactorings

                                                                                                Further Reading

                                                                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                Open

                                                                                                            if (((String.Compare(messageArray[0], _stringConstant.Leave, StringComparison.OrdinalIgnoreCase) == 0) || (String.Compare(messageArray[0], _stringConstant.Start, StringComparison.OrdinalIgnoreCase) == 0)) && messageArray.Length == 2)
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 185..185

                                                                                                Duplicated Code

                                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                Tuning

                                                                                                This issue has a mass of 83.

                                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                Refactorings

                                                                                                Further Reading

                                                                                                Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                Open

                                                                                                                            else if (((String.Compare(messageArray[0], _stringConstant.Leave, StringComparison.OrdinalIgnoreCase) == 0) || (String.Compare(messageArray[0], _stringConstant.Start, StringComparison.OrdinalIgnoreCase) == 0)) && messageArray.Length == 2)
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 444..444

                                                                                                Duplicated Code

                                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                Tuning

                                                                                                This issue has a mass of 83.

                                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                Refactorings

                                                                                                Further Reading

                                                                                                Identical blocks of code found in 3 locations. Consider refactoring.
                                                                                                Open

                                                                                                                if (await IsScrumStartLeaveLinkCommandAsync(scrumBotId, message, messageArray)
                                                                                                                   || String.Compare(message, _stringConstant.ScrumHalt, StringComparison.OrdinalIgnoreCase) == 0
                                                                                                                   || String.Compare(message, _stringConstant.ScrumResume, StringComparison.OrdinalIgnoreCase) == 0
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 233..235
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 254..256

                                                                                                Duplicated Code

                                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                Tuning

                                                                                                This issue has a mass of 72.

                                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                Refactorings

                                                                                                Further Reading

                                                                                                Identical blocks of code found in 3 locations. Consider refactoring.
                                                                                                Open

                                                                                                                            if (await IsScrumStartLeaveLinkCommandAsync(scrumBotId, message, messageArray)
                                                                                                                              || String.Compare(message, _stringConstant.ScrumHalt, StringComparison.OrdinalIgnoreCase) == 0
                                                                                                                              || String.Compare(message, _stringConstant.ScrumResume, StringComparison.OrdinalIgnoreCase) == 0)
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 254..256
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 275..277

                                                                                                Duplicated Code

                                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                Tuning

                                                                                                This issue has a mass of 72.

                                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                Refactorings

                                                                                                Further Reading

                                                                                                Identical blocks of code found in 3 locations. Consider refactoring.
                                                                                                Open

                                                                                                                    else if (await IsScrumStartLeaveLinkCommandAsync(scrumBotId, message, messageArray)
                                                                                                                       || String.Compare(message, _stringConstant.ScrumHalt, StringComparison.OrdinalIgnoreCase) == 0
                                                                                                                       || String.Compare(message, _stringConstant.ScrumResume, StringComparison.OrdinalIgnoreCase) == 0)
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 233..235
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 275..277

                                                                                                Duplicated Code

                                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                Tuning

                                                                                                This issue has a mass of 72.

                                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                Refactorings

                                                                                                Further Reading

                                                                                                Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                Open

                                                                                                            else if (String.Compare(messageArray[0], _stringConstant.Link, StringComparison.OrdinalIgnoreCase) == 0 ||
                                                                                                                        String.Compare(messageArray[0], _stringConstant.Unlink, StringComparison.OrdinalIgnoreCase) == 0)
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 163..164
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 247..248

                                                                                                Duplicated Code

                                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                Tuning

                                                                                                This issue has a mass of 68.

                                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                Refactorings

                                                                                                Further Reading

                                                                                                Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                Open

                                                                                                                    if (String.Compare(messageArray[0], _stringConstant.Link, StringComparison.OrdinalIgnoreCase) == 0 ||
                                                                                                                        String.Compare(messageArray[0], _stringConstant.Unlink, StringComparison.OrdinalIgnoreCase) == 0 ||
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 247..248
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 466..467

                                                                                                Duplicated Code

                                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                Tuning

                                                                                                This issue has a mass of 68.

                                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                Refactorings

                                                                                                Further Reading

                                                                                                Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                Open

                                                                                                                    if (String.Compare(messageArray[0], _stringConstant.Add, StringComparison.OrdinalIgnoreCase) == 0 &&
                                                                                                                        String.Compare(messageArray[1], _stringConstant.Channel, StringComparison.OrdinalIgnoreCase) == 0)
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 163..164
                                                                                                Slack.Automation/Promact.Core.Repository/ScrumRepository/ScrumBotRepository.cs on lines 466..467

                                                                                                Duplicated Code

                                                                                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                Tuning

                                                                                                This issue has a mass of 68.

                                                                                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                Refactorings

                                                                                                Further Reading

                                                                                                There are no issues that match your filters.

                                                                                                Category
                                                                                                Status