func testForWhereLoop()

in SwiftlintTemplate/ViewController.swift [103:173]


    func testForWhereLoop() {
        let collection = [1, 2, 3]
        
        for item in collection where item == 2 {
          
        }
   
    // MARK: OPT IN RULE TESTS
    
    // SWIFTLINT: operator_usage_whitespace
    /// Guide Rule: "On both sides of any binary or ternary operator, including the operator-like symbols (eg. =, &, ==, →).
    let operatorTest1 = true
    let operatorTest2=false // Warning
    
    // SWIFTLINT: multiline_parameters
    /// Guide Rule: "When a function call is line-wrapped, each argument is written on its own line, indented +2 from the original line."
    func test1( // Warning
      veryLongVariableName1: Int,
      veryLongVariableName2: Int, veryLongVariableName3: Int) {
          print("Hello world")

        }
    
    // No Warning
    func test2(
        veryLongVariableName1: Int,
        veryLongVariableName2: Int,
        veryLongVariableName3: Int) {}
    
    // SWIFTLINT: implicitly_unwrapped_optional
    /// Guide Rule: "Implicitly unwrapped optionals are inherently unsafe and should be avoided whenever possible.
    func test3() {
        let int: Int! = nil // Warning
    }
    

    // Swiftlint: modifier_order
    // Guide Rule: "When using access modifiers, write the keyword first."
    

    // Correct
    let initialFactor1 = 2  // Comment
     
    //  Incorrect
    let initialFactor2 = 2 //    Comment
 
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.

    // SWIFTLINT: modifier_order
    /// Guide Rule: "When using access modifiers, write the keyword first."

    private static let firstValue: Int = 20
    static private let secondValue: Int = 20 // Warning

}
    // SWIFTLINT: no_extension_access_modifier
    // Guide Rule: "Specifying an explicit access level at the file level on an extension is forbidden."

        // Correct
        extension String {

        }
     
//     // Error Warning (uncomment to test)
//     public extension String {
//
//     }
   
    }