src/workspace.js

Summary

Maintainability
F
2 wks
Test Coverage

File workspace.js has 1376 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const _ = require('underscore-plus');
const url = require('url');
const path = require('path');
const { Emitter, Disposable, CompositeDisposable } = require('event-kit');
const fs = require('fs-plus');
Severity: Major
Found in src/workspace.js - About 3 days to fix

    exports has 109 functions (exceeds 20 allowed). Consider refactoring.
    Open

    module.exports = class Workspace extends Model {
      constructor(params) {
        super(...arguments);
    
        this.updateWindowTitle = this.updateWindowTitle.bind(this);
    Severity: Major
    Found in src/workspace.js - About 2 days to fix

      Function open has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
      Open

        async open(itemOrURI, options = {}) {
          let uri, item;
          if (typeof itemOrURI === 'string') {
            uri = this.project.resolvePath(itemOrURI);
          } else if (itemOrURI) {
      Severity: Minor
      Found in src/workspace.js - About 1 day 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 open has 144 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async open(itemOrURI, options = {}) {
          let uri, item;
          if (typeof itemOrURI === 'string') {
            uri = this.project.resolvePath(itemOrURI);
          } else if (itemOrURI) {
      Severity: Major
      Found in src/workspace.js - About 5 hrs to fix

        Function scan has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

          scan(regex, options = {}, iterator) {
            if (_.isFunction(options)) {
              iterator = options;
              options = {};
            }
        Severity: Minor
        Found in src/workspace.js - About 4 hrs 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 scan has 105 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          scan(regex, options = {}, iterator) {
            if (_.isFunction(options)) {
              iterator = options;
              options = {};
            }
        Severity: Major
        Found in src/workspace.js - About 4 hrs to fix

          Function updateWindowTitle has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

            updateWindowTitle() {
              let itemPath, itemTitle, projectPath, representedPath;
              const appName = atom.getAppName();
              const left = this.project.getPaths();
              const projectPaths = left != null ? left : [];
          Severity: Minor
          Found in src/workspace.js - About 3 hrs 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 constructor has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(params) {
              super(...arguments);
          
              this.updateWindowTitle = this.updateWindowTitle.bind(this);
              this.updateDocumentEdited = this.updateDocumentEdited.bind(this);
          Severity: Major
          Found in src/workspace.js - About 2 hrs to fix

            Function hide has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

              hide(itemOrURI) {
                let foundItems = false;
            
                // If any visible item has the given URI, hide it
                for (const container of this.getPaneContainers()) {
            Severity: Minor
            Found in src/workspace.js - About 2 hrs 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 reset has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              reset(packageManager) {
                this.packageManager = packageManager;
                this.emitter.dispose();
                this.emitter = new Emitter();
            
            
            Severity: Major
            Found in src/workspace.js - About 2 hrs to fix

              Function updateWindowTitle has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                updateWindowTitle() {
                  let itemPath, itemTitle, projectPath, representedPath;
                  const appName = atom.getAppName();
                  const left = this.project.getPaths();
                  const projectPaths = left != null ? left : [];
              Severity: Major
              Found in src/workspace.js - About 2 hrs to fix

                Function didChangeActivePaneItem has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                  didChangeActivePaneItem(item) {
                    this.updateWindowTitle();
                    this.updateDocumentEdited();
                    if (this.activeItemSubscriptions) this.activeItemSubscriptions.dispose();
                    this.activeItemSubscriptions = new CompositeDisposable();
                Severity: Minor
                Found in src/workspace.js - About 2 hrs 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 getPackageNamesWithActiveGrammars has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                  getPackageNamesWithActiveGrammars() {
                    const packageNames = [];
                    const addGrammar = ({ includedGrammarScopes, packageName } = {}) => {
                      if (!packageName) {
                        return;
                Severity: Minor
                Found in src/workspace.js - About 2 hrs 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 replace has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  replace(regex, replacementText, filePaths, iterator) {
                    return new Promise((resolve, reject) => {
                      let buffer;
                      const openPaths = this.project
                        .getBuffers()
                Severity: Minor
                Found in src/workspace.js - About 1 hr to fix

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

                    didChangeActivePaneItem(item) {
                      this.updateWindowTitle();
                      this.updateDocumentEdited();
                      if (this.activeItemSubscriptions) this.activeItemSubscriptions.dispose();
                      this.activeItemSubscriptions = new CompositeDisposable();
                  Severity: Minor
                  Found in src/workspace.js - About 1 hr to fix

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

                      async createItemForURI(uri, options) {
                        if (uri != null) {
                          for (const opener of this.getOpeners()) {
                            const item = opener(uri, options);
                            if (item != null) return item;
                    Severity: Minor
                    Found in src/workspace.js - About 1 hr to fix

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

                        deserialize(state, deserializerManager) {
                          const packagesWithActiveGrammars =
                            state.packagesWithActiveGrammars != null
                              ? state.packagesWithActiveGrammars
                              : [];
                      Severity: Minor
                      Found in src/workspace.js - About 1 hr to fix

                        Function openTextFile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          async openTextFile(uri, options) {
                            const filePath = this.project.resolvePath(uri);
                        
                            if (filePath != null) {
                              try {
                        Severity: Minor
                        Found in src/workspace.js - About 1 hr to fix

                          Function createItemForURI has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                            async createItemForURI(uri, options) {
                              if (uri != null) {
                                for (const opener of this.getOpeners()) {
                                  const item = opener(uri, options);
                                  if (item != null) return item;
                          Severity: Minor
                          Found in src/workspace.js - About 1 hr 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 openSync has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            openSync(uri_ = '', options = {}) {
                              const { initialLine, initialColumn } = options;
                              const activatePane =
                                options.activatePane != null ? options.activatePane : true;
                              const activateItem =
                          Severity: Minor
                          Found in src/workspace.js - About 1 hr 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 getPackageNamesWithActiveGrammars has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            getPackageNamesWithActiveGrammars() {
                              const packageNames = [];
                              const addGrammar = ({ includedGrammarScopes, packageName } = {}) => {
                                if (!packageName) {
                                  return;
                          Severity: Minor
                          Found in src/workspace.js - About 1 hr to fix

                            Function didChangeActivePaneItemOnPaneContainer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              didChangeActivePaneItemOnPaneContainer(paneContainer, item) {
                                if (paneContainer === this.getActivePaneContainer()) {
                                  this.didChangeActivePaneItem(item);
                                  this.emitter.emit('did-change-active-pane-item', item);
                                }
                            Severity: Minor
                            Found in src/workspace.js - About 45 mins 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

                            Avoid deeply nested control flow statements.
                            Open

                                        if (isCenter) {
                                          pane.destroyItem(activeItem);
                                        } else {
                                          container.hide();
                                        }
                            Severity: Major
                            Found in src/workspace.js - About 45 mins to fix

                              Function checkoutHeadRevision has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                checkoutHeadRevision(editor) {
                                  if (editor.getPath()) {
                                    const checkoutHead = async () => {
                                      const repository = await this.project.repositoryForDirectory(
                                        new Directory(editor.getDirectoryPath())
                              Severity: Minor
                              Found in src/workspace.js - About 35 mins 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 deserialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                deserialize(state, deserializerManager) {
                                  const packagesWithActiveGrammars =
                                    state.packagesWithActiveGrammars != null
                                      ? state.packagesWithActiveGrammars
                                      : [];
                              Severity: Minor
                              Found in src/workspace.js - About 35 mins 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 openTextFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                async openTextFile(uri, options) {
                                  const filePath = this.project.resolvePath(uri);
                              
                                  if (filePath != null) {
                                    try {
                              Severity: Minor
                              Found in src/workspace.js - About 35 mins 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

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

                                  this.panelContainers = {
                                    top: new PanelContainer({
                                      viewRegistry: this.viewRegistry,
                                      location: 'top'
                                    }),
                              Severity: Major
                              Found in src/workspace.js and 1 other location - About 1 day to fix
                              src/workspace.js on lines 332..364

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 219.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

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

                                  this.panelContainers = {
                                    top: new PanelContainer({
                                      viewRegistry: this.viewRegistry,
                                      location: 'top'
                                    }),
                              Severity: Major
                              Found in src/workspace.js and 1 other location - About 1 day to fix
                              src/workspace.js on lines 224..256

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 219.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

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

                                  if (item != null && typeof item.onDidChangeTitle === 'function') {
                                    titleSubscription = item.onDidChangeTitle(this.updateWindowTitle);
                                  } else if (item != null && typeof item.on === 'function') {
                                    titleSubscription = item.on('title-changed', this.updateWindowTitle);
                                    if (
                              Severity: Major
                              Found in src/workspace.js and 1 other location - About 5 hrs to fix
                              src/workspace.js on lines 556..573

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

                              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 (item != null && typeof item.onDidChangeModified === 'function') {
                                    modifiedSubscription = item.onDidChangeModified(
                                      this.updateDocumentEdited
                                    );
                                  } else if (item != null && typeof item.on === 'function') {
                              Severity: Major
                              Found in src/workspace.js and 1 other location - About 5 hrs to fix
                              src/workspace.js on lines 542..554

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

                              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

                                  return new WorkspaceCenter({
                                    config: this.config,
                                    applicationDelegate: this.applicationDelegate,
                                    notificationManager: this.notificationManager,
                                    deserializerManager: this.deserializerManager,
                              Severity: Major
                              Found in src/workspace.js and 1 other location - About 2 hrs to fix
                              src/atom-environment.js on lines 128..138

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

                              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

                                        switch (options.split) {
                                          case 'left':
                                            pane = pane.findLeftmostSibling();
                                            break;
                                          case 'right':
                              Severity: Major
                              Found in src/workspace.js and 1 other location - About 2 hrs to fix
                              src/workspace.js on lines 1129..1142

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

                              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

                                        switch (options.split) {
                                          case 'left':
                                            pane = pane.findLeftmostSibling();
                                            break;
                                          case 'right':
                              Severity: Major
                              Found in src/workspace.js and 1 other location - About 2 hrs to fix
                              src/workspace.js on lines 1185..1198

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

                              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

                                  this.paneContainers = {
                                    center: this.createCenter(),
                                    left: this.createDock('left'),
                                    right: this.createDock('right'),
                                    bottom: this.createDock('bottom')
                              Severity: Major
                              Found in src/workspace.js and 1 other location - About 1 hr to fix
                              src/workspace.js on lines 215..220

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

                              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

                                onDidDestroyPane(callback) {
                                  return new CompositeDisposable(
                                    ...this.getPaneContainers().map(container =>
                                      container.onDidDestroyPane(callback)
                                    )
                              Severity: Major
                              Found in src/workspace.js and 1 other location - About 1 hr to fix
                              src/workspace.js on lines 900..906

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

                              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

                                  this.paneContainers = {
                                    center: this.createCenter(),
                                    left: this.createDock('left'),
                                    right: this.createDock('right'),
                                    bottom: this.createDock('bottom')
                              Severity: Major
                              Found in src/workspace.js and 1 other location - About 1 hr to fix
                              src/workspace.js on lines 323..328

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

                              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

                                onWillDestroyPane(callback) {
                                  return new CompositeDisposable(
                                    ...this.getPaneContainers().map(container =>
                                      container.onWillDestroyPane(callback)
                                    )
                              Severity: Major
                              Found in src/workspace.js and 1 other location - About 1 hr to fix
                              src/workspace.js on lines 916..922

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

                              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

                                  if (typeof item.getURI === 'function') {
                                    uri = item.getURI();
                                  } else if (typeof item.getUri === 'function') {
                                    uri = item.getUri();
                                  }
                              Severity: Major
                              Found in src/workspace.js and 2 other locations - About 1 hr to fix
                              src/pane.js on lines 981..985
                              src/workspace.js on lines 1759..1763

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

                              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

                                  if (typeof item.getURI === 'function') {
                                    uri = item.getURI();
                                  } else if (typeof item.getUri === 'function') {
                                    uri = item.getUri();
                                  }
                              Severity: Major
                              Found in src/workspace.js and 2 other locations - About 1 hr to fix
                              src/pane.js on lines 981..985
                              src/workspace.js on lines 1773..1777

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

                              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

                                paneForItem(item) {
                                  for (let location of this.getPaneContainers()) {
                                    const pane = location.paneForItem(item);
                                    if (pane != null) {
                                      return pane;
                              Severity: Minor
                              Found in src/workspace.js and 1 other location - About 55 mins to fix
                              src/workspace.js on lines 1690..1697

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

                              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

                                paneForURI(uri) {
                                  for (let location of this.getPaneContainers()) {
                                    const pane = location.paneForURI(uri);
                                    if (pane != null) {
                                      return pane;
                              Severity: Minor
                              Found in src/workspace.js and 1 other location - About 55 mins to fix
                              src/workspace.js on lines 1704..1711

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

                              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.stoppedChangingActivePaneItemTimeout = setTimeout(() => {
                                    this.stoppedChangingActivePaneItemTimeout = null;
                                    this.emitter.emit('did-stop-changing-active-pane-item', item);
                                  }, STOPPED_CHANGING_ACTIVE_PANE_ITEM_DELAY);
                              Severity: Minor
                              Found in src/workspace.js and 1 other location - About 40 mins to fix
                              src/pane-container.js on lines 338..341

                              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