Enable extensionAccessControl rule by default

This commit is contained in:
Nick Lockwood
2020-10-13 20:35:07 +01:00
parent 3167febdc3
commit 98ae8e7c74
9 changed files with 29 additions and 30 deletions
+2 -2
View File
@@ -19,8 +19,8 @@
import FirebaseFirestore
import Foundation
extension Firestore {
public struct Decoder {
public extension Firestore {
struct Decoder {
fileprivate static let documentRefUserInfoKey =
CodingUserInfoKey(rawValue: "DocumentRefUserInfoKey")
+2 -2
View File
@@ -2,8 +2,8 @@
import Foundation
extension Layout {
public init(xmlData: Data, url: URL? = nil, relativeTo: String? = #file) throws {
public extension Layout {
init(xmlData: Data, url: URL? = nil, relativeTo: String? = #file) throws {
let xml: [XMLNode]
do {
xml = try XMLParser.parse(data: xmlData, options: .skipComments)
+2 -2
View File
@@ -8,9 +8,9 @@ public protocol LayoutBacked: class {
/* weak */ var layoutNode: LayoutNode? { get }
}
extension LayoutBacked where Self: NSObject {
public extension LayoutBacked where Self: NSObject {
/// Default implementation of the layoutNode property
public internal(set) weak var layoutNode: LayoutNode? {
internal(set) weak var layoutNode: LayoutNode? {
get { return _layoutNode }
set { _setLayoutNode(layoutNode, retained: false) }
}
+3 -3
View File
@@ -14,10 +14,10 @@ public protocol LayoutDelegate: class {
func layoutValue(forKey key: String) throws -> Any?
}
extension LayoutDelegate {
public extension LayoutDelegate {
/// Default error handler implementation - bubbles error up to the first responder
/// that will handle it, or displays LayoutConsole if no handler is found
public func layoutError(_ error: LayoutError) {
func layoutError(_ error: LayoutError) {
DispatchQueue.main.async {
var responder = (self as? UIResponder)?.next
while responder != nil {
@@ -32,7 +32,7 @@ extension LayoutDelegate {
}
/// Default implementation - returns nothing
public func layoutValue(forKey _: String) throws -> Any? {
func layoutValue(forKey _: String) throws -> Any? {
return nil
}
}
+2 -2
View File
@@ -3129,8 +3129,8 @@ extension NSObject {
private var viewSwizzled = false
extension UIView {
fileprivate static func _swizzle() {
private extension UIView {
static func _swizzle() {
guard !viewSwizzled else { return }
replace(#selector(layoutSubviews), of: self, with: #selector(layout_layoutSubviews))
viewSwizzled = true
@@ -2,8 +2,8 @@
import Foundation
extension XMLNode {
var isLayout: Bool {
public extension XMLNode {
internal var isLayout: Bool {
switch self {
case let .node(name, attributes, children):
guard name.isCapitalized else {
@@ -23,32 +23,32 @@ extension XMLNode {
}
}
public var isParameter: Bool {
var isParameter: Bool {
guard case .node("param", _, _) = self else {
return false
}
return true
}
public var isMacro: Bool {
var isMacro: Bool {
guard case .node("macro", _, _) = self else {
return false
}
return true
}
public var isChildren: Bool {
var isChildren: Bool {
guard case .node("children", _, _) = self else {
return false
}
return true
}
public var isParameterOrMacro: Bool {
var isParameterOrMacro: Bool {
return isParameter || isMacro
}
public var parameters: [String: String] {
var parameters: [String: String] {
var params = [String: String]()
for child in children where child.isParameter {
let attributes = child.attributes
@@ -11,8 +11,8 @@ private class Box {
}
}
extension UICollectionViewLayout {
fileprivate static func defaultLayout(for node: LayoutNode) -> UICollectionViewFlowLayout {
private extension UICollectionViewLayout {
static func defaultLayout(for node: LayoutNode) -> UICollectionViewFlowLayout {
let flowLayout = UICollectionViewFlowLayout()
if node.expressions["collectionViewLayout.itemSize"] ??
node.expressions["collectionViewLayout.itemSize.width"] ??
@@ -274,7 +274,7 @@ extension UICollectionViewController: LayoutBacked {
private var cellDataKey = 0
private var nodesKey = 0
extension UICollectionView {
public extension UICollectionView {
private enum LayoutData {
case success(Layout, Any, [String: Any])
case failure(Error)
@@ -322,7 +322,7 @@ extension UICollectionView {
}
}
public func registerLayout(
func registerLayout(
named: String,
bundle: Bundle = Bundle.main,
relativeTo: String = #file,
@@ -347,7 +347,7 @@ extension UICollectionView {
}
}
public func dequeueReusableCellNode(withIdentifier identifier: String, for indexPath: IndexPath) -> LayoutNode {
func dequeueReusableCellNode(withIdentifier identifier: String, for indexPath: IndexPath) -> LayoutNode {
do {
guard let layoutsData = objc_getAssociatedObject(self, &cellDataKey) as? NSMutableDictionary,
let layoutData = layoutsData[identifier] as? LayoutData
@@ -281,7 +281,7 @@ private var cellDataKey = 0
private var headerDataKey = 0
private var nodesKey = 0
extension UITableView {
public extension UITableView {
private enum LayoutData {
case success(Layout, Any, [String: Any])
case failure(Error)
@@ -316,7 +316,7 @@ extension UITableView {
// MARK: UITableViewHeaderFooterView recycling
public func registerLayout(
func registerLayout(
named: String,
bundle: Bundle = Bundle.main,
relativeTo: String = #file,
@@ -343,7 +343,7 @@ extension UITableView {
}
}
public func dequeueReusableHeaderFooterNode(withIdentifier identifier: String) -> LayoutNode? {
func dequeueReusableHeaderFooterNode(withIdentifier identifier: String) -> LayoutNode? {
if let view = dequeueReusableHeaderFooterView(withIdentifier: identifier) {
guard let node = view.layoutNode else {
preconditionFailure("\(type(of: view)) is not a Layout-managed view")
@@ -389,7 +389,7 @@ extension UITableView {
// MARK: UITableViewCell recycling
public func registerLayout(
func registerLayout(
named: String,
bundle: Bundle = Bundle.main,
relativeTo: String = #file,
@@ -416,7 +416,7 @@ extension UITableView {
}
}
public func dequeueReusableCellNode(withIdentifier identifier: String) -> LayoutNode? {
func dequeueReusableCellNode(withIdentifier identifier: String) -> LayoutNode? {
if let cell = dequeueReusableCell(withIdentifier: identifier) {
guard let node = cell.layoutNode else {
preconditionFailure("\(type(of: cell)) is not a Layout-managed view")
@@ -456,7 +456,7 @@ extension UITableView {
}
}
public func dequeueReusableCellNode(withIdentifier identifier: String, for _: IndexPath) -> LayoutNode {
func dequeueReusableCellNode(withIdentifier identifier: String, for _: IndexPath) -> LayoutNode {
guard let node = dequeueReusableCellNode(withIdentifier: identifier) else {
let layoutsData = objc_getAssociatedObject(self, &cellDataKey) as? NSMutableDictionary
if layoutsData?[identifier] == nil {
-1
View File
@@ -4956,7 +4956,6 @@ public struct _FormatRules {
public let extensionAccessControl = FormatRule(
help: "Configure the placement of an extension's access control keyword.",
disabledByDefault: true,
options: ["extensionacl"]
) { formatter in
formatter.mapRecursiveDeclarations { declaration -> Formatter.Declaration in