Promact/slack-erp-custom-integration-mvc

View on GitHub

Showing 517 of 517 total issues

File StringConstantRepository.cs has 3512 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using System;

namespace Promact.Erp.Util.StringConstants
{
    public class StringConstantRepository : IStringConstantRepository

    File SlackRepositoryTest.cs has 1193 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    using Autofac;
    using Microsoft.AspNet.Identity;
    using Moq;
    using Newtonsoft.Json;
    using Promact.Core.Repository.AttachmentRepository;
    Severity: Major
    Found in Slack.Automation/Promact.Core.Test/SlackRepositoryTest.cs - About 3 days to fix

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

          [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "14.0.0.0")]
          public class LeaveApplicationBase
          {
              #region Fields
              private global::System.Text.StringBuilder generationEnvironmentField;
      Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApproveAndRejected.cs on lines 335..601
      Slack.Automation/Promact.Erp.Util/Email Templates/SickLeaveApplication.cs on lines 316..582
      Slack.Automation/Promact.Erp.Util/Email Templates/TaskMail.cs on lines 181..447

      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 1475.

      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 4 locations. Consider refactoring.
      Open

          [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "14.0.0.0")]
          public class LeaveApproveAndRejectedBase
          {
              #region Fields
              private global::System.Text.StringBuilder generationEnvironmentField;
      Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApplication.cs on lines 341..607
      Slack.Automation/Promact.Erp.Util/Email Templates/SickLeaveApplication.cs on lines 316..582
      Slack.Automation/Promact.Erp.Util/Email Templates/TaskMail.cs on lines 181..447

      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 1475.

      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 4 locations. Consider refactoring.
      Open

          [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "14.0.0.0")]
          public class SickLeaveApplicationBase
          {
              #region Fields
              private global::System.Text.StringBuilder generationEnvironmentField;
      Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApplication.cs on lines 341..607
      Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApproveAndRejected.cs on lines 335..601
      Slack.Automation/Promact.Erp.Util/Email Templates/TaskMail.cs on lines 181..447

      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 1475.

      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 4 locations. Consider refactoring.
      Open

          [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "14.0.0.0")]
          public class TaskMailBase
          {
              #region Fields
              private global::System.Text.StringBuilder generationEnvironmentField;
      Severity: Major
      Found in Slack.Automation/Promact.Erp.Util/Email Templates/TaskMail.cs and 3 other locations - About 3 days to fix
      Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApplication.cs on lines 341..607
      Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApproveAndRejected.cs on lines 335..601
      Slack.Automation/Promact.Erp.Util/Email Templates/SickLeaveApplication.cs on lines 316..582

      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 1475.

      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

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

      using Autofac;
      using Moq;
      using Promact.Core.Repository.BotQuestionRepository;
      using Promact.Core.Repository.ScrumRepository;
      using Promact.Erp.DomainModel.Models;
      Severity: Major
      Found in Slack.Automation/Promact.Core.Test/ScrumBotRepositoryTest.cs - About 2 days to fix

        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;

          File TaskMailRepositoryTest.cs has 880 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          using Autofac;
          using Autofac.Extras.NLog;
          using Microsoft.AspNet.Identity;
          using Moq;
          using Promact.Core.Repository.BotQuestionRepository;
          Severity: Major
          Found in Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs - About 2 days to fix

            Method QuestionAndAnswerAsync has a Cognitive Complexity of 117 (exceeds 20 allowed). Consider refactoring.
            Open

                    public async Task<string> QuestionAndAnswerAsync(string answer, 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);

            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

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

            public virtual void Initialize()
            {
                if ((this.Errors.HasErrors == false))
                {
            bool FromDateValueAcquired = false;
            Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApplication.cs on lines 222..327
            Slack.Automation/Promact.Erp.Util/Email Templates/SickLeaveApplication.cs on lines 197..302

            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 939.

            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

            public virtual void Initialize()
            {
                if ((this.Errors.HasErrors == false))
                {
            bool FromDateValueAcquired = false;
            Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApplication.cs on lines 222..327
            Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApproveAndRejected.cs on lines 216..321

            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 939.

            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

            public virtual void Initialize()
            {
                if ((this.Errors.HasErrors == false))
                {
            bool FromDateValueAcquired = false;
            Slack.Automation/Promact.Erp.Util/Email Templates/LeaveApproveAndRejected.cs on lines 216..321
            Slack.Automation/Promact.Erp.Util/Email Templates/SickLeaveApplication.cs on lines 197..302

            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 939.

            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

                it('Shows scrum answers of employees in a project on initialization', () => {
                    let mockScrumDetails = new ScrumDetails();
                    let mockEmployeeScrumAnswers = new Array<EmployeeScrumAnswers>();
                    let mockEmployeeScrumAnswer = new EmployeeScrumAnswers();
                    mockEmployeeScrumAnswer.Answer1 = stringConstant.Answer1;
            Slack.Automation/Promact.Erp.Web/app/ScrumReport/scrumProject-Details/scrumProject-Details.component.spec.ts on lines 116..138

            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 329.

            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

                it('Shows scrum answers of employees in a project on initialization', () => {
                    let mockScrumDetails = new ScrumDetails();
                    let mockEmployeeScrumAnswers = new Array<EmployeeScrumAnswers>();
                    let mockEmployeeScrumAnswer = new EmployeeScrumAnswers();
                    mockEmployeeScrumAnswer.Answer1 = stringConstant.Answer1;
            Slack.Automation/Promact.Erp.Web/app/ScrumReport/scrumProject-Details/scrumProject-Details.component.spec.ts on lines 140..162

            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 329.

            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

            Method LeaveApplyAsync has a Cognitive Complexity of 106 (exceeds 20 allowed). Consider refactoring.
            Open

                    private async Task<string> LeaveApplyAsync(List<string> slackRequest, SlashCommand leave, string accessToken, string userId)
                    {
                        try
                        {
                            LeaveType leaveType;

            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

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

                    [Fact, Trait("Category", "Required")]
                    public async Task UpdateLeaveRejectedAsync()
                    {
                        await AddUser();
                        await AddThreeUserIncomingWebHookAsync();
            Severity: Major
            Found in Slack.Automation/Promact.Core.Test/SlackRepositoryTest.cs and 1 other location - About 1 day to fix
            Slack.Automation/Promact.Core.Test/SlackRepositoryTest.cs on lines 148..188

            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 762.

            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

                    [Fact, Trait("Category", "Required")]
                    public async Task UpdateLeaveAsync()
                    {
                        await AddUser();
                        await AddThreeUserIncomingWebHookAsync();
            Severity: Major
            Found in Slack.Automation/Promact.Core.Test/SlackRepositoryTest.cs and 1 other location - About 1 day to fix
            Slack.Automation/Promact.Core.Test/SlackRepositoryTest.cs on lines 193..233

            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 762.

            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

                getTaskMailDetailsReportPreviousDate(UserId: string, UserRole: string, UserName: string, CreatedOn: string) {
                    let mockTaskmailModels = new Array<MockTaskmailModel>();
                    let mockmailModels = new Array<MockmailModel>();
                    let mockmailModel = new MockmailModel();
                    mockmailModel.Comment = this.stringConstant.comment;
            Slack.Automation/Promact.Erp.Web/app/shared/mock/mock.taskmailReport.service.ts on lines 62..80

            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 278.

            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

            Severity
            Category
            Status
            Source
            Language