Promact/slack-erp-custom-integration-mvc

View on GitHub

Showing 196 of 517 total issues

Method LeaveDateDuplicate has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        private async Task<bool> LeaveDateDuplicate(string userId, DateTime startDate, DateTime? endDate)
        {
            int valid = -1;
            bool validIndicator = false;
            LeaveRequest lastLeave = new LeaveRequest();

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

              private async Task<string> UpdateSickLeaveAsync(List<string> slackText, ApplicationUser user, string accessToken)
              {
                  // checking from oAuth whether user is Admin or not
                  bool isAdmin = await _oauthCallsRepository.UserIsAdminAsync(user.Id, accessToken);
                  _logger.Debug("UpdateSickLeaveAsync user is admin : " + isAdmin);

        Method Scrum has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public void Scrum()
                {
                    SlackSocketClient client = new SlackSocketClient(_environmentVariableRepository.ScrumBotToken);//scrumBot
        
                    // Creating a Action<MessageReceived> for Slack Socket Client to get connected.
        Severity: Major
        Found in Slack.Automation/Promact.Erp.Core/Controllers/Bot.cs - About 2 hrs to fix

          Method Send has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public void Send(EmailApplication email)
                  {
                      try
                      {
                          _logger.Info("something");
          Severity: Minor
          Found in Slack.Automation/Promact.Erp.Util/Email/EmailService.cs - About 2 hrs to fix

            Method TaskMailBot has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public void TaskMailBot()
                    {
                        _logger.Info("TaskMailAccessToken : " + _environmentVariableRepository.TaskmailAccessToken);
                        SlackSocketClient client = new SlackSocketClient(_environmentVariableRepository.TaskmailAccessToken);
                        // assigning bot token on Slack Socket Client
            Severity: Minor
            Found in Slack.Automation/Promact.Erp.Core/Controllers/Bot.cs - About 1 hr to fix

              Method AddSlackUserInformationAsync has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
              Open

                      public async Task AddSlackUserInformationAsync(string code)
                      {
                          string slackOAuthRequest = string.Format(_stringConstant.SlackOauthRequestUrl, _envVariableRepository.SlackOAuthClientId, _envVariableRepository.SlackOAuthClientSecret, code);
                          string slackOAuthResponse = await _httpClientService.GetAsync(_stringConstant.OAuthAcessUrl, slackOAuthRequest, null, _stringConstant.Bearer);
                          SlackOAuthResponse slackOAuth = JsonConvert.DeserializeObject<SlackOAuthResponse>(slackOAuthResponse);

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

                      public async Task<string> StartTaskMailAsync(string userId)
                      {
                          // method to get user's details, user's accesstoken, user's task mail details and list or else appropriate message will be send
                          var userAndTaskMailDetailsWithAccessToken = await GetUserAndTaskMailDetailsAsync(userId);
                          _logger.Info("Task Mail Bot Module, Is task mail question text : " + userAndTaskMailDetailsWithAccessToken.QuestionText);

                Method AddTimeEntryToRedmineIssue has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        private async Task AddTimeEntryToRedmineIssue(ApplicationUser user, List<string> text)
                        {
                            int issueId;
                            string result;
                            if (ToCheckIssueExistOrNot(text[2], user.RedmineApiKey, out issueId, out result))

                  Function exports has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function (config) {
                      config.set({
                  
                          // base path that will be used to resolve all patterns (eg. files, exclude)
                          basePath: '',
                  Severity: Minor
                  Found in Slack.Automation/Promact.Erp.Web/karma.config.js - About 1 hr to fix

                    Method CreateRedmineIssue has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            private async Task CreateRedmineIssue(ApplicationUser user, List<string> text)
                            {
                                Priority priorityId;
                                Status statusId;
                                Tracker trackerId;

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

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

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

                                    [HttpPost]
                                    [Route("slack/eventalert")]
                                    public async Task<IHttpActionResult> SlackEventAsync(SlackEventApiAC slackEvent)
                                    {
                                        //slack verification
                            Severity: Minor
                            Found in Slack.Automation/Promact.Erp.Core/Controllers/OAuthController.cs - About 1 hr to fix

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

                                  Function css has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    var css = (function() {
                                      var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
                                          cssProps    = {};
                                  
                                      function camelCase(string) {
                                  Severity: Minor
                                  Found in Slack.Automation/Promact.Erp.Web/Content/js/nprogress/nprogress.js - About 1 hr to fix

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

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