Skip to content

Commit

Permalink
Swiftlint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Palaguta committed Feb 15, 2019
1 parent 3684715 commit 9c39a21
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 21 deletions.
4 changes: 0 additions & 4 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ opt_in_rules:
- explicit_init
- fallthrough
- fatal_error_message
# - file_header
- first_where
- force_unwrapping
- function_default_parameter_at_end
Expand Down Expand Up @@ -94,9 +93,6 @@ opt_in_rules:
excluded:
- .git
- .build
- Package.swift
- SampleOutput
- Tests

custom_rules:
tabs:
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ let package = Package(
products: [
.executable(name: "motoswift", targets: ["motoswift"]),
.library(name: "MotoSwiftFramework", targets: ["MotoSwiftFramework"])
],
],
dependencies: [
.package(url: "https://github.com/SwiftGen/StencilSwiftKit.git", from: "2.7.0"),
.package(url: "https://github.com/kylef/Commander.git", from: "0.8.0"),
.package(url: "https://github.com/drmohundro/SWXMLHash.git", from: "4.7.0"),
.package(url: "https://github.com/kylef/Spectre", from: "0.8.0")
],
],
targets: [
.target(name: "MotoSwiftFramework", dependencies: ["StencilSwiftKit", "SWXMLHash"]),
.target(name: "motoswift", dependencies: ["MotoSwiftFramework", "Commander"]),
Expand Down
1 change: 1 addition & 0 deletions SampleOutput/Model/Model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
// swiftlint:disable file_length
// swiftlint:disable type_body_length
// swiftlint:disable nesting
// swiftlint:disable trailing_newline
public struct CoreDataEntity {
public struct AllTypes {
public static let name = "AllTypes"
Expand Down
4 changes: 2 additions & 2 deletions SampleOutput/Mogenerator/Machine/_AllTypesClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable type_body_length
// swiftlint:disable vertical_whitespace
public enum AllTypesClassAttributes: String {
case data
case date
Expand All @@ -21,8 +22,7 @@ public enum AllTypesClassRelationships: String {

// swiftlint:disable type_name
public class _AllTypesClass: NumericTypesClass {
@objc
override public class var entityName: String {
@objc override public class var entityName: String {
return "AllTypes"
}

Expand Down
4 changes: 2 additions & 2 deletions SampleOutput/Mogenerator/Machine/_NumericTypesClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable type_body_length
// swiftlint:disable vertical_whitespace
public enum NumericTypesClassAttributes: String {
case boolean
case decimal
Expand All @@ -24,8 +25,7 @@ public enum NumericTypesClassRelationships: String {

// swiftlint:disable type_name
public class _NumericTypesClass: NSManagedObject {
@objc
public class var entityName: String {
@objc public class var entityName: String {
return "NumericTypes"
}

Expand Down
4 changes: 2 additions & 2 deletions SampleOutput/Mogenerator/Machine/_PropertyClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable type_body_length
// swiftlint:disable vertical_whitespace
public enum PropertyClassAttributes: String {
case name
case value
Expand All @@ -19,8 +20,7 @@ public enum PropertyClassRelationships: String {

// swiftlint:disable type_name
public class _PropertyClass: NSManagedObject {
@objc
public class var entityName: String {
@objc public class var entityName: String {
return "Property"
}

Expand Down
4 changes: 2 additions & 2 deletions SampleOutput/Mogenerator/Machine/_ScalarTypesClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable type_body_length
// swiftlint:disable vertical_whitespace
public enum ScalarTypesClassAttributes: String {
case boolean
case double
Expand Down Expand Up @@ -45,8 +46,7 @@ public enum ScalarTypesClassFetchedProperties: String {

// swiftlint:disable type_name
public class _ScalarTypesClass: NSManagedObject {
@objc
public class var entityName: String {
@objc public class var entityName: String {
return "ScalarTypes"
}

Expand Down
1 change: 1 addition & 0 deletions SampleOutput/XCode/AllTypesClass+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable type_body_length
// swiftlint:disable trailing_newline
extension AllTypesClass {
@nonobjc
public class func fetchRequest() -> NSFetchRequest<AllTypesClass> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable type_body_length
// swiftlint:disable trailing_newline
extension NumericTypesClass {
@nonobjc
public class func fetchRequest() -> NSFetchRequest<NumericTypesClass> {
Expand Down
1 change: 1 addition & 0 deletions SampleOutput/XCode/PropertyClass+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable type_body_length
// swiftlint:disable trailing_newline
extension PropertyClass {
@nonobjc
public class func fetchRequest() -> NSFetchRequest<PropertyClass> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable type_body_length
// swiftlint:disable trailing_newline
extension ScalarTypesClass {
@nonobjc
public class func fetchRequest() -> NSFetchRequest<ScalarTypesClass> {
Expand Down
4 changes: 2 additions & 2 deletions Templates/mogenerator/machine.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable type_body_length
// swiftlint:disable vertical_whitespace
{% if attributes %}
public enum {{ class }}Attributes: String {
{% for attribute in attributes %}
Expand Down Expand Up @@ -51,8 +52,7 @@ public enum {{ class }}FetchedProperties: String {

// swiftlint:disable type_name
public class _{{ class }}: {% if parent.class %}{{ parent.class }}{% else %}NSManagedObject{% endif %} {
@objc
{% if parent.class %}override {% endif %}public class var entityName: String {
@objc {% if parent.class %}override {% endif %}public class var entityName: String {
return "{{ name }}"
}

Expand Down
7 changes: 7 additions & 0 deletions Tests/MotoSwiftFrameworkTests/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
disabled_rules:
- closure_body_length
- function_body_length
- force_cast
- force_try
- force_unwrapping
- line_length
2 changes: 1 addition & 1 deletion Tests/MotoSwiftFrameworkTests/GeneratedClassesTests.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CoreData
import Foundation
import Spectre
import CoreData

func testGeneratedCode() {
describe("TypesModel") {
Expand Down
5 changes: 2 additions & 3 deletions Tests/MotoSwiftFrameworkTests/ModelParserTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import Spectre
import PathKit
@testable import MotoSwiftFramework
import PathKit
import Spectre

func testModelParser() {
describe("ModelParser") {
Expand Down Expand Up @@ -69,7 +69,6 @@ private func test(typeModel model: Model) throws {
.filter { $0.key != .decimal }
.map { Attribute(name: $1, type: $0, isOptional: false, isScalar: true, userInfo: [:]) }


try expect(scalarTypesEntity.attributes).to.containsSameElements(with: scalarAttributes)

let expectedRelationship = Relationship(name: "numerics", entityName: "NumericTypes", isOptional: false, toMany: false, isOrdered: false, userInfo: [:])
Expand Down
2 changes: 1 addition & 1 deletion Tests/MotoSwiftFrameworkTests/RendererTests.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation
import Spectre
@testable import MotoSwiftFramework
import Spectre

func testRenderer() {
describe("Renderer") {
Expand Down

0 comments on commit 9c39a21

Please sign in to comment.