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();
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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');
Config
has 50 functions (exceeds 20 allowed). Consider refactoring. Open
class Config {
static addSchemaEnforcer(typeName, enforcerFunction) {
if (schemaEnforcers[typeName] == null) {
schemaEnforcers[typeName] = [];
}
exports
has 49 functions (exceeds 20 allowed). Consider refactoring. Open
module.exports = class PaneContainer {
constructor(params) {
let applicationDelegate, deserializerManager, notificationManager;
({
config: this.config,
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 = [];
- Read upRead up
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();
File guide-view.js
has 444 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** @babel */
/** @jsx etch.dom **/
import etch from 'etch';
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);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function seek
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
seek(position) {
this.openScopeIds = [];
this.closeScopeIds = [];
this.tagIndex = null;
- Read upRead up
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'
);
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();
- Read upRead up
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();
File atom-window.js
has 429 lines of code (exceeds 250 allowed). Consider refactoring. Open
const {
BrowserWindow,
app,
dialog,
ipcMain,
Function render
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
rootComponent,
showLineNumbers,
height,
- Read upRead up
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');
exports
has 44 functions (exceeds 20 allowed). Consider refactoring. Open
module.exports = class Project extends Model {
/*
Section: Construction and Destruction
*/
Similar blocks of code found in 2 locations. Consider refactoring. Open
reportFailedAssertion(error) {
if (!this.shouldReport(error)) return;
this.addPackageMetadata(error);
this.addPreviousErrorsMetadata(error);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
reportUncaughtException(error) {
if (!this.shouldReport(error)) return;
this.addPackageMetadata(error);
this.addPreviousErrorsMetadata(error);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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);
- Read upRead up
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"