Promact/slack-erp-custom-integration-mvc

View on GitHub

Showing 196 of 517 total issues

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

        private async Task UpdateByPropertyAsync(bool isClose, int assignTo, string issueStringId, string userRedmineApiKey)
        {
            int issueId;
            string result;
            if (ToCheckIssueExistOrNot(issueStringId, userRedmineApiKey, out issueId, out result))

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

            [Fact, Trait("Category", "Required")]
            public async Task LeaveApplyForSLForUserAsync()
            {
                await AddThreeUserIncomingWebHookAsync();
                await AddUser();
    Severity: Minor
    Found in Slack.Automation/Promact.Core.Test/SlackRepositoryTest.cs - About 1 hr to fix

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

              private async Task<string> LeavesListBySlackUserIdAsync(string userId, string accessToken)
              {
                  // get user details from oAuth server
                  User user = await _oauthCallsRepository.GetUserByUserIdAsync(userId, accessToken);
                  _logger.Debug("LeavesListBySlackUserIdAsync user name : " + user.UserName);

        Function set has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          NProgress.set = function(n) {
            var started = NProgress.isStarted();
        
            n = clamp(n, Settings.minimum, 1);
            NProgress.status = (n === 1 ? null : n);
        Severity: Minor
        Found in Slack.Automation/Promact.Erp.Web/Content/js/nprogress/nprogress.js - About 1 hr to fix

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

                    public void Write(string textToAppend)
                    {
                        if (string.IsNullOrEmpty(textToAppend))
                        {
                            return;

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

                      public void Write(string textToAppend)
                      {
                          if (string.IsNullOrEmpty(textToAppend))
                          {
                              return;

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

                        public void Write(string textToAppend)
                        {
                            if (string.IsNullOrEmpty(textToAppend))
                            {
                                return;

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

                          public void Write(string textToAppend)
                          {
                              if (string.IsNullOrEmpty(textToAppend))
                              {
                                  return;
                  Severity: Minor
                  Found in Slack.Automation/Promact.Erp.Util/Email Templates/TaskMail.cs - About 1 hr to fix

                    Method LeaveApplyForSLAsync has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            [Fact, Trait("Category", "Required")]
                            public async Task LeaveApplyForSLAsync()
                            {
                                await AddGroup();
                                await AddMailSetting();
                    Severity: Minor
                    Found in Slack.Automation/Promact.Core.Test/SlackRepositoryTest.cs - About 1 hr to fix

                      Method QuestionAndAnswerAfterSecondAnswerExceedHoursAsync has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              [Fact, Trait("Category", "Required")]
                              public async Task QuestionAndAnswerAfterSecondAnswerExceedHoursAsync()
                              {
                                  await mockAndUserCreate();
                                  await _slackUserRepository.AddSlackUserAsync(slackUserDetails);
                      Severity: Minor
                      Found in Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs - About 1 hr to fix

                        Method SlackResponseAttachment has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                public List<SlashAttachment> SlackResponseAttachment(string leaveRequestId, string replyText)
                                {
                                    List<SlashAttachmentAction> ActionList = new List<SlashAttachmentAction>();
                                    List<SlashAttachment> attachment = new List<SlashAttachment>();
                                    SlashAttachment attachmentList = new SlashAttachment();

                          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)

                            Function getTaskMailDetails has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                getTaskMailDetails() {
                                    this.loader.loader = true;
                                    this.route.params.subscribe(params => {
                                        if (params[this.stringConstant.userRole] === this.stringConstant.RoleAdmin) {
                                            this.isHide = false;

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

                                      [Fact, Trait("Category", "Required")]
                                      public async Task TaskMailDetailsReportNextPreviousDateForTeamLeaderAsync()
                                      {
                                          var userResponse = Task.FromResult(_stringConstant.UserDetailsFromOauthServer);
                                          var userRequestUrl = string.Format("{0}{1}", _stringConstant.UserDetailsUrl, _stringConstant.FirstNameForTest);
                              Severity: Minor
                              Found in Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs - About 1 hr to fix

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

                                        protected override void Seed(Promact.Erp.DomainModel.Context.PromactErpContext context)
                                        {
                                            if (context.Question.Count() == 0)
                                            {
                                                Question firstQuestionTaskMail = new Question() { CreatedOn = DateTime.UtcNow, OrderNumber = QuestionOrder.YourTask, QuestionStatement = "On which task did you work today?", Type = BotQuestionType.TaskMail };

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

                                          private async Task<string> ListLinkAsync(string slackUserId)
                                          {
                                              string reply = string.Empty;
                                              var accessToken = await GetAccessToken(slackUserId);
                                              if (accessToken != null)
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language