superdesk/superdesk-client-core

View on GitHub
scripts/apps/search/services/SearchService.ts

Summary

Maintainability
F
1 wk
Test Coverage

Function SearchService has a Cognitive Complexity of 155 (exceeds 5 allowed). Consider refactoring.
Open

export function SearchService($location, session, multi,
    preferencesService, moment, sortService) {
    const PARAMETERS = getParameters();
    const EXCLUDE_FACETS = getExcludeFacets();

Severity: Minor
Found in scripts/apps/search/services/SearchService.ts - About 3 days to fix

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

Function SearchService has 498 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function SearchService($location, session, multi,
    preferencesService, moment, sortService) {
    const PARAMETERS = getParameters();
    const EXCLUDE_FACETS = getExcludeFacets();

Severity: Major
Found in scripts/apps/search/services/SearchService.ts - About 2 days to fix

    File SearchService.ts has 582 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
        getParameters,
        getExcludeFacets,
        CORE_PROJECTED_FIELDS,
        DEFAULT_LIST_CONFIG,
    Severity: Major
    Found in scripts/apps/search/services/SearchService.ts - About 1 day to fix

      Function Query has 204 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function Query(this: IQuery, _params: IQueryParams, cvs, options: ISearchOptions) {
              this.options = {
                  hidePreviousVersions: false,
                  ...options,
              };
      Severity: Major
      Found in scripts/apps/search/services/SearchService.ts - About 1 day to fix

        Function setParameters has 122 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function setParameters(filters, params: IQueryParams) {
                const addFromDeskFilter = function(key) {
                    let desk = params[key].split('-');
        
                    if (desk.length === 2) {
        Severity: Major
        Found in scripts/apps/search/services/SearchService.ts - About 4 hrs to fix

          Function buildFilters has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function buildFilters(paramsObject: any, query) {
                      // date filters start
                      var facetrange = {};
          
                      const dateRangesByKey = getDateRangesByKey();
          Severity: Minor
          Found in scripts/apps/search/services/SearchService.ts - About 1 hr to fix

            Function getCriteria has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    this.getCriteria = function getCriteria(withSource) {
                        let search = params;
                        let sort = sortService.getSort(sortOptions);
            
                        setParameters(filters, params);
            Severity: Minor
            Found in scripts/apps/search/services/SearchService.ts - About 1 hr to fix

              Function buildGeneralFilters has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function buildGeneralFilters(paramsObject, query) {
                          if (paramsObject.urgency) {
                              query.post_filter({terms: {urgency: JSON.parse(paramsObject.urgency)}});
                          }
              
              
              Severity: Minor
              Found in scripts/apps/search/services/SearchService.ts - About 1 hr to fix

                Function mergeItems has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    this.mergeItems = function(newItems, scopeItems, append, force) {
                        if (this.getElasticHighlight()) {
                            newItems._items = _.map(newItems._items, this.mergeHighlightFields);
                        }
                
                
                Severity: Minor
                Found in scripts/apps/search/services/SearchService.ts - About 1 hr to fix

                  Function SearchService has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  export function SearchService($location, session, multi,
                      preferencesService, moment, sortService) {
                  Severity: Minor
                  Found in scripts/apps/search/services/SearchService.ts - About 45 mins to fix

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

                                            if (params[key] != null && key === fieldname + 'from') {
                                                if (facetrange[key] == null) {
                                                    facetrange[key] = {};
                                                }
                    
                    
                    Severity: Major
                    Found in scripts/apps/search/services/SearchService.ts and 1 other location - About 3 hrs to fix
                    scripts/apps/search/services/SearchService.ts on lines 255..265

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

                    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

                                            if (params[key] != null && key === fieldname + 'to') {
                                                if (facetrange[key] == null) {
                                                    facetrange[key] = {};
                                                }
                    
                    
                    Severity: Major
                    Found in scripts/apps/search/services/SearchService.ts and 1 other location - About 3 hrs to fix
                    scripts/apps/search/services/SearchService.ts on lines 266..276

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

                    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

                                    filters.push({or: [
                                        {terms: {'subject.qcode': JSON.parse(params[key])}},
                                        {terms: {'subject.parent': JSON.parse(params[key])}},
                                    ]});
                    Severity: Major
                    Found in scripts/apps/search/services/SearchService.ts and 1 other location - About 1 hr to fix
                    scripts/apps/content-api/services/ContentAPISearchService.ts on lines 51..54

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

                    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

                        this.cvs = appConfig.search_cvs ||
                            [{id: 'subject', name: 'Subject', field: 'subject', list: 'subjectcodes'},
                                {id: 'companycodes', name: 'Company Codes', field: 'company_codes', list: 'company_codes'}];
                    Severity: Minor
                    Found in scripts/apps/search/services/SearchService.ts and 1 other location - About 55 mins to fix
                    scripts/apps/authoring/metadata/metadata.ts on lines 1138..1141

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

                    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

                                Object.keys(facetrange).forEach((key) => {
                                    query.post_filter({range: {[key]: facetrange[key]}});
                                });
                    Severity: Minor
                    Found in scripts/apps/search/services/SearchService.ts and 1 other location - About 50 mins to fix
                    scripts/apps/monitoring/services/CardsService.ts on lines 239..241

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

                    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

                                const termKey = {
                                    nottype: 'type',
                                    notdesk: 'task.desk',
                                    notgenre: 'genre.name',
                                    notcategory: 'anpa_category.name',
                    Severity: Minor
                    Found in scripts/apps/search/services/SearchService.ts and 1 other location - About 35 mins to fix
                    scripts/apps/authoring/metadata/metadata.ts on lines 1016..1026

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

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

                                if (paramsObject.desk) {
                                    query.post_filter({terms: {'task.desk': JSON.parse(paramsObject.desk)}});
                                }
                    Severity: Major
                    Found in scripts/apps/search/services/SearchService.ts and 5 other locations - About 35 mins to fix
                    scripts/apps/content-api/services/ContentAPISearchService.ts on lines 57..59
                    scripts/apps/search/services/SearchService.ts on lines 434..436
                    scripts/apps/search/services/SearchService.ts on lines 438..440
                    scripts/apps/search/services/SearchService.ts on lines 446..448
                    scripts/apps/search/services/SearchService.ts on lines 450..452

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

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

                                if (paramsObject.sms) {
                                    query.post_filter({terms: {'flags.marked_for_sms': JSON.parse(paramsObject.sms)}});
                                }
                    Severity: Major
                    Found in scripts/apps/search/services/SearchService.ts and 5 other locations - About 35 mins to fix
                    scripts/apps/content-api/services/ContentAPISearchService.ts on lines 57..59
                    scripts/apps/search/services/SearchService.ts on lines 434..436
                    scripts/apps/search/services/SearchService.ts on lines 438..440
                    scripts/apps/search/services/SearchService.ts on lines 442..444
                    scripts/apps/search/services/SearchService.ts on lines 446..448

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

                    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

                                if (paramsObject.urgency) {
                                    query.post_filter({terms: {urgency: JSON.parse(paramsObject.urgency)}});
                                }
                    Severity: Major
                    Found in scripts/apps/search/services/SearchService.ts and 3 other locations - About 35 mins to fix
                    scripts/apps/monitoring/services/CardsService.ts on lines 224..226
                    scripts/apps/search/services/SearchService.ts on lines 421..423
                    scripts/apps/search/services/SearchService.ts on lines 454..456

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

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

                                if (paramsObject.category) {
                                    query.post_filter({terms: {'anpa_category.name': JSON.parse(paramsObject.category)}});
                                }
                    Severity: Major
                    Found in scripts/apps/search/services/SearchService.ts and 5 other locations - About 35 mins to fix
                    scripts/apps/content-api/services/ContentAPISearchService.ts on lines 57..59
                    scripts/apps/search/services/SearchService.ts on lines 438..440
                    scripts/apps/search/services/SearchService.ts on lines 442..444
                    scripts/apps/search/services/SearchService.ts on lines 446..448
                    scripts/apps/search/services/SearchService.ts on lines 450..452

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

                    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

                                if (paramsObject.language) {
                                    query.post_filter({terms: {language: JSON.parse(paramsObject.language)}});
                                }
                    Severity: Major
                    Found in scripts/apps/search/services/SearchService.ts and 3 other locations - About 35 mins to fix
                    scripts/apps/monitoring/services/CardsService.ts on lines 224..226
                    scripts/apps/search/services/SearchService.ts on lines 417..419
                    scripts/apps/search/services/SearchService.ts on lines 421..423

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

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

                                if (paramsObject.genre) {
                                    query.post_filter({terms: {'genre.name': JSON.parse(paramsObject.genre)}});
                                }
                    Severity: Major
                    Found in scripts/apps/search/services/SearchService.ts and 5 other locations - About 35 mins to fix
                    scripts/apps/content-api/services/ContentAPISearchService.ts on lines 57..59
                    scripts/apps/search/services/SearchService.ts on lines 434..436
                    scripts/apps/search/services/SearchService.ts on lines 442..444
                    scripts/apps/search/services/SearchService.ts on lines 446..448
                    scripts/apps/search/services/SearchService.ts on lines 450..452

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

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

                                if (paramsObject.legal) {
                                    query.post_filter({terms: {'flags.marked_for_legal': JSON.parse(paramsObject.legal)}});
                                }
                    Severity: Major
                    Found in scripts/apps/search/services/SearchService.ts and 5 other locations - About 35 mins to fix
                    scripts/apps/content-api/services/ContentAPISearchService.ts on lines 57..59
                    scripts/apps/search/services/SearchService.ts on lines 434..436
                    scripts/apps/search/services/SearchService.ts on lines 438..440
                    scripts/apps/search/services/SearchService.ts on lines 442..444
                    scripts/apps/search/services/SearchService.ts on lines 450..452

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

                    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

                                if (paramsObject.priority) {
                                    query.post_filter({terms: {priority: JSON.parse(paramsObject.priority)}});
                                }
                    Severity: Major
                    Found in scripts/apps/search/services/SearchService.ts and 3 other locations - About 35 mins to fix
                    scripts/apps/monitoring/services/CardsService.ts on lines 224..226
                    scripts/apps/search/services/SearchService.ts on lines 417..419
                    scripts/apps/search/services/SearchService.ts on lines 454..456

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

                    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