Showing 1,157 of 1,157 total issues

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

  setSelectedBufferRanges(bufferRanges, options = {}) {
    if (!bufferRanges.length)
      throw new Error('Passed an empty array to setSelectedBufferRanges');

    const selections = this.getSelections();
Severity: Major
Found in src/text-editor.js and 1 other location - About 7 hrs to fix
src/text-editor.js on lines 3550..3570

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

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

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

module.exports = class AtomApplication extends EventEmitter {
  // Public: The entry point into the Atom application.
  static open(options) {
    StartupTime.addMarker('main-process:atom-application:open');

Severity: Major
Found in src/main-process/atom-application.js - About 7 hrs to fix

    Config has 50 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Config {
      static addSchemaEnforcer(typeName, enforcerFunction) {
        if (schemaEnforcers[typeName] == null) {
          schemaEnforcers[typeName] = [];
        }
    Severity: Minor
    Found in src/config.js - About 7 hrs to fix

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

      module.exports = class PaneContainer {
        constructor(params) {
          let applicationDelegate, deserializerManager, notificationManager;
          ({
            config: this.config,
      Severity: Minor
      Found in src/pane-container.js - About 6 hrs to fix

        Function openLocations has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

          async openLocations(locations) {
            const needsProjectPaths =
              this.project && this.project.getPaths().length === 0;
            const foldersToAddToProject = new Set();
            const fileLocationsToOpen = [];
        Severity: Minor
        Found in src/atom-environment.js - About 6 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

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

        module.exports = class AtomWindow extends EventEmitter {
          constructor(atomApplication, fileRecoveryService, settings = {}) {
            StartupTime.addMarker('main-process:atom-window:start');
        
            super();
        Severity: Minor
        Found in src/main-process/atom-window.js - About 6 hrs to fix

          File guide-view.js has 444 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /** @babel */
          /** @jsx etch.dom **/
          
          import etch from 'etch';
          
          
          Severity: Minor
          Found in packages/welcome/lib/guide-view.js - About 6 hrs to fix

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

              moveUp(rowCount = 1, { moveToEndOfSelection } = {}) {
                let row, column;
                const range = this.marker.getScreenRange();
                if (moveToEndOfSelection && !range.isEmpty()) {
                  ({ row, column } = range.start);
            Severity: Major
            Found in src/cursor.js and 1 other location - About 6 hrs to fix
            src/cursor.js on lines 276..291

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

            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

              moveDown(rowCount = 1, { moveToEndOfSelection } = {}) {
                let row, column;
                const range = this.marker.getScreenRange();
                if (moveToEndOfSelection && !range.isEmpty()) {
                  ({ row, column } = range.end);
            Severity: Major
            Found in src/cursor.js and 1 other location - About 6 hrs to fix
            src/cursor.js on lines 253..268

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

            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

            Function seek has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
            Open

              seek(position) {
                this.openScopeIds = [];
                this.closeScopeIds = [];
                this.tagIndex = null;
            
            
            Severity: Minor
            Found in src/text-mate-language-mode.js - About 6 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 164 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              constructor(params = {}) {
                if (this.constructor.clipboard == null) {
                  throw new Error(
                    'Must call TextEditor.setClipboard at least once before creating TextEditor instances'
                  );
            Severity: Major
            Found in src/text-editor.js - About 6 hrs to fix

              Function getFoldableRangesAtIndentLevel has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

                getFoldableRangesAtIndentLevel(goalLevel) {
                  let result = [];
                  let stack = [{ node: this.tree.rootNode, level: 0 }];
                  while (stack.length > 0) {
                    const { node, level } = stack.pop();
              Severity: Minor
              Found in src/tree-sitter-language-mode.js - About 6 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 startEditorWindow has 158 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async startEditorWindow() {
                  StartupTime.addMarker('window:environment:start-editor-window:start');
              
                  if (this.getLoadSettings().clearWindowState) {
                    await this.stateStore.clear();
              Severity: Major
              Found in src/atom-environment.js - About 6 hrs to fix

                File atom-window.js has 429 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                const {
                  BrowserWindow,
                  app,
                  dialog,
                  ipcMain,
                Severity: Minor
                Found in src/main-process/atom-window.js - About 6 hrs to fix

                  Function render has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render() {
                      const {
                        rootComponent,
                        showLineNumbers,
                        height,
                  Severity: Minor
                  Found in src/text-editor-component.js - About 6 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

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

                  'use strict';
                  
                  const { ipcRenderer } = require('electron');
                  const path = require('path');
                  const fs = require('fs-plus');
                  Severity: Minor
                  Found in src/workspace-element.js - About 6 hrs to fix

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

                    module.exports = class Project extends Model {
                      /*
                      Section: Construction and Destruction
                      */
                    
                    
                    Severity: Minor
                    Found in src/project.js - About 6 hrs to fix

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

                        reportFailedAssertion(error) {
                          if (!this.shouldReport(error)) return;
                      
                          this.addPackageMetadata(error);
                          this.addPreviousErrorsMetadata(error);
                      Severity: Major
                      Found in packages/exception-reporting/lib/reporter.js and 1 other location - About 5 hrs to fix
                      packages/exception-reporting/lib/reporter.js on lines 236..258

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

                      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

                        reportUncaughtException(error) {
                          if (!this.shouldReport(error)) return;
                      
                          this.addPackageMetadata(error);
                          this.addPreviousErrorsMetadata(error);
                      Severity: Major
                      Found in packages/exception-reporting/lib/reporter.js and 1 other location - About 5 hrs to fix
                      packages/exception-reporting/lib/reporter.js on lines 260..282

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

                      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

                      Function _populateInjections has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                      Open

                        _populateInjections(range, nodeRangeSet) {
                          const existingInjectionMarkers = this.languageMode.injectionsMarkerLayer
                            .findMarkers({ intersectsRange: range })
                            .filter(marker => marker.parentLanguageLayer === this);
                      
                      
                      Severity: Minor
                      Found in src/tree-sitter-language-mode.js - About 5 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

                      Severity
                      Category
                      Status
                      Source
                      Language