Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

Swiftlint rules in color templates #32

Merged
merged 18 commits into from
Apr 5, 2017
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

### Bug Fixes

_None_
* Fixed `swiftlint` warnings in generated color extensions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the same format as the other entries:

  • credit yourself
  • add a link to this PR
  • a . at the end of the sentence and 2 spaces


### Breaking Changes

Expand Down
4 changes: 4 additions & 0 deletions Tests/Expected/Colors/default-context-customname.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,6 +19,7 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

// swiftlint:disable file_length
// swiftlint:disable line_length
Expand Down Expand Up @@ -61,3 +63,5 @@ extension Color {
self.init(rgbaValue: name.rgbaValue)
}
}
// swiftlint:enable file_length
// swiftlint:enable line_length
4 changes: 4 additions & 0 deletions Tests/Expected/Colors/default-context-defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,6 +19,7 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

// swiftlint:disable file_length
// swiftlint:disable line_length
Expand Down Expand Up @@ -61,3 +63,5 @@ extension Color {
self.init(rgbaValue: name.rgbaValue)
}
}
// swiftlint:enable file_length
// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Tests/Expected/Colors/default-context-empty.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,5 +19,6 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

// No color found
4 changes: 4 additions & 0 deletions Tests/Expected/Colors/default-context-text-defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,6 +19,7 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

// swiftlint:disable file_length
// swiftlint:disable line_length
Expand Down Expand Up @@ -76,3 +78,5 @@ extension Color {
self.init(rgbaValue: name.rgbaValue)
}
}
// swiftlint:enable file_length
// swiftlint:enable line_length
4 changes: 4 additions & 0 deletions Tests/Expected/Colors/rawValue-context-customname.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,6 +19,7 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

// swiftlint:disable file_length
// swiftlint:disable line_length
Expand Down Expand Up @@ -48,3 +50,5 @@ extension Color {
self.init(rgbaValue: name.rawValue)
}
}
// swiftlint:enable file_length
// swiftlint:enable line_length
4 changes: 4 additions & 0 deletions Tests/Expected/Colors/rawValue-context-defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,6 +19,7 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

// swiftlint:disable file_length
// swiftlint:disable line_length
Expand Down Expand Up @@ -48,3 +50,5 @@ extension Color {
self.init(rgbaValue: name.rawValue)
}
}
// swiftlint:enable file_length
// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Tests/Expected/Colors/rawValue-context-empty.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,5 +19,6 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

// No color found
4 changes: 4 additions & 0 deletions Tests/Expected/Colors/swift3-context-customname.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,6 +19,7 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

// swiftlint:disable file_length
// swiftlint:disable line_length
Expand Down Expand Up @@ -61,3 +63,5 @@ extension Color {
self.init(rgbaValue: name.rgbaValue)
}
}
// swiftlint:enable file_length
// swiftlint:enable line_length
4 changes: 4 additions & 0 deletions Tests/Expected/Colors/swift3-context-defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,6 +19,7 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

// swiftlint:disable file_length
// swiftlint:disable line_length
Expand Down Expand Up @@ -61,3 +63,5 @@ extension Color {
self.init(rgbaValue: name.rgbaValue)
}
}
// swiftlint:enable file_length
// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions Tests/Expected/Colors/swift3-context-empty.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,5 +19,6 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

// No color found
4 changes: 4 additions & 0 deletions Tests/Expected/Colors/swift3-context-text-defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,6 +19,7 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

// swiftlint:disable file_length
// swiftlint:disable line_length
Expand Down Expand Up @@ -76,3 +78,5 @@ extension Color {
self.init(rgbaValue: name.rgbaValue)
}
}
// swiftlint:enable file_length
// swiftlint:enable line_length
4 changes: 4 additions & 0 deletions templates/colors-default.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,6 +19,7 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

{% if colors %}
{# Note: We don't use a UInt32 rawValue in this template so we can have multiple colors with the same rgbaValue #}
Expand Down Expand Up @@ -52,6 +54,8 @@ extension Color {
self.init(rgbaValue: name.rgbaValue)
}
}
// swiftlint:enable file_length
// swiftlint:enable line_length
{% else %}
// No color found
{% endif %}
4 changes: 4 additions & 0 deletions templates/colors-rawValue.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,6 +19,7 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

{% if colors %}
// swiftlint:disable file_length
Expand All @@ -42,6 +44,8 @@ extension Color {
self.init(rgbaValue: name.rawValue)
}
}
// swiftlint:enable file_length
// swiftlint:enable line_length
{% else %}
// No color found
{% endif %}
4 changes: 4 additions & 0 deletions templates/colors-swift3.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
typealias Color = NSColor
#endif

// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
Expand All @@ -18,6 +19,7 @@ extension Color {
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace

{% if colors %}
{# Note: We don't use a UInt32 rawValue in this template so we can have multiple colors with the same rgbaValue #}
Expand Down Expand Up @@ -52,6 +54,8 @@ extension Color {
self.init(rgbaValue: name.rgbaValue)
}
}
// swiftlint:enable file_length
// swiftlint:enable line_length
{% else %}
// No color found
{% endif %}