adobe/brackets

View on GitHub
src/languageTools/DefaultProviders.js

Summary

Maintainability
F
5 days
Test Coverage

File DefaultProviders.js has 409 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2019 - present Adobe. 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: Minor
Found in src/languageTools/DefaultProviders.js - About 5 hrs to fix

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

        CodeHintsProvider.prototype.getHints = function (implicitChar) {
            if (!this.client) {
                return null;
            }
    
    
    Severity: Minor
    Found in src/languageTools/DefaultProviders.js - About 1 hr to fix

      Function getParameterHints has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ParameterHintsProvider.prototype.getParameterHints = function () {
              if (!this.client) {
                  return null;
              }
      
      
      Severity: Minor
      Found in src/languageTools/DefaultProviders.js - About 1 hr to fix

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

            JumpToDefProvider.prototype.doJumpToDef = function () {
                if (!this.client) {
                    return null;
                }
        
        
        Severity: Minor
        Found in src/languageTools/DefaultProviders.js - About 1 hr to fix

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

              function serverRespToSearchModelFormat(msgObj) {
                  var referenceModel = {},
                      result = $.Deferred();
          
                  if(!(msgObj && msgObj.length && msgObj.cursorPos)) {
          Severity: Minor
          Found in src/languageTools/DefaultProviders.js - About 1 hr to fix

            Function insertHint has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                CodeHintsProvider.prototype.insertHint = function ($hint) {
                    var editor = EditorManager.getActiveEditor(),
                        cursor = editor.getCursorPos(),
                        token = $hint.data("token"),
                        txt = null,
            Severity: Minor
            Found in src/languageTools/DefaultProviders.js - About 1 hr to fix

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

                  LintingProvider.prototype.setInspectionResults = function (msgObj) {
                      let diagnostics = msgObj.diagnostics,
                          filePath = PathConverters.uriToPath(msgObj.uri),
                          errors = [];
              
              
              Severity: Minor
              Found in src/languageTools/DefaultProviders.js - About 1 hr to fix

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

                        if (token.detail) {
                            if (token.detail.trim() !== '?') {
                                if (token.detail.length < 30) {
                                    $('<span>' + token.detail.split('->').join(':').toString().trim() + '</span>').appendTo($hintObj).addClass("brackets-hints-type-details");
                                }
                Severity: Major
                Found in src/languageTools/DefaultProviders.js and 1 other location - About 1 day to fix
                src/extensions/default/JavaScriptCodeHints/main.js on lines 179..190

                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

                                filteredHints.forEach(function (element) {
                                    var $fHint = $("<span>")
                                        .addClass("brackets-hints");
                
                                    if (element.stringRanges) {
                Severity: Major
                Found in src/languageTools/DefaultProviders.js and 1 other location - About 1 day to fix
                src/extensions/default/PhpTooling/CodeHintsProvider.js on lines 137..158

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

                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

                    function filterWithQueryAndMatcher(hints, query) {
                        var matchResults = $.map(hints, function (hint) {
                            var searchResult = matcher.match(hint.label, query);
                            if (searchResult) {
                                for (var key in hint) {
                Severity: Major
                Found in src/languageTools/DefaultProviders.js and 1 other location - About 2 hrs to fix
                src/extensions/default/PhpTooling/CodeHintsProvider.js on lines 66..79

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

                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

                    CodeHintsProvider.prototype.hasHints = function (editor, implicitChar) {
                        if (!this.client) {
                            return false;
                        }
                
                
                Severity: Major
                Found in src/languageTools/DefaultProviders.js and 1 other location - About 2 hrs to fix
                src/languageTools/DefaultProviders.js on lines 210..221

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

                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

                    ParameterHintsProvider.prototype.hasParameterHints = function (editor, implicitChar) {
                        if (!this.client) {
                            return false;
                        }
                
                
                Severity: Major
                Found in src/languageTools/DefaultProviders.js and 1 other location - About 2 hrs to fix
                src/languageTools/DefaultProviders.js on lines 96..107

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

                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 (token.documentation) {
                            $hintObj.attr('title', token.documentation);
                            $('<span></span>').text(token.documentation.trim()).appendTo($hintObj).addClass("hint-doc");
                        }
                Severity: Major
                Found in src/languageTools/DefaultProviders.js and 1 other location - About 1 hr to fix
                src/extensions/default/JavaScriptCodeHints/main.js on lines 192..195

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

                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

                            end = {
                                line: token.textEdit.range.end.line,
                                ch: token.textEdit.range.end.character
                            };
                Severity: Minor
                Found in src/languageTools/DefaultProviders.js and 1 other location - About 45 mins to fix
                src/languageTools/DefaultProviders.js on lines 187..190

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

                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

                            start = {
                                line: token.textEdit.range.start.line,
                                ch: token.textEdit.range.start.character
                            };
                Severity: Minor
                Found in src/languageTools/DefaultProviders.js and 1 other location - About 45 mins to fix
                src/languageTools/DefaultProviders.js on lines 191..194

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

                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

                            self.query = context.token.string.slice(0, context.pos.ch - context.token.start);
                Severity: Minor
                Found in src/languageTools/DefaultProviders.js and 1 other location - About 40 mins to fix
                src/extensions/default/PhpTooling/CodeHintsProvider.js on lines 109..109

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

                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