core/templates/domain/jobs/beam-job-run.model.spec.ts

Summary

Maintainability
F
2 wks
Test Coverage

File beam-job-run.model.spec.ts has 312 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright 2021 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Severity: Minor
Found in core/templates/domain/jobs/beam-job-run.model.spec.ts - About 3 hrs to fix

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

      describe('That is pending', () => {
        const beamJobRun = new BeamJobRun('123', 'FooJob', 'PENDING', 0, 0, true);
    
        it('should return the appropriate material tooltip', () => {
          expect(beamJobRun.getJobStatusTooltipString()).toEqual('Pending...');
    Severity: Major
    Found in core/templates/domain/jobs/beam-job-run.model.spec.ts and 7 other locations - About 1 day to fix
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 58..88
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 90..120
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 122..152
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 186..216
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 218..250
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 252..284
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 320..350

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

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

      describe('That is running', () => {
        const beamJobRun = new BeamJobRun('123', 'FooJob', 'RUNNING', 0, 0, true);
    
        it('should return the appropriate material tooltip', () => {
          expect(beamJobRun.getJobStatusTooltipString()).toEqual('Running...');
    Severity: Major
    Found in core/templates/domain/jobs/beam-job-run.model.spec.ts and 7 other locations - About 1 day to fix
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 90..120
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 122..152
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 186..216
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 218..250
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 252..284
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 320..350
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 352..382

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

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

      describe('That is draining', () => {
        const beamJobRun = new BeamJobRun('123', 'FooJob', 'DRAINING', 0, 0, true);
    
        it('should return the appropriate material tooltip', () => {
          expect(beamJobRun.getJobStatusTooltipString()).toEqual('Draining...');
    Severity: Major
    Found in core/templates/domain/jobs/beam-job-run.model.spec.ts and 7 other locations - About 1 day to fix
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 58..88
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 90..120
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 122..152
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 186..216
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 218..250
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 320..350
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 352..382

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

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

      describe('That is failed', () => {
        const beamJobRun = new BeamJobRun('123', 'FooJob', 'FAILED', 0, 0, true);
    
        it('should return the appropriate material tooltip', () => {
          expect(beamJobRun.getJobStatusTooltipString()).toEqual('Failed!');
    Severity: Major
    Found in core/templates/domain/jobs/beam-job-run.model.spec.ts and 7 other locations - About 1 day to fix
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 58..88
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 90..120
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 186..216
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 218..250
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 252..284
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 320..350
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 352..382

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

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

      describe('That is unknown', () => {
        const beamJobRun = new BeamJobRun('123', 'FooJob', 'UNKNOWN', 0, 0, true);
    
        it('should return the appropriate material tooltip', () => {
          expect(beamJobRun.getJobStatusTooltipString()).toEqual('Unknown');
    Severity: Major
    Found in core/templates/domain/jobs/beam-job-run.model.spec.ts and 7 other locations - About 1 day to fix
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 58..88
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 90..120
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 122..152
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 218..250
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 252..284
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 320..350
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 352..382

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

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

      describe('That is updated', () => {
        const beamJobRun = new BeamJobRun('123', 'FooJob', 'UPDATED', 0, 0, true);
    
        it('should return the appropriate material tooltip', () => {
          expect(beamJobRun.getJobStatusTooltipString()).toEqual('Updated');
    Severity: Major
    Found in core/templates/domain/jobs/beam-job-run.model.spec.ts and 7 other locations - About 1 day to fix
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 58..88
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 90..120
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 122..152
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 186..216
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 252..284
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 320..350
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 352..382

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

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

      describe('That is done', () => {
        const beamJobRun = new BeamJobRun('123', 'FooJob', 'DONE', 0, 0, true);
    
        it('should return the appropriate material tooltip', () => {
          expect(beamJobRun.getJobStatusTooltipString()).toEqual('Done!');
    Severity: Major
    Found in core/templates/domain/jobs/beam-job-run.model.spec.ts and 7 other locations - About 1 day to fix
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 58..88
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 122..152
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 186..216
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 218..250
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 252..284
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 320..350
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 352..382

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

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

      describe('That is stopped', () => {
        const beamJobRun = new BeamJobRun('123', 'FooJob', 'STOPPED', 0, 0, true);
    
        it('should return the appropriate material tooltip', () => {
          expect(beamJobRun.getJobStatusTooltipString()).toEqual('Paused');
    Severity: Major
    Found in core/templates/domain/jobs/beam-job-run.model.spec.ts and 7 other locations - About 1 day to fix
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 58..88
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 90..120
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 122..152
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 186..216
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 218..250
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 252..284
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 352..382

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

    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

      describe('That is drained', () => {
        const beamJobRun = new BeamJobRun('123', 'FooJob', 'DRAINED', 0, 0, true);
    
        it('should return the appropriate material tooltip', () => {
          expect(beamJobRun.getJobStatusTooltipString()).toEqual('Drained');
    Severity: Major
    Found in core/templates/domain/jobs/beam-job-run.model.spec.ts and 2 other locations - About 1 day to fix
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 154..184
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 384..421

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

    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

      describe('That is cancelled', () => {
        const beamJobRun = new BeamJobRun('123', 'FooJob', 'CANCELLED', 0, 0, true);
    
        it('should return the appropriate material tooltip', () => {
          expect(beamJobRun.getJobStatusTooltipString()).toEqual('Cancelled');
    Severity: Major
    Found in core/templates/domain/jobs/beam-job-run.model.spec.ts and 2 other locations - About 1 day to fix
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 286..318
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 384..421

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

    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

      describe('That is cancelling', () => {
        const beamJobRun = new BeamJobRun(
          '123',
          'FooJob',
          'CANCELLING',
    Severity: Major
    Found in core/templates/domain/jobs/beam-job-run.model.spec.ts and 2 other locations - About 1 day to fix
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 154..184
    core/templates/domain/jobs/beam-job-run.model.spec.ts on lines 286..318

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

    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

    There are no issues that match your filters.

    Category
    Status