Simple PBXProj Verifier

Overview

logo

Kin Build Status

Kin is a minimalistic tool to check whether your project.pbxproj file is correct.

What does it do?

Have you ever found yourself undoing a merge due to a broken Xcode build? Then Kin is your tool. It will parse your project configuration file and detect errors.

How does it work?

Kin is just a syntax checker built with ANTLR 4 with a very thin layer to be usable from command line. On the fly syntax checking integration for text editors and IDEs is a work in progress (see the "Text editor/IDE integration" section below).

Usage

Install Kin with your favorite python package manager.

Using pip

pip install kin

Using easy_install

easy_install kin

Once installed, use Kin from your Xcode project directory. Kin will automatically detect where your project configuration is located and check whether it is correct.

$> kin
CORRECT

If there is an error in your configuration file, Kin will return the offending line and a short description of the problem found.

$> kin
ERROR: line 400:3 mismatched input ')' expecting 'inputPaths'

Optionally, you can provide the location of your project.pbxproj to Kin:

$> kin myProject/myProject.xcodeproj/project.pbxproj
CORRECT

Text editor/IDE integration

The following text editor and IDE integration packages are available:

Emacs

Do you want to contribute?

Feel free to add any useful feature to Kin, we will be glad to improve it with your help.

If you modify the grammar file (PBXProj.g4), make sure you compile it using ANTLR. ANLTR can be installed with the following command:

brew install antlr

After changes have been made to the PBXProj.g4 file it can be compiled with:

cd kin/grammar
antlr4 PBXProj.g4 -Dlanguage=Python3

The updated files can optionally be copied with this command for testing:

cp * path/to/site-packages/kin/grammar/

Only the PBXProj.g4 file needs to be committed, GitHub Actions will produce the compiled grammar files.

To run tests, first install the current version of kin by running pip install .. Then you can execute ./tests/tester.py to run all the scenarios we created.

License

