adobe/brackets

View on GitHub
src/search/FindInFiles.js

Summary

Maintainability
F
5 days
Test Coverage

File FindInFiles.js has 633 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2012 - present Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
Severity: Major
Found in src/search/FindInFiles.js - About 1 day to fix

    Function _doSearch has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function _doSearch(queryInfo, candidateFilesPromise, filter) {
            searchModel.filter = filter;
    
            var queryResult = searchModel.setQueryInfo(queryInfo);
            if (!queryResult) {
    Severity: Major
    Found in src/search/FindInFiles.js - About 3 hrs to fix

      Function _updateResults has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function _updateResults(doc, changeList) {
              var i, diff, matches, lines, start, howMany,
                  resultsChanged = false,
                  fullPath       = doc.file.fullPath,
                  resultInfo     = searchModel.results[fullPath];
      Severity: Major
      Found in src/search/FindInFiles.js - About 2 hrs to fix

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

            function _getSearchMatches(contents, queryExpr) {
                // Quick exit if not found or if we hit the limit
                if (searchModel.foundMaximum || contents.search(queryExpr) === -1) {
                    return [];
                }
        Severity: Minor
        Found in src/search/FindInFiles.js - About 1 hr to fix

          Function _addSearchResultsForEntries has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function _addSearchResultsForEntries(entries) {
                      var fullPaths = [];
                      return Async.doInParallel(entries, function (entry) {
                          var addedFiles = [],
                              addedFilePaths = [],
          Severity: Minor
          Found in src/search/FindInFiles.js - About 1 hr to fix

            Function getNextPageofSearchResults has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function getNextPageofSearchResults() {
                    var searchDeferred = $.Deferred();
                    if (searchModel.allResultsAvailable) {
                        return searchDeferred.resolve().promise();
                    }
            Severity: Minor
            Found in src/search/FindInFiles.js - About 1 hr to fix

              Function doSearchInScope has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  function doSearchInScope(queryInfo, scope, filter, replaceText, candidateFilesPromise) {
              Severity: Minor
              Found in src/search/FindInFiles.js - About 35 mins to fix

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

                            if (highlightEndCh <= MAX_DISPLAY_LENGTH) {
                                // Don't store more than 200 chars per line
                                line = line.substr(0, MAX_DISPLAY_LENGTH);
                            } else if (totalMatchLength > MAX_DISPLAY_LENGTH) {
                                // impossible to display the whole match
                Severity: Major
                Found in src/search/FindInFiles.js and 1 other location - About 5 hrs to fix
                src/search/node/FindInFilesDomain.js on lines 128..142

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

                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

                    function filesChanged(fileList) {
                        if (FindUtils.isNodeSearchDisabled() || !fileList || fileList.length === 0) {
                            return;
                        }
                        var updateObject = {
                Severity: Major
                Found in src/search/FindInFiles.js and 1 other location - About 3 hrs to fix
                src/search/FindInFiles.js on lines 692..704

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

                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

                    function filesRemoved(fileList) {
                        if (FindUtils.isNodeSearchDisabled() || !fileList || fileList.length === 0) {
                            return;
                        }
                        var updateObject = {
                Severity: Major
                Found in src/search/FindInFiles.js and 1 other location - About 3 hrs to fix
                src/search/FindInFiles.js on lines 674..686

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

                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

                            matches.push({
                                start:       {line: lineNum, ch: ch},
                                end:         {line: lineNum + numMatchedLines - 1, ch: endCh},
                
                                highlightOffset: highlightOffset,
                Severity: Major
                Found in src/search/FindInFiles.js and 1 other location - About 3 hrs to fix
                src/search/node/FindInFilesDomain.js on lines 144..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 106.

                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

                                        var files = fileListResult
                                            .filter(function (entry) {
                                                return entry.isFile && _isReadableText(entry.fullPath);
                                            })
                                            .map(function (entry) {
                Severity: Major
                Found in src/search/FindInFiles.js and 1 other location - About 1 hr to fix
                src/search/FindInFiles.js on lines 935..939

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

                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

                                files = files.filter(function (entry) {
                                    return entry.isFile && _isReadableText(entry.fullPath);
                                }).map(function (entry) {
                                    return entry.fullPath;
                                });
                Severity: Major
                Found in src/search/FindInFiles.js and 1 other location - About 1 hr to fix
                src/search/FindInFiles.js on lines 519..525

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

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

                        searchDomain.exec("nextPage")
                            .done(function (rcvd_object) {
                                FindUtils.notifyNodeSearchFinished();
                                if (searchModel.results) {
                                    var resultEntry;
                Severity: Minor
                Found in src/search/FindInFiles.js and 1 other location - About 40 mins to fix
                src/search/FindInFiles.js on lines 990..1005

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

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

                        searchDomain.exec("getAllResults")
                            .done(function (rcvd_object) {
                                FindUtils.notifyNodeSearchFinished();
                                searchModel.results = rcvd_object.results;
                                searchModel.numMatches = rcvd_object.numMatches;
                Severity: Minor
                Found in src/search/FindInFiles.js and 1 other location - About 40 mins to fix
                src/search/FindInFiles.js on lines 958..979

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

                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