Showing 21 of 51 total issues
File DirectoryList.tsx
has 424 lines of code (exceeds 250 allowed). Consider refactoring. Open
import autobind from "autobind-decorator";
import { remote } from "electron";
import { List } from "immutable";
import path from "path";
import * as PropTypes from "prop-types";
DirectoryList
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class DirectoryList extends React.Component<IDirectoryListProps, IDirectoryListState> {
/** Context available within a ScrollArea. */
public context: { scrollArea: any };
Function render
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public render(): JSX.Element {
const scrollAreaVertBarStyle: React.CSSProperties = {
backgroundColor: "rgb(65, 67, 57)"
};
const directoryListHeight = this.state.isTerminalOpen ?
Function render
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public render(): JSX.Element {
const { directoryManager, keysManager, settingsManager, themeManager } = this.props;
const appStyle = { color: themeManager.theme.primaryColour };
const resizerStyle: React.CSSProperties = {
backgroundColor: this.props.themeManager.theme.resizers.colour
Function render
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public render(): JSX.Element {
const { isSelected, model } = this.props;
const selectedClass = isSelected ? "selected" : "";
const {
Function itemStyles
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private get itemStyles(): IDirectoryItemStyles {
const { isSelected, model, theme } = this.props;
const {
fileColour,
directoryColour,
Function listDirectory
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async listDirectory(
filePath: string,
options: IListDirectoryOptions
): Promise<IDirectoryItem[]> {
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public render(): JSX.Element {
const directoryHeaderStyles: React.CSSProperties = {
background: this.props.theme.directoryHeader.backgroundColour,
boxShadow: `0 5px 5px ${this.props.theme.directoryItem.backgroundColour}`,
color: this.props.theme.directoryHeader.foregroundColour
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public render(): JSX.Element {
const items = this.renderItems();
return (
<div className="DirectoryList">
Function pasteFromClipboard
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
@autobind
private async pasteFromClipboard() {
const { directoryManager, settingsManager } = this.props;
const { clipboardAction, clipboardItems } = this.model;
Function render
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public render(): JSX.Element {
const { directoryItem, directoryItemType, theme } = this.props;
const { directoryItemIcon } = theme;
if (directoryItem && directoryItem.isDirectory || directoryItemType === "folder") {
- 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 componentDidUpdate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async componentDidUpdate(prevProps: IDirectoryListProps, prevState: IDirectoryListState) {
const { directoryManager, settingsManager } = this.props;
this.props.statusNotifier.setItemCount(this.nonHiddenDirectoryItems.length);
this.props.statusNotifier.setChosenCount(this.state.chosenItems.length);
Consider simplifying this complex logical expression. Open
if (directoryItem && !directoryItem.isDirectory || directoryItemType === "file") {
const className = directoryItem && fileIcons.getClassWithColor(directoryItem.path);
return className ?
<i style={this.iconStyles}
Function itemStyles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private get itemStyles(): IDirectoryItemStyles {
const { isSelected, model, theme } = this.props;
const {
fileColour,
directoryColour,
- 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 listDirectory
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public async listDirectory(
filePath: string,
options: IListDirectoryOptions
): Promise<IDirectoryItem[]> {
- 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 pasteFromClipboard
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@autobind
private async pasteFromClipboard() {
const { directoryManager, settingsManager } = this.props;
const { clipboardAction, clipboardItems } = this.model;
- 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 move
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@autobind
private move(direction: DirectoryDirection) {
if (direction === "up") {
if (this.state.selectedIndex > 0) {
this.setState(prevState => ({ selectedIndex: prevState.selectedIndex - 1 } as IDirectoryListState));
- 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 handleKeyUp
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@autobind
private async handleKeyUp(event: React.KeyboardEvent<HTMLInputElement>) {
if (event.key === "up" || event.key === "down") {
return;
}
- 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 createItem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public async createItem(itemName: string, itemPath: string, itemType: ItemType): Promise<void> {
const fullItemName = path.join(itemPath, itemName);
if (itemType === "folder") {
try {
- 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 deleteItem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private async deleteItem(itemPath: string, itemType: ItemType): Promise<void> {
if (itemType === "folder") {
try {
await this.fileSystemWrapper.rmdirAsync(itemPath);
} catch {
- 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"