Copyright 2016 Karumi

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • SyntaxError: invalid syntax

    SyntaxError: invalid syntax

    Hi,

    I tried to run kin for the first time and I keep getting this error. I am not sure why.

    Traceback (most recent call last):
      File "/usr/local/bin/kin", line 5, in <module>
        from kin.kin import main
      File "/usr/local/lib/python2.7/site-packages/kin/kin.py", line 5, in <module>
        from .verifier import Verifier
      File "/usr/local/lib/python2.7/site-packages/kin/verifier.py", line 2, in <module>
        from .grammar.PBXProjLexer import PBXProjLexer
      File "/usr/local/lib/python2.7/site-packages/kin/grammar/PBXProjLexer.py", line 1165
        def __init__(self, input=None, output:TextIO = sys.stdout):
                                             ^
    SyntaxError: invalid syntax
    
    opened by ahmedfaaid 5
  • Python 3 support

    Python 3 support

    I tried running Kin on a project and got this error

    Traceback (most recent call last):
      File "/usr/local/bin/kin", line 5, in <module>
        from kin.kin import main
      File "/usr/local/lib/python3.7/site-packages/kin/kin.py", line 5, in <module>
        from verifier import Verifier
    ModuleNotFoundError: No module named 'verifier'
    
    enhancement help wanted 
    opened by ignacioespinoso 5
  •  mismatched input 'inputFileListPaths' expecting 'inputPaths'

    mismatched input 'inputFileListPaths' expecting 'inputPaths'

    Encountered after adding a standard Carthage copy frameworks phase.

    ERROR: line 294:3 mismatched input 'inputFileListPaths' expecting 'inputPaths'
    ERROR: line 299:3 mismatched input 'outputFileListPaths' expecting 'outputPaths'
    ERROR: line 312:3 mismatched input 'inputFileListPaths' expecting 'inputPaths'
    ERROR: line 317:3 mismatched input 'outputFileListPaths' expecting 'outputPaths'
    ERROR: line 330:3 mismatched input 'inputFileListPaths' expecting 'inputPaths'
    ERROR: line 337:3 mismatched input 'outputFileListPaths' expecting 'outputPaths'
    

    Lines: 325-346 of my .pbxproj

    		A7CD39BE222E3AF6003FA014 /* Run Copy Carthage Frameworks */ = {
    			isa = PBXShellScriptBuildPhase;
    			buildActionMask = 2147483647;
    			files = (
    			);
    			inputFileListPaths = (
    			);
    			inputPaths = (
    				"$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework",
    				"$(SRCROOT)/Carthage/Build/iOS/AlamofireImage.framework",
    			);
    			name = "Run Copy Carthage Frameworks";
    			outputFileListPaths = (
    			);
    			outputPaths = (
    				"$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Alamofire.framework",
    				"$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/AlamofireImage.framework",
    			);
    			runOnlyForDeploymentPostprocessing = 0;
    			shellPath = /bin/sh;
    			shellScript = "/usr/local/bin/carthage copy-frameworks\n";
    		};
    
    bug help wanted 
    opened by mc7h 5
  • Build phase triggers

    Build phase triggers "extraneous input" error

    Running Kin against this project causes the following errors:

    ERROR: line 1868:4 extraneous input '6W8N7WB7Z36QWEFVAW5LHTNV' expecting {')', REFERENCE}
    ERROR: line 1892:4 extraneous input '0CO5J70NW5JDTTZ5BCHAVYZE' expecting {';', ')', 'buildRules', 'rootObject', REFERENCE}
    ERROR: line 1914:4 extraneous input '6OBYKZXD36MCSZYQLYVIY1AY' expecting {';', ')', 'buildRules', 'rootObject', REFERENCE}
    ERROR: line 2125:2 extraneous input '0CO5J70NW5JDTTZ5BCHAVYZE' expecting REFERENCE
    ERROR: line 2191:2 extraneous input '6OBYKZXD36MCSZYQLYVIY1AY' expecting REFERENCE
    

    The project has been updated with Xcode 12.2 (12B45b) so it is expected to be valid.

    bug 
    opened by dnicolson 4
  • Build phase script error with output paths

    Build phase script error with output paths

    Similar to https://github.com/Karumi/Kin/issues/18

    ERROR: line 391:4 mismatched input '"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/DataModelBundle.bundle"' expecting {')', NON_QUOTED_STRING}
    ERROR: line 428:4 mismatched input '"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/DataModelBundle.bundle"' expecting {')', NON_QUOTED_STRING}
    ERROR: line 463:4 mismatched input '"$(DERIVED_FILE_DIR)/Pods-ModelKit_Tests-checkManifestLockResult.txt"' expecting {')', NON_QUOTED_STRING}
    ERROR: line 481:4 mismatched input '"$(DERIVED_FILE_DIR)/Pods-MigrationTests-checkManifestLockResult.txt"' expecting {')', NON_QUOTED_STRING}
    
    bug 
    opened by ayushgoel 4
  • Getting SyntaxError: invalid syntax on Kin 2.0.2 with Python 2.7.18

    Getting SyntaxError: invalid syntax on Kin 2.0.2 with Python 2.7.18

    Traceback (most recent call last): File "/usr/local/bin/kin", line 11, in <module> load_entry_point('kin==2.0.2', 'console_scripts', 'kin')() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 489, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2843, in load_entry_point return ep.load() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2434, in load return self.resolve() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2440, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/Library/Python/2.7/site-packages/kin-2.0.2-py2.7.egg/kin/kin.py", line 5, in <module> from .verifier import Verifier File "/Library/Python/2.7/site-packages/kin-2.0.2-py2.7.egg/kin/verifier.py", line 1, in <module> from antlr4 import * File "build/bdist.macosx-11.5-x86_64/egg/antlr4/__init__.py", line 1, in <module> File "/Library/Python/2.7/site-packages/antlr4_python3_runtime-4.9.2-py2.7.egg/antlr4/Token.py", line 60 def text(self, text:str): ^ SyntaxError: invalid syntax

    opened by thandang 3
  • No module named 'verifier'

    No module named 'verifier'

    When I try to run kin in my project directory it throws this error.

    Traceback (most recent call last):
      File "//anaconda/bin/kin", line 7, in <module>
        from kin.kin import main
      File "//anaconda/lib/python3.5/site-packages/kin/kin.py", line 5, in <module>
        from verifier import Verifier
    ImportError: No module named 'verifier'
    

    I've tried to runpip install verifier but there's no matching distribution found for verifier. Please let me know which dependencies I need to install to make this run. Thank you!

    opened by miranda-elliott 3
  • Pip does not support python 2 anymore

    Pip does not support python 2 anymore

    Hello I have a problem,

    I've installed Kin using the most recent Pip (python3) and when tried to use it I get an error:

    Traceback (most recent call last): File "/usr/local/bin/kin", line 5, in <module> from kin.kin import main File "/usr/local/lib/python3.9/site-packages/kin/kin.py", line 5, in <module> from verifier import Verifier ModuleNotFoundError: No module named 'verifier'

    I've read on the forum that Kin is made for python 2.7 only. Is it true? If so, is Kin unusable now since Pip supports only python 3 now?

    opened by maciejkarolczyk 2
  • Add usesTabs identifier to file reference

    Add usesTabs identifier to file reference

    This pull request adds support for the usesTabs file reference. The usesTabs attribute appears to be quite common.

    A test has not been added nor have the grammar files been compiled as there are unmerged changes to these files.

    opened by dnicolson 2
  • Add plist structure definition identifier

    Add plist structure definition identifier

    This pull request adds support for the plistStructureDefinitionIdentifier definition identifier. The plistStructureDefinitionIdentifier attribute appears to be quite common.

    opened by dnicolson 2
  • No module name 'verifier'

    No module name 'verifier'

    running kin produces this: Traceback (most recent call last): File "/usr/local/bin/kin", line 6, in from kin.kin import main File "/usr/local/lib/python3.6/site-packages/kin/kin.py", line 5, in from verifier import Verifier ModuleNotFoundError: No module named 'verifier'

    opened by philosopherdog 2
  • Single character unquoted strings cause mismatched input error

    Single character unquoted strings cause mismatched input error

    Consider the following code excerpt:

    B3AF46E021071CA6002211EE /* C */ = {
        isa = PBXGroup;
        children = (
        );
        name = C;
        sourceTree = "<group>";
    };
    

    Because the path is only a single character it causes the following error:

    mismatched input 'C' expecting {QUOTED_STRING, NON_QUOTED_STRING}

    The problem does not occur if the string is quoted.

    opened by dnicolson 0
  • Tokens used as values result in an error

    Tokens used as values result in an error

    Consider the following code excerpt:

    49F4A5871C583A25007C84A1 /* files */ = {
        isa = PBXGroup;
        children = (
        );
        name = files;
        sourceTree = "<group>";
    };
    

    Because files is a token it will cause the following error:

    mismatched input 'files' expecting {QUOTED_STRING, NON_QUOTED_STRING}

    It appears as though using any tokens for these values causes the same error.

    enhancement help wanted 
    opened by dnicolson 0
  • LastSwift Migration Warning is not correct anymore

    LastSwift Migration Warning is not correct anymore

    The following error is now invalid as ProvisioningStyle = Automatic; can be the last param. ERROR: line 1320:6 mismatched input 'LastSwiftMigration' expecting '}'

    A1F9D0091F5951EE0078CB66 = {
    						CreatedOnToolsVersion = 8.3.3;
    						DevelopmentTeam = CWB42KSFAW;
    						LastSwiftMigration = 0900;
    						ProvisioningStyle = Automatic;
    					};
    
    enhancement 
    opened by davideme 1
  • Explore possible parser performance improvements so that Kin can do better

    Explore possible parser performance improvements so that Kin can do better "on the fly" syntax checking

    As PR #29 shows, there's an opportunity for Kin to work not only in batch mode, but integrated with text editors and IDEs, doing checks in the background.

    For a better experience, we should make the parser faster. Without leaving the convenience of using ANTLR, maybe we could massage the input grammar a little bit or memoize things so that the latency between checks is reduced and doesn't scale poorly as the Xcode project gets bigger.

    opened by danielmartin 1
  • Add static analysis features to Kin

    Add static analysis features to Kin

    There are a lot of problems in pbxproj files and most of them are always the same! We could handle the most common ones with Kin by using the parser ANTLR creates for us.

    Some of the issues we could deal with are:

    • NULL references [Remove them]
    • Unknown UUIDs referenced from groups [Remove them]
    • UUIDs of files that don't appear in any group [Remove them]
    • Duplicated UUIDs [Ask the user which one should we pick or try merging them]

    We can create separated issues in github when we start developing them.

    enhancement 
    opened by Serchinastico 2
  • Improve visual feedback

    Improve visual feedback

    I'm working on a project which project file has 38749 lines. I executed Kin when I messed up resolving a conflict on a project file and it saved my life again but for some time I couldn't see any feedback about what kin was doing and I thought something went wrong.

    In order to improve the project usage, it could be great if we can add any visual feedback like a message or a progress bar shown to the user while kin is doing some magic.

    I'd really like to collaborate with this project so if you tell me where to start looking at I can take a look and try to implement it by myself :)

    enhancement help wanted 
    opened by pedrovgs 1
