Skip to content

Commit 27c3a9b

Browse files
Merge pull request #154 from IBDecodable/feat/verify-ambiguous
Verify ambiguous
2 parents 39ab498 + 4458527 commit 27c3a9b

File tree

6 files changed

+57
-13
lines changed

6 files changed

+57
-13
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on: [push, pull_request]
33
jobs:
44
test:
55
name: Build and Test
6-
runs-on: macOS-10.14
6+
runs-on: macOS-10.15
77
steps:
88
- name: Checkout
99
uses: actions/checkout@master

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0
1+
5.2

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ let package = Package(
2121
)
2222
],
2323
dependencies: [
24-
.package(url: "https://github.com/IBDecodable/IBDecodable.git", from: "0.2.0"),
24+
.package(url: "https://github.com/IBDecodable/IBDecodable.git", from: "0.3.0"),
2525
.package(url: "https://github.com/Carthage/Commandant.git", .upToNextMinor(from: "0.16.0")),
2626
.package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.22.0"),
2727
.package(url: "https://github.com/xcodeswift/xcproj.git", from: "6.6.0"),

Sources/IBLinterKit/Rules/AmbiguousViewRule.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension Rules {
3030

3131
private func validate<T: InterfaceBuilderFile>(for view: ViewProtocol, file: T) -> [Violation] {
3232
let violation: [Violation] = {
33-
if view.isAmbiguous ?? false {
33+
if let isAmbiguous = view.isAmbiguous, isAmbiguous, view.verifyAmbiguity == nil {
3434
let message = "\(viewName(of: view)) has ambiguous constraints"
3535
return [Violation(pathString: file.pathString, message: message, level: .error)]
3636
} else {

Tests/IBLinterKitTest/Resources/Rules/AmbiguousViewRule/AmbiguousConstraint.storyboard

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3-
<device id="retina4_7" orientation="portrait">
4-
<adaptation id="fullscreen"/>
5-
</device>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3+
<device id="retina4_7" orientation="portrait" appearance="light"/>
64
<dependencies>
7-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
86
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
97
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
108
</dependencies>
119
<scenes>
1210
<!--View Controller-->
1311
<scene sceneID="lF6-io-qve">
1412
<objects>
15-
<viewController id="7eN-ZX-YSU" sceneMemberID="viewController">
13+
<viewController autoresizesArchivedViewToFullSize="NO" id="7eN-ZX-YSU" sceneMemberID="viewController">
1614
<view key="view" contentMode="scaleToFill" id="iGg-Eg-h0O">
1715
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
1816
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -27,7 +25,7 @@
2725
<nil key="highlightedColor"/>
2826
</label>
2927
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Second Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oHh-Kj-mCv">
30-
<rect key="frame" x="67.5" y="121" width="104.5" height="21"/>
28+
<rect key="frame" x="68" y="121" width="104.5" height="21"/>
3129
<fontDescription key="fontDescription" type="system" pointSize="17"/>
3230
<nil key="textColor"/>
3331
<nil key="highlightedColor"/>
@@ -57,5 +55,51 @@
5755
</objects>
5856
<point key="canvasLocation" x="70" y="154"/>
5957
</scene>
58+
<!--View Controller-->
59+
<scene sceneID="IOd-3n-ugA">
60+
<objects>
61+
<viewController id="vrQ-0m-YQo" sceneMemberID="viewController">
62+
<view key="view" contentMode="scaleToFill" id="Ggg-NL-c5H">
63+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
64+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
65+
<subviews>
66+
<view verifyAmbiguity="ignoreSizes" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dsH-Qq-Ghw">
67+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
68+
<subviews>
69+
<scrollView verifyAmbiguity="off" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GTc-4J-PFK">
70+
<rect key="frame" x="0.0" y="0.0" width="375" height="563"/>
71+
<color key="backgroundColor" systemColor="systemGreenColor" red="0.20392156859999999" green="0.78039215689999997" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
72+
<viewLayoutGuide key="contentLayoutGuide" id="odQ-6l-pj3"/>
73+
<viewLayoutGuide key="frameLayoutGuide" id="yqI-du-RsJ"/>
74+
</scrollView>
75+
</subviews>
76+
<color key="backgroundColor" systemColor="systemYellowColor" red="1" green="0.80000000000000004" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
77+
<constraints>
78+
<constraint firstAttribute="trailing" secondItem="GTc-4J-PFK" secondAttribute="trailing" id="BuE-va-rgi"/>
79+
<constraint firstItem="GTc-4J-PFK" firstAttribute="top" secondItem="dsH-Qq-Ghw" secondAttribute="top" id="J65-Jw-qfI"/>
80+
<constraint firstItem="GTc-4J-PFK" firstAttribute="leading" secondItem="dsH-Qq-Ghw" secondAttribute="leading" id="KwS-s6-7Dr"/>
81+
<constraint firstAttribute="bottom" secondItem="GTc-4J-PFK" secondAttribute="bottom" id="NE2-oB-oBc"/>
82+
</constraints>
83+
</view>
84+
<view verifyAmbiguity="ignoreSizes" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SAf-cy-XCQ">
85+
<rect key="frame" x="67" y="467" width="308" height="200"/>
86+
<color key="backgroundColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
87+
</view>
88+
</subviews>
89+
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
90+
<constraints>
91+
<constraint firstItem="eNh-tr-mRZ" firstAttribute="trailing" secondItem="SAf-cy-XCQ" secondAttribute="trailing" id="6ZT-fd-Dfb"/>
92+
<constraint firstItem="dsH-Qq-Ghw" firstAttribute="top" secondItem="eNh-tr-mRZ" secondAttribute="top" id="MZd-h4-znf"/>
93+
<constraint firstItem="dsH-Qq-Ghw" firstAttribute="leading" secondItem="eNh-tr-mRZ" secondAttribute="leading" id="bv1-q4-8S7"/>
94+
<constraint firstItem="eNh-tr-mRZ" firstAttribute="trailing" secondItem="dsH-Qq-Ghw" secondAttribute="trailing" id="n1L-Ta-wp6"/>
95+
<constraint firstItem="eNh-tr-mRZ" firstAttribute="bottom" secondItem="SAf-cy-XCQ" secondAttribute="bottom" id="t6I-sX-OrI"/>
96+
</constraints>
97+
<viewLayoutGuide key="safeArea" id="eNh-tr-mRZ"/>
98+
</view>
99+
</viewController>
100+
<placeholder placeholderIdentifier="IBFirstResponder" id="PmO-7W-hW7" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
101+
</objects>
102+
<point key="canvasLocation" x="68" y="812.74362818590714"/>
103+
</scene>
60104
</scenes>
61105
</document>

0 commit comments

Comments
 (0)