- Notifications
You must be signed in to change notification settings - Fork42
A linter tool for Interface Builder
License
IBDecodable/IBLinter
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A linter tool to normalize.xib
and.storyboard
files. Inspired byrealm/SwiftLint
UsingHomebrew
$ brew install iblinter
UsingMint
$ mint install IBDecodable/IBLinter
UsingCocoaPods
pod'IBLinter'
This will download the IBLinter binaries and dependencies inPods/
during your nextpod install
execution and will allow you to invoke it via${PODS_ROOT}/IBLinter/bin/iblinter
in your Script Build Phases.
You can build from source by cloning this repository and running
$ make install
iblinter
will be installed in/usr/local/bin
.
You can see all description byiblinter --help
$ iblinter --helpUSAGE: iblinter <subcommand>OPTIONS: --version Show the version. -h, --help Show help information.SUBCOMMANDS: lint (default) Print lint warnings and errors See 'iblinter help <subcommand>' for detailed help.
Add aRun Script Phase
to integrate IBLinter with Xcode
if which iblinter>/dev/null;then iblinter lintelseecho"warning: IBLinter not installed, download from https://github.com/IBDecodable/IBLinter"fi
Alternatively, if you've installed IBLinter via CocoaPods the script should look like this:
"${PODS_ROOT}/IBLinter/bin/iblinter"
IBLinter requires Swift5.0 runtime. Please satisfy at least one of following requirements.
- macOS 10.14.4 or later
- Install
Swift 5 Runtime Support for Command Line Tools
fromMore Downloads for Apple Developers
All rules are documented inRules.md
Pull requests are encouraged.
You can configure IBLinter by adding a.iblinter.yml
file from project root directory.
key | description |
---|---|
enabled_rules | Enabled rules id. |
disabled_rules | Disabled rules id. |
excluded | Path to ignore for lint. |
included | Path to include for lint. |
custom_module_rule | Custom module rule configs. |
use_base_class_rule | Use base class rule configs. |
view_as_device_rule | View as device rule configs. |
You can configurecustom_module
rule byCustomModuleConfig
list.
key | description |
---|---|
module | Module name. |
included | Path to*.swift classes of the module forcustom_module lint. |
excluded | Path to ignore for*.swift classes of the module forcustom_module lint. |
You can configureuse_base_class
rule byUseBaseClassConfig
list.
key | description |
---|---|
element_class | Element class name. |
base_classes | Base classes of the element class. |
Note: UseBaseClassRule does not work for classes that inherit base class. You need to add all classes tobase_classes
to check.
You can configureview_as_device
rule byViewAsDeviceConfig
. If there are no config,device_id
is set asretina4_7
.
key | description |
---|---|
device_id | Device id for device. |
appx. Table of mapping device name todevice_id
(onXcode 10.2
)
device name | device id |
---|---|
iPhone 4s | retina3_5 |
iPhone SE | retina4_0 |
iPhone 8 | retina4_7 |
iPhone 8 Plus | retina5_5 |
iPhone XS | retina5_9 |
iPhone XR | retina6_1 |
iPhone XS Max | retina6_5 |
You can configureuse_trait_collections
rule byUseTraitCollectionsConfig
. If there is no config then use_trait_collections is set to true
key | description |
---|---|
enabled | true |
You can configurehides_bottom_bar
rule byHidesBottomBarConfig
list.
key | description |
---|---|
excluded_view_controllers | Controller's class name to ignorehides_bottom_bar rule. |
enabled_rules: -relative_to_margin -use_trait_collections -hides_bottom_bar -has_single_view_controller -has_initial_view_controllerdisabled_rules: -custom_class_nameexcluded: -Carthage -Appincluded: -App/Viewscustom_module_rule: -module:UIComponentsincluded: -UIComponents/Classesexcluded: -UIComponents/Classes/Config/Generateduse_base_class_rule: -element_class:UILabelbase_classes: -PrimaryLabel -SecondaryLabelview_as_device_rule:device_id:retina4_0use_trait_collections_rule:enabled:falsehides_bottom_bar_rule:excluded_view_controllers: -FirstViewController -SecondViewController
About
A linter tool for Interface Builder