Promact/slack-erp-custom-integration-mvc

View on GitHub

Showing 196 of 517 total issues

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

        public virtual string TransformText()
        {
            this.Write("\n");
            this.Write("\n");
            this.Write("\n");
Severity: Major
Found in Slack.Automation/Promact.Erp.Util/Email Templates/TaskMail.cs - About 2 hrs to fix

    Method ProcessCommandsAsync has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
    Open

            private async Task<string> ProcessCommandsAsync(string slackUserId, string slackChannelId, string givenProjectName, string command)
            {
                //Checks whether channelId starts with "G" or "C". This is done inorder to make sure that only gruops or channels are added manually
                if (IsPrivateChannel(slackChannelId))
                {

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

            public virtual string TransformText()
            {
                this.Write("\r\n\r\n");
                this.Write(@"
    <!DOCTYPE> 

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

              public async Task UpdateLeaveAsync(SlashChatUpdateResponse leaveResponse)
              {
                  try
                  {
                      _logger.Debug("UpdateLeaveAsync Leave update method");

        Method SlackRequestAsync has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
        Open

                public async Task SlackRequestAsync(SlashCommand slashCommand)
                {
                    // Way to break string by spaces only if spaces are not between quotes
                    var text = _attachmentRepository.SlackText(slashCommand.Text);
                    // Get user details from 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

        Method Initialize has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public void Initialize()
                {
                    slashCommand.UserId = _stringConstant.UserSlackId;
                    project.Projects = new List<RedmineProject>();
                    project.IssueCount = 25;
        Severity: Major
        Found in Slack.Automation/Promact.Core.Test/RedmineRepositoryTest.cs - About 2 hrs to fix

          Method Initialization has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public void Initialization()
                  {
                      scrumAnswer.Answer = _stringConstant.NoQuestion;
                      scrumAnswer.CreatedOn = DateTime.UtcNow;
                      scrumAnswer.AnswerDate = DateTime.UtcNow;
          Severity: Major
          Found in Slack.Automation/Promact.Core.Test/ScrumBotRepositoryTest.cs - About 2 hrs to fix

            Class OauthCallsRepositoryTest has 23 methods (exceeds 20 allowed). Consider refactoring.
            Open

                public class OauthCallsRepositoryTest
                {
                    #region Private Variables
                    private readonly IComponentContext _componentContext;
                    private readonly IOauthCallsRepository _oauthCallsRepository;
            Severity: Minor
            Found in Slack.Automation/Promact.Core.Test/OauthCallsRepositoryTest.cs - About 2 hrs to fix

              File nprogress.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
               * @license MIT */
              
              ;(function(root, factory) {
              
              
              Severity: Minor
              Found in Slack.Automation/Promact.Erp.Web/Content/js/nprogress/nprogress.js - About 2 hrs to fix

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

                  Class ScrumSetUpRepositoryTest has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      public class ScrumSetUpRepositoryTest
                      {
                  
                          #region Private Variables
                  
                  
                  Severity: Minor
                  Found in Slack.Automation/Promact.Core.Test/ScrumSetUpRepositoryTest.cs - About 2 hrs to fix

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

                              public virtual string TransformText()
                              {
                                  this.Write("\r\n\r\n");
                                  this.Write(@"
                      <!DOCTYPE> 

                        Method RegisterDependancies has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                public static IComponentContext RegisterDependancies()
                                {
                                    var builder = new ContainerBuilder();
                                    var dataContext = new PromactErpContext(DbConnectionFactory.CreateTransient());
                                    builder.RegisterInstance(dataContext).As<DbContext>().SingleInstance();
                        Severity: Major
                        Found in Slack.Automation/Promact.Core.Test/AutofacConfig.cs - About 2 hrs to fix

                          Method Initialize has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  public void Initialize()
                                  {
                          
                                      profile.Skype = _stringConstant.TestUserId;
                                      profile.Email = _stringConstant.EmailForTest;
                          Severity: Major
                          Found in Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs - About 2 hrs to fix

                            Method GetAttachmentAndSendToTLAndManagementAsync has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    private async Task GetAttachmentAndSendToTLAndManagementAsync(string userId, LeaveRequest leaveRequest, string accessToken, List<SlashAttachment> attachment)
                                    {
                                        EmailApplication email = new EmailApplication();
                                        email.To = new List<string>();
                                        email.CC = new List<string>();
                            Severity: Major
                            Found in Slack.Automation/Promact.Core.Repository/Client/Client.cs - About 2 hrs to fix

                              Method ConfigureAuth has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      public void ConfigureAuth(IAppBuilder app, IComponentContext context)
                                      {
                                          _environmentVariable = context.Resolve<IEnvironmentVariableRepository>();
                                          _oAuthLoginRepository = context.Resolve<IOAuthLoginRepository>();
                                          _stringConstantRepository = context.Resolve<IStringConstantRepository>();
                              Severity: Major
                              Found in Slack.Automation/Promact.Erp.Web/App_Start/Startup.Auth.cs - About 2 hrs to fix

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

                                        public async Task LeaveRequestAsync(SlashCommand leave)
                                        {
                                            SlackAction actionType;
                                            // method to convert slash command to list of string
                                            List<string> slackText = _attachmentRepository.SlackText(leave.Text);

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

                                          public static IComponentContext RegisterDependancies()
                                          {
                                              var builder = new ContainerBuilder();
                                              // register dependency
                                              builder.RegisterType<PromactErpContext>().As<DbContext>();
                                  Severity: Major
                                  Found in Slack.Automation/Promact.Erp.Web/App_Start/AutofacConfig.cs - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language