Releases(2.1.0)
  • 2.1.0(Jan 3, 2023)

    What's Changed

    • Add wrapLines identifier to file reference by @dnicolson in https://github.com/Serchinastico/Kin/pull/53
    • Allow additional references by @dnicolson in https://github.com/Serchinastico/Kin/pull/54
    • Make input and output paths optional by @dnicolson in https://github.com/Serchinastico/Kin/pull/62
    • Add support for XCVersionGroup by @dnicolson in https://github.com/Serchinastico/Kin/pull/70
    • Add support for DevelopmentTeamName by @dnicolson in https://github.com/Serchinastico/Kin/pull/71
    • Make attributes, developmentRegion and knownRegion project keys optional by @dnicolson in https://github.com/Serchinastico/Kin/pull/72
    • Add support for PBXLegacyTarget object by @dnicolson in https://github.com/Serchinastico/Kin/pull/74
    • Add support for MD5 hex objects by @dnicolson in https://github.com/Serchinastico/Kin/pull/60
    • Allow quotes between variables and additional file references by @dnicolson in https://github.com/Serchinastico/Kin/pull/75
    • Make productName optional in PBXAggregateTarget by @dnicolson in https://github.com/Serchinastico/Kin/pull/76
    • Make name optional with SPM by @dnicolson in https://github.com/Serchinastico/Kin/pull/73
    • Change PBXProject attribute order by @dnicolson in https://github.com/Serchinastico/Kin/pull/78
    • refactoring code with List Comprehension by @idiomaticrefactoring in https://github.com/Serchinastico/Kin/pull/80
    • Update ANTLR to 4.11.1 by @dnicolson in https://github.com/Serchinastico/Kin/pull/81
    • Add support for the platformFilters key by @dnicolson in https://github.com/Serchinastico/Kin/pull/82

    New Contributors

    • @idiomaticrefactoring made their first contribution in https://github.com/Serchinastico/Kin/pull/80

    Full Changelog: https://github.com/Serchinastico/Kin/compare/2.0.2...2.1.0

    Source code(tar.gz)
    Source code(zip)
  • 2.0.2(Mar 29, 2021)

  • 2.0.0(Mar 29, 2021)

  • 1.7.4(Jan 25, 2021)

    Version 1.7.3 was already published but not tagged.

    • Fix a false positive when build names have spaces #38
    • Allow unquoted strings for non-empty file paths #41
    • Add usesTabs identifier to file reference #44
    • Add support for Swift Package Manager #45
    • Update the grammar to accept non-hex references #49
    Source code(tar.gz)
    Source code(zip)
  • 1.7.3(Jan 25, 2021)

    • Fix a false positive when build names have spaces #38
    • Allow unquoted strings for non-empty file paths #41
    • Add usesTabs identifier to file reference #44
    • Add support for Swift Package Manager #45
    • Update the grammar to accept non-hex references #49
    Source code(tar.gz)
    Source code(zip)
  • 1.7.2(Nov 15, 2019)

  • 1.7.1(Feb 1, 2017)

  • 1.7.0(Dec 12, 2016)

  • 1.6.0(Dec 12, 2016)

  • 1.5.0(Jun 22, 2016)

  • 1.3.0(Apr 25, 2016)

  • 1.2.0(Apr 20, 2016)

    Kin now returns an exit code if it finds any error, specifically:

    • Error code -1 iff kin finds an error in the target project.pbxproj file
    • Error code -2 iff kin cannot locate any project.pbxproj
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Apr 20, 2016)

    Kin now tries to find a valid project.pbxproj from your current directory by looking for a file called project.pbxproj in any directory ending in .xcodeproj

    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Apr 19, 2016)

  • 0.9.0(Apr 15, 2016)

