matthew-matvei/freeman

View on GitHub

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";
Severity: Minor
Found in src/renderer/components/panels/DirectoryList.tsx - About 6 hrs to fix

    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 };
    
    
    Severity: Minor
    Found in src/renderer/components/panels/DirectoryList.tsx - About 4 hrs to fix

      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 ?
      Severity: Major
      Found in src/renderer/components/wrappers/DirectoryWrapper.tsx - About 2 hrs to fix

        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
        Severity: Minor
        Found in src/renderer/components/App.tsx - About 1 hr to fix

          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 {
          Severity: Minor
          Found in src/renderer/components/blocks/DirectoryItem.tsx - About 1 hr to fix

            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,
            Severity: Minor
            Found in src/renderer/components/blocks/DirectoryItem.tsx - About 1 hr to fix

              Function listDirectory has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public async listDirectory(
                      filePath: string,
                      options: IListDirectoryOptions
                  ): Promise<IDirectoryItem[]> {
              
              
              Severity: Minor
              Found in src/common/managers/DirectoryManager.ts - About 1 hr to fix

                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
                Severity: Minor
                Found in src/renderer/components/panels/DirectoryHeader.tsx - About 1 hr to fix

                  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;
                  
                  
                  Severity: Minor
                  Found in src/renderer/components/panels/DirectoryList.tsx - About 1 hr to fix

                    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">
                    Severity: Minor
                    Found in src/renderer/components/panels/DirectoryList.tsx - About 1 hr to fix

                      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") {
                      Severity: Minor
                      Found in src/renderer/components/blocks/DirectoryItemIcon.tsx - 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 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);
                      Severity: Minor
                      Found in src/renderer/components/panels/DirectoryList.tsx - About 1 hr to fix

                        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}
                        Severity: Major
                        Found in src/renderer/components/blocks/DirectoryItemIcon.tsx - About 1 hr to fix

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

                              public async listDirectory(
                                  filePath: string,
                                  options: IListDirectoryOptions
                              ): Promise<IDirectoryItem[]> {
                          
                          
                          Severity: Minor
                          Found in src/common/managers/DirectoryManager.ts - 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

                          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,
                          Severity: Minor
                          Found in src/renderer/components/blocks/DirectoryItem.tsx - 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

                          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 {
                          Severity: Minor
                          Found in src/common/managers/DirectoryManager.ts - About 25 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 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;
                                  }
                          Severity: Minor
                          Found in src/renderer/components/modals/Goto.tsx - About 25 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 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;
                          
                          
                          Severity: Minor
                          Found in src/renderer/components/panels/DirectoryList.tsx - About 25 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 handleRename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private handleRename(event: React.KeyboardEvent<HTMLInputElement>) {
                                  if (event.key === "Escape") {
                                      return this.props.sendUpRenameItem!();
                                  }
                          
                          
                          Severity: Minor
                          Found in src/renderer/components/blocks/InputItem.tsx - About 25 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 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 {
                          Severity: Minor
                          Found in src/common/managers/DirectoryManager.ts - About 25 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

                          Severity
                          Category
                          Status
                          Source
                          Language