JohnCoates/Aerial

View on GitHub
Resources/MainUI/VideosViewController.swift

Summary

Maintainability
F
4 days
Test Coverage

File VideosViewController.swift has 551 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Cocoa
import AVKit

// swiftlint:disable:next type_body_length
class VideosViewController: NSViewController {
Severity: Major
Found in Resources/MainUI/VideosViewController.swift - About 1 day to fix

    VideosViewController has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class VideosViewController: NSViewController {
        // Top rotation view
        @IBOutlet var rotationView: NSView!
        @IBOutlet var rotationPopup: NSPopUpButton!
        @IBOutlet var rotationImage: NSImageView!
    Severity: Minor
    Found in Resources/MainUI/VideosViewController.swift - About 3 hrs to fix

      Function showVideo has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          func showVideo(_ video: AerialVideo) {
              playbackSpeedLabel.isHidden = false
              playbackSpeedSlider.isHidden = false
      
              
      Severity: Minor
      Found in Resources/MainUI/VideosViewController.swift - About 2 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 updateVideoView has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          func updateVideoView() {
              if let video = getSelectedVideo() {
                  debugLog("\"\(video.id)\": \"sunrise\", // \(video.name) - \(video.secondaryName)")
                  debugLog("\"\(video.id)\": \"sunset\", // \(video.name) - \(video.secondaryName)")
                  debugLog("\"\(video.id)\": \"night\", // \(video.name) - \(video.secondaryName)")
      Severity: Minor
      Found in Resources/MainUI/VideosViewController.swift - About 2 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 tableView has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
              guard let path = path else {
                  return nil
              }
      
      
      Severity: Minor
      Found in Resources/MainUI/VideosViewController.swift - About 2 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 showVideo has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          func showVideo(_ video: AerialVideo) {
              playbackSpeedLabel.isHidden = false
              playbackSpeedSlider.isHidden = false
      
              
      Severity: Major
      Found in Resources/MainUI/VideosViewController.swift - About 2 hrs to fix

        Function getSelectedVideo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            func getSelectedVideo() -> AerialVideo? {
                if let path = path {
                    if videoListTableView.selectedRow > -1 {
                        if let mode = VideoList.instance.modeFromPath(path) {
                            let index = Int(path.split(separator: ":")[1])!
        Severity: Minor
        Found in Resources/MainUI/VideosViewController.swift - About 2 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 updateVideoView has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            func updateVideoView() {
                if let video = getSelectedVideo() {
                    debugLog("\"\(video.id)\": \"sunrise\", // \(video.name) - \(video.secondaryName)")
                    debugLog("\"\(video.id)\": \"sunset\", // \(video.name) - \(video.secondaryName)")
                    debugLog("\"\(video.id)\": \"night\", // \(video.name) - \(video.secondaryName)")
        Severity: Minor
        Found in Resources/MainUI/VideosViewController.swift - About 1 hr to fix

          Function tableView has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
                  guard let path = path else {
                      return nil
                  }
          
          
          Severity: Minor
          Found in Resources/MainUI/VideosViewController.swift - About 1 hr to fix

            Function updateRuntimeLabel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                func updateRuntimeLabel() {
                    guard let path = self.path else {
                        videoListRuntimeLabel.stringValue = ""
                        return
                    }
            Severity: Minor
            Found in Resources/MainUI/VideosViewController.swift - About 1 hr to fix

              Function showImage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  func showImage(_ video: AerialVideo) {
                      heroPlayerView.isHidden = true
                      heroImageView.isHidden = false
                      isCachedImageView.isHidden = true
              
              
              Severity: Minor
              Found in Resources/MainUI/VideosViewController.swift - About 1 hr to fix

                Function rotationPopupChange has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @IBAction func rotationPopupChange(_ sender: NSPopUpButton) {
                
                        switch sender.indexOfSelectedItem {
                        case 0:
                            mode = "all"
                Severity: Minor
                Found in Resources/MainUI/VideosViewController.swift - About 1 hr to fix

                  Function updateRuntimeLabel has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      func updateRuntimeLabel() {
                          guard let path = self.path else {
                              videoListRuntimeLabel.stringValue = ""
                              return
                          }
                  Severity: Minor
                  Found in Resources/MainUI/VideosViewController.swift - About 55 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 showImage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      func showImage(_ video: AerialVideo) {
                          heroPlayerView.isHidden = true
                          heroImageView.isHidden = false
                          isCachedImageView.isHidden = true
                  
                  
                  Severity: Minor
                  Found in Resources/MainUI/VideosViewController.swift - 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 reloadPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      func reloadPath(path: String) {
                          if let foundMode = VideoList.instance.modeFromPath(path) {
                              switchMainTo(filter: foundMode)
                  
                              rotationPopupChange(rotationPopup)
                  Severity: Minor
                  Found in Resources/MainUI/VideosViewController.swift - 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

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

                          if let mode = VideoList.instance.modeFromPath(path) {
                              let index = Int(path.split(separator: ":")[1])!
                              return VideoList.instance.getVideosCountForSource(index, mode: mode)
                          } else {
                              // all
                  Severity: Minor
                  Found in Resources/MainUI/VideosViewController.swift and 1 other location - About 40 mins to fix
                  Aerial/Source/Models/Sources/VideoList.swift on lines 242..248

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

                  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

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

                              video = VideoList.instance.videos.filter({ !PrefsVideos.hidden.contains($0.id) }).sorted { $0.secondaryName < $1.secondaryName }[row]
                  Severity: Minor
                  Found in Resources/MainUI/VideosViewController.swift and 1 other location - About 35 mins to fix
                  Resources/MainUI/VideosViewController.swift on lines 583..585

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

                  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

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

                                          return VideoList.instance.videos
                                              .filter({ !PrefsVideos.hidden.contains($0.id) })
                                              .sorted { $0.secondaryName < $1.secondaryName }[videoListTableView.selectedRow]
                  Severity: Minor
                  Found in Resources/MainUI/VideosViewController.swift and 1 other location - About 35 mins to fix
                  Resources/MainUI/VideosViewController.swift on lines 712..712

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

                  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 should have at least one blank line before it
                  Open

                      func reloadPath(path: String) {

                  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
                  }

                  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

                              //print(subpath)

                  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
                  }

                  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••¬

                  Closure is the function's final argument and may be passed as a trailing closure instead
                  Open

                                              .filter({ !PrefsVideos.hidden.contains($0.id) })

                  trailing-closure

                  Closures that are the last argument of a function should be passed into the function using trailing closure syntax.

                  Preferred

                  reversed = names.sort { s1, s2 in return s1 > s2 }

                  Not Preferred

                  reversed = names.sort({ s1, s2 in return s1 > s2 })

                  Function should have at least one blank line before it
                  Open

                      func numberOfRows(in tableView: NSTableView) -> Int {

                  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
                  }

                  Closure is the function's final argument and may be passed as a trailing closure instead
                  Open

                              return VideoList.instance.videos.filter({ !PrefsVideos.hidden.contains($0.id) }).count

                  trailing-closure

                  Closures that are the last argument of a function should be passed into the function using trailing closure syntax.

                  Preferred

                  reversed = names.sort { s1, s2 in return s1 > s2 }

                  Not Preferred

                  reversed = names.sort({ s1, s2 in return s1 > s2 })

                  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
                  }

                  Closure is the function's final argument and may be passed as a trailing closure instead
                  Open

                              video = VideoList.instance.videos.filter({ !PrefsVideos.hidden.contains($0.id) }).sorted { $0.secondaryName < $1.secondaryName }[row]

                  trailing-closure

                  Closures that are the last argument of a function should be passed into the function using trailing closure syntax.

                  Preferred

                  reversed = names.sort { s1, s2 in return s1 > s2 }

                  Not Preferred

                  reversed = names.sort({ s1, s2 in return s1 > s2 })

                  Multiline comment should end with whitespace
                  Open

                          }*/

                  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 */

                  Multiline comment should end with whitespace
                  Open

                          }*/

                  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
                  }

                  Function should have at least one blank line before it
                  Open

                      func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {

                  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
                  }

                  Closure is the function's final argument and may be passed as a trailing closure instead
                  Open

                              videos = VideoList.instance.videos.filter({ !PrefsVideos.hidden.contains($0.id) }).sorted { $0.secondaryName < $1.secondaryName }

                  trailing-closure

                  Closures that are the last argument of a function should be passed into the function using trailing closure syntax.

                  Preferred

                  reversed = names.sort { s1, s2 in return s1 > s2 }

                  Not Preferred

                  reversed = names.sort({ s1, s2 in return s1 > s2 })

                  Closure is the function's final argument and may be passed as a trailing closure instead
                  Open

                              for video in VideoList.instance.currentRotation().filter({ !$0.isAvailableOffline }) {

                  trailing-closure

                  Closures that are the last argument of a function should be passed into the function using trailing closure syntax.

                  Preferred

                  reversed = names.sort { s1, s2 in return s1 > s2 }

                  Not Preferred

                  reversed = names.sort({ s1, s2 in return s1 > s2 })

                  Single-line comment should start with whitespace
                  Open

                          //print("tv path : " + path)

                  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

                                      //print(VideoList.instance.videos.count)

                  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

                          //print("nor path : " + path)

                  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 */

                  There are no issues that match your filters.

                  Category
                  Status