Owner
Sergio Gutiérrez
I do things: fourdays.app – experimentoconejoblanco.com
Sergio Gutiérrez
Managing state is hard. Delta aims to make it simple.

Managing state is hard. Delta aims to make it simple. Delta takes an app that has custom state management spread throughout all the VCs and simplifies

thoughtbot, inc. 246 Jun 29, 2022
Repository for the dgca verifier iOS app.

EU Digital COVID Certificate Verifier App - iOS About • Development • Documentation • Support • Contribute • Contributors • Licensing About This repos

null 47 May 19, 2022
Customizable simple Alert and simple ActionSheet for Swift

SimpleAlert It is simple and easily customizable alert. Can be used as UIAlertController. Appetize's Demo Requirements Swift 5.0 iOS 9.0 or later How

Kyohei Ito 397 Dec 6, 2022
Creating a simple selectable tag view in SwiftUI is quite a challenge. here is a simple & elegant example of it.

SwiftUI TagView Creating a simple selectable tag view in SwiftUI is quite a challenge. here is a simple & elegant example of it. Usage: Just copy the

Ahmadreza 16 Dec 28, 2022
Basic (simple) App for MacOS with simple functionality

Test Mac App Basic (simple) App for MacOS with simple functionality General Details Build : 1.0 Author Alias : gonewithharshwinds Brand : ADV Descript

Harsh ADV) 1 Dec 25, 2021
Simple command line interactive game to practice German (or English) with simple short stories.

Gif With GIF you can practice German or English with short stories. The stories are written in an easy language, and you can interact with the charact

Pedro Muniz 8 Nov 3, 2022
A simple, decentralized dependency manager for Cocoa

Carthage Carthage is intended to be the simplest way to add frameworks to your Cocoa application. Carthage builds your dependencies and provides you w

Carthage 14.7k Jan 7, 2023
Advanced Natural Motion Animations, Simple Blocks Based Syntax

FlightAnimator Moved to Swift 3.1 Support: For Swift 3.1 - Use tag Version 0.9.9 See Installation Instructions for clarification Introduction FlightAn

Anton 589 Dec 29, 2022
Simple Interface Core Animation. Run type-safe animation sequencially or parallelly

Simple Interface Core Animation Sica can execute various animations sequentially or parallelly. Features Animation with duration and delay parallel /

CATS Open Source Softwares 1k Nov 10, 2022
InAppPurchase - A Simple and Lightweight framework for In App Purchase

InAppPurchase A Simple, Lightweight and Safe framework for In App Purchase Feature Simple and Light ?? Support Promoting In-App Purchases ?? No need t

Jin Sasaki 269 Dec 15, 2022
LinkedInSignIn - Simple view controller to log in and retrieve an access token from LinkedIn.

LinkedInSignIn Example To run the example project, clone the repo, and run pod install from the Example directory first. Also you need to setup app on

Serhii Londar 34 Sep 1, 2022
AudioPlayer is a simple class for playing audio in iOS, macOS and tvOS apps.

AudioPlayer AudioPlayer is a simple class for playing audio in iOS, macOS and tvOS apps.

Tom Baranes 260 Nov 27, 2022
Soundable is a tiny library that uses AVFoundation to manage the playing of sounds in iOS applications in a simple and easy way

Soundable is a tiny library that uses AVFoundation to manage the playing of sounds in iOS applications in a simple and easy way. You can play

Luis Cárdenas 89 Nov 21, 2022
SwiftySound is a simple library that lets you deal with Swift sounds easily

SwiftySound Overview SwiftySound is a simple library that lets you deal with Swift sounds easily. Static methods Sound.play(file: "dog.wav") Sound.pla

Adam Cichy 1.1k Dec 17, 2022
Carlos - A simple but flexible cache, written in Swift for iOS 13+ and WatchOS 6 apps.

Carlos A simple but flexible cache, written in Swift for iOS 13+ and WatchOS 6 apps. Breaking Changes Carlos 1.0.0 has been migrated from PiedPiper de

National Media & Tech 628 Dec 3, 2022
A simple and beautiful chart lib used in Piner and CoinsMan for iOS(https://github.com/kevinzhow/PNChart) Swift Implementation

PNChart-Swift PNChart(https://github.com/kevinzhow/PNChart) Swift Implementation Installation This isn't on CocoaPods yet, so to install, add this to

Kevin 1.4k Nov 7, 2022
An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift.

ScrollableGraphView Announcements 9-7-2017 - Version 4: Version 4 was released which adds multiple plots, dynamic reloading of values, more reference

Phillip 5.3k Jan 5, 2023
SwiftChart - A simple line and area charting library for iOS.

SwiftChart A simple line and area charting library for iOS. ?? Line and area charts ?? Multiple series ?? Partially filled series ?? Works with signed

Giampaolo Bellavite 1k Jan 2, 2023
A simple and easily customizable InputAccessoryView for making powerful input bars with autocomplete and attachments

InputBarAccessoryView Features Autocomplete text with @mention, #hashtag or any other prefix A self-sizing UITextView with an optional fixed height (c

Nathan Tannar 968 Jan 2, 2023
HexColor is a simple extension that lets you initialize UIColors the way they were meant to be initialized: With hex integer values

HexColor is a simple extension that lets you initialize UIColors the way they were meant to be initialized: With hex integer values. Requirem

Tuomas Artman 103 Nov 24, 2022