Promact/slack-erp-custom-integration-mvc

View on GitHub

Showing 517 of 517 total issues

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

    it('Shows details of task mail report for an employee on Next Date for Teamleader', fakeAsync(() => {
        let fixture = TestBed.createComponent(TaskMailDetailsComponent);
        let taskMailDetailsComponent = fixture.componentInstance;
        taskMailDetailsComponent.getTaskMailNext(stringConstant.userName, stringConstant.userId, stringConstant.RoleTeamLeader, stringConstant.createdOn);
        tick();
Slack.Automation/Promact.Erp.Web/app/taskmail/taskmail-details/taskmail-details.component.spec.ts on lines 84..90
Slack.Automation/Promact.Erp.Web/app/taskmail/taskmail-details/taskmail-details.component.spec.ts on lines 92..98

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

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

    it('Shows details of task mail report for an employee on Privious Date For Admin', fakeAsync(() => {
        let fixture = TestBed.createComponent(TaskMailDetailsComponent);
        let taskMailDetailsComponent = fixture.componentInstance;
        taskMailDetailsComponent.getTaskMailPrevious(stringConstant.userName, stringConstant.userId, stringConstant.RoleAdmin, stringConstant.createdOn);
        tick();
Slack.Automation/Promact.Erp.Web/app/taskmail/taskmail-details/taskmail-details.component.spec.ts on lines 92..98
Slack.Automation/Promact.Erp.Web/app/taskmail/taskmail-details/taskmail-details.component.spec.ts on lines 107..113

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

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("back To GroupList", () => {
        let fixture = TestBed.createComponent(GroupEditComponent);
        let groupEditComponent = fixture.componentInstance;
        let router = fixture.debugElement.injector.get(Router);
        spyOn(router, stringConstant.navigate);
Slack.Automation/Promact.Erp.Web/app/Group/GroupAdd/groupAdd.component.spec.ts on lines 80..87

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

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("back To GroupList", () => {
        let fixture = TestBed.createComponent(GroupAddComponent);
        let groupAddComponent = fixture.componentInstance;
        let router = fixture.debugElement.injector.get(Router);
        spyOn(router, stringConstant.navigate);
Slack.Automation/Promact.Erp.Web/app/Group/GroupEdit/groupEdit.component.spec.ts on lines 90..97

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

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

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

    public class ScrumBotRepository : RepositoryBase, IScrumBotRepository
    {

        #region Private Variable 

    File OauthCallsRepositoryTest.cs has 302 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    using Autofac;
    using Microsoft.AspNet.Identity;
    using Moq;
    using Promact.Core.Repository.OauthCallsRepository;
    using Promact.Core.Repository.ServiceRepository;
    Severity: Minor
    Found in Slack.Automation/Promact.Core.Test/OauthCallsRepositoryTest.cs - About 3 hrs to fix

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

              public async Task<string> PostAsync(string baseUrl, string contentString, string contentHeader, string accessToken, string accessTokenType)
              {
                  try
                  {
                      _client = new System.Net.Http.HttpClient();
      Slack.Automation/Promact.Erp.Util/HttpClient/HttpClientService.cs on lines 111..133

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

      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

              public async Task<string> PutAsync(string baseUrl, string contentString, string contentHeader, string accessToken, string accessTokenType)
              {
                  try
                  {
                      _client = new System.Net.Http.HttpClient();
      Slack.Automation/Promact.Erp.Util/HttpClient/HttpClientService.cs on lines 77..99

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

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

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

                [Fact, Trait("Category", "Required")]
                public async Task LeaveReportEmployeeTestAsync()
                {
                    await CreateUserAndMockingHttpContextToReturnAccessToken();
                    MockingGetListOfEmployeeAsync();
        Slack.Automation/Promact.Core.Test/LeaveReportRepositoryTest.cs on lines 123..135

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

        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 LeaveReportTestFalseAsync()
                {
                    await CreateUserAndMockingHttpContextToReturnAccessToken();
                    MockingGetListOfEmployeeAsync();
        Slack.Automation/Promact.Core.Test/LeaveReportRepositoryTest.cs on lines 71..83

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

        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

                public string EmailServiceTemplateLeaveUpdate(LeaveRequest leave)
                {
                    var dateFormat = Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;
                    LeaveApproveAndRejected leaveTemplate = new LeaveApproveAndRejected();
                    leaveTemplate.Session = new Dictionary<string, object>
        Slack.Automation/Promact.Core.Repository/EmailServiceTemplateRepository/EmailServiceTemplateRepository.cs on lines 32..51

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

        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

                public string EmailServiceTemplate(LeaveRequest leaveRequest)
                {
        
                    var dateFormat = Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;
                    LeaveApplication leaveTemplate = new LeaveApplication();
        Slack.Automation/Promact.Core.Repository/EmailServiceTemplateRepository/EmailServiceTemplateRepository.cs on lines 99..116

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

        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 TransformText has 78 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/LeaveApplication.cs - About 3 hrs to fix

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

                  [Fact, Trait("Category", "Required")]
                  public async Task QuestionAndAnswerSecondNotAnsweredOrWrongAnswerAsync()
                  {
                      await mockAndUserCreateAsync();
                      await _slackUserRepository.AddSlackUserAsync(slackUserDetails);
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 270..285
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 349..364
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 410..425

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

          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

                  [Fact, Trait("Category", "Required")]
                  public async Task QuestionAndAnswerThirdNotAnsweredOrWrongAnswerAsync()
                  {
                      await mockAndUserCreateAsync();
                      await _slackUserRepository.AddSlackUserAsync(slackUserDetails);
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 209..224
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 349..364
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 410..425

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

          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

                  [Fact, Trait("Category", "Required")]
                  public async Task QuestionAndAnswerFifthNotAnsweredOrWrongAnswerAsync()
                  {
                      await mockAndUserCreateAsync();
                      await _slackUserRepository.AddSlackUserAsync(slackUserDetails);
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 209..224
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 270..285
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 410..425

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

          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

                  [Fact, Trait("Category", "Required")]
                  public async Task QuestionAndAnswerSixthNotAnsweredOrWrongAnswerAsync()
                  {
                      await mockAndUserCreateAsync();
                      await _slackUserRepository.AddSlackUserAsync(slackUserDetails);
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 209..224
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 270..285
          Slack.Automation/Promact.Core.Test/TaskMailRepositoryTest.cs on lines 349..364

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

          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 LeaveDateDuplicate has a Cognitive Complexity of 37 (exceeds 20 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();

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

          Severity
          Category
          Status
          Source
          Language