JohnCoates/Aerial

View on GitHub
Aerial/Source/Views/PrefPanel/InfoCommonView.swift

Summary

Maintainability
A
1 hr
Test Coverage

Function setType has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    func setType(_ forType: InfoType, controller: OverlaysViewController) {
        // We need the controller for callbacks, when we update the isEnabled state,
        // we need to update the list view on the left too
        self.controller = controller
        
Severity: Minor
Found in Aerial/Source/Views/PrefPanel/InfoCommonView.swift - About 1 hr to fix

    Single-line comment should start with whitespace
    Open

                //controller.infoBox.title = "Weather provided by OpenWeather"

    comment-whitespace

    Prefer at least one whitespace character after a comment opening symbol (//, ///, /*, or /**) and at least one whitespace character before a comment closing symbol (*/).

    Preferred

    // This is a comment
    
    /// This is a documentation comment
    
    /* This is a
    multi-line comment */
    
    /* This is a
    multi-line comment
    */
    
    /** This is a
    documentation multi-line
    comment
    */

    Not Preferred

    //This is a comment
    
    ///This is a documentation comment
    
    /*This is a
    multi-line comment*/
    
    /**This is a multi-line
    documentation comment */

    Single-line comment should start with whitespace
    Open

                //controller.infoBox.title = "Current date"

    comment-whitespace

    Prefer at least one whitespace character after a comment opening symbol (//, ///, /*, or /**) and at least one whitespace character before a comment closing symbol (*/).

    Preferred

    // This is a comment
    
    /// This is a documentation comment
    
    /* This is a
    multi-line comment */
    
    /* This is a
    multi-line comment
    */
    
    /** This is a
    documentation multi-line
    comment
    */

    Not Preferred

    //This is a comment
    
    ///This is a documentation comment
    
    /*This is a
    multi-line comment*/
    
    /**This is a multi-line
    documentation comment */

    Single-line comment should start with whitespace
    Open

                //controller.infoBox.title = "Updates notifications"

    comment-whitespace

    Prefer at least one whitespace character after a comment opening symbol (//, ///, /*, or /**) and at least one whitespace character before a comment closing symbol (*/).

    Preferred

    // This is a comment
    
    /// This is a documentation comment
    
    /* This is a
    multi-line comment */
    
    /* This is a
    multi-line comment
    */
    
    /** This is a
    documentation multi-line
    comment
    */

    Not Preferred

    //This is a comment
    
    ///This is a documentation comment
    
    /*This is a
    multi-line comment*/
    
    /**This is a multi-line
    documentation comment */

    Single-line comment should start with whitespace
    Open

                //controller.infoBox.title = "Custom message"

    comment-whitespace

    Prefer at least one whitespace character after a comment opening symbol (//, ///, /*, or /**) and at least one whitespace character before a comment closing symbol (*/).

    Preferred

    // This is a comment
    
    /// This is a documentation comment
    
    /* This is a
    multi-line comment */
    
    /* This is a
    multi-line comment
    */
    
    /** This is a
    documentation multi-line
    comment
    */

    Not Preferred

    //This is a comment
    
    ///This is a documentation comment
    
    /*This is a
    multi-line comment*/
    
    /**This is a multi-line
    documentation comment */

    Single-line comment should start with whitespace
    Open

                //controller.infoBox.title = "Current time"

    comment-whitespace

    Prefer at least one whitespace character after a comment opening symbol (//, ///, /*, or /**) and at least one whitespace character before a comment closing symbol (*/).

    Preferred

    // This is a comment
    
    /// This is a documentation comment
    
    /* This is a
    multi-line comment */
    
    /* This is a
    multi-line comment
    */
    
    /** This is a
    documentation multi-line
    comment
    */

    Not Preferred

    //This is a comment
    
    ///This is a documentation comment
    
    /*This is a
    multi-line comment*/
    
    /**This is a multi-line
    documentation comment */

    Function should have at least one blank line after it
    Open

        }

    function-whitespace

    Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.

    Preferred

    func function1() {
      var text = 1
      var text = 2
    }
    
    function1()
    
    // a comment
    func function2() {
      // something goes here
    }
    
    struct SomeStruct {
    
      func function3() {
        // something goes here
      }
    
      func function4() {
        // something else goes here
      };
    
    }
    
    func function5() {
      // something goes here
    }

    Not Preferred

    func function1() {
      var text = 1
      var text = 2
    }
    function1()
    // a comment
    func function2() {
      // something goes here
    }
    
    struct SomeStruct {
      func function3() {
        // something goes here
      }
    
      func function4() {
        // something else goes here
      };
    }
    func function5() {
      // something goes here
    }

    Single-line comment should start with whitespace
    Open

                //controller.infoBox.title = "Video location information"

    comment-whitespace

    Prefer at least one whitespace character after a comment opening symbol (//, ///, /*, or /**) and at least one whitespace character before a comment closing symbol (*/).

    Preferred

    // This is a comment
    
    /// This is a documentation comment
    
    /* This is a
    multi-line comment */
    
    /* This is a
    multi-line comment
    */
    
    /** This is a
    documentation multi-line
    comment
    */

    Not Preferred

    //This is a comment
    
    ///This is a documentation comment
    
    /*This is a
    multi-line comment*/
    
    /**This is a multi-line
    documentation comment */

    Single-line comment should start with whitespace
    Open

                //controller.infoBox.title = "Timer"

    comment-whitespace

    Prefer at least one whitespace character after a comment opening symbol (//, ///, /*, or /**) and at least one whitespace character before a comment closing symbol (*/).

    Preferred

    // This is a comment
    
    /// This is a documentation comment
    
    /* This is a
    multi-line comment */
    
    /* This is a
    multi-line comment
    */
    
    /** This is a
    documentation multi-line
    comment
    */

    Not Preferred

    //This is a comment
    
    ///This is a documentation comment
    
    /*This is a
    multi-line comment*/
    
    /**This is a multi-line
    documentation comment */

    Single-line comment should start with whitespace
    Open

                //controller.infoBox.title = "Countdown to a time/date"

    comment-whitespace

    Prefer at least one whitespace character after a comment opening symbol (//, ///, /*, or /**) and at least one whitespace character before a comment closing symbol (*/).

    Preferred

    // This is a comment
    
    /// This is a documentation comment
    
    /* This is a
    multi-line comment */
    
    /* This is a
    multi-line comment
    */
    
    /** This is a
    documentation multi-line
    comment
    */

    Not Preferred

    //This is a comment
    
    ///This is a documentation comment
    
    /*This is a
    multi-line comment*/
    
    /**This is a multi-line
    documentation comment */

    Function should have at least one blank line before it
    Open

        func validModesForFontPanel(_ fontPanel: NSFontPanel) -> NSFontPanel.ModeMask {

    function-whitespace

    Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.

    Preferred

    func function1() {
      var text = 1
      var text = 2
    }
    
    function1()
    
    // a comment
    func function2() {
      // something goes here
    }
    
    struct SomeStruct {
    
      func function3() {
        // something goes here
      }
    
      func function4() {
        // something else goes here
      };
    
    }
    
    func function5() {
      // something goes here
    }

    Not Preferred

    func function1() {
      var text = 1
      var text = 2
    }
    function1()
    // a comment
    func function2() {
      // something goes here
    }
    
    struct SomeStruct {
      func function3() {
        // something goes here
      }
    
      func function4() {
        // something else goes here
      };
    }
    func function5() {
      // something goes here
    }

    Line should not have any trailing whitespace
    Open

            

    trailing-whitespace

    Flag whitespace after the last non-whitespace character on each line until the newline.

    Preferred

    let number = 42¬

    Not Preferred

    let number = 42••¬

    Single-line comment should start with whitespace
    Open

                //controller.infoBox.title = "Music"

    comment-whitespace

    Prefer at least one whitespace character after a comment opening symbol (//, ///, /*, or /**) and at least one whitespace character before a comment closing symbol (*/).

    Preferred

    // This is a comment
    
    /// This is a documentation comment
    
    /* This is a
    multi-line comment */
    
    /* This is a
    multi-line comment
    */
    
    /** This is a
    documentation multi-line
    comment
    */

    Not Preferred

    //This is a comment
    
    ///This is a documentation comment
    
    /*This is a
    multi-line comment*/
    
    /**This is a multi-line
    documentation comment */

    Single-line comment should start with whitespace
    Open

                //controller.infoBox.title = "Battery status"

    comment-whitespace

    Prefer at least one whitespace character after a comment opening symbol (//, ///, /*, or /**) and at least one whitespace character before a comment closing symbol (*/).

    Preferred

    // This is a comment
    
    /// This is a documentation comment
    
    /* This is a
    multi-line comment */
    
    /* This is a
    multi-line comment
    */
    
    /** This is a
    documentation multi-line
    comment
    */

    Not Preferred

    //This is a comment
    
    ///This is a documentation comment
    
    /*This is a
    multi-line comment*/
    
    /**This is a multi-line
    documentation comment */

    Function should have at least one blank line after it
    Open

        }

    function-whitespace

    Every function and method declaration should have one blank line before and after itself. An exception to this rule are functions that are declared at the start of a file (only need one blank line after their declaration) or at the end of a file (only need one blank line before their declaration). Comments immediately before a function declaration (no blank lines between them and the function) are considered to be part of the declaration.

    Preferred

    func function1() {
      var text = 1
      var text = 2
    }
    
    function1()
    
    // a comment
    func function2() {
      // something goes here
    }
    
    struct SomeStruct {
    
      func function3() {
        // something goes here
      }
    
      func function4() {
        // something else goes here
      };
    
    }
    
    func function5() {
      // something goes here
    }

    Not Preferred

    func function1() {
      var text = 1
      var text = 2
    }
    function1()
    // a comment
    func function2() {
      // something goes here
    }
    
    struct SomeStruct {
      func function3() {
        // something goes here
      }
    
      func function4() {
        // something else goes here
      };
    }
    func function5() {
      // something goes here
    }

    There are no issues that match your filters.

    Category
    Status