Commit fully-formatted Objective-C as a team without even trying.

Overview

[ Space Commander]

[ Space Commander] provides tools which enable a team of iOS developers to commit Objective-C code to a git repository using a unified style format, without requiring any manual fixup.

Corgi image

You can use it to:

  • Enforce formatting conventions before code is committed.
  • Format code with a single command (both individual files or the entire repo).
  • Fail a build (during a pull request) if unformatted code made it into the branch.

At Square, [ Space Commander] has streamlined iOS development, especially when it comes to pull requests. Applying formatting standards no longer requires manual developer attention; that time is better spent elsewhere!

You may wish to fork [ Space Commander] to apply your team's particular set of formatting rules (more details below), or clone to enjoy Square's flavor of Objective-C formatting.

Installation Locally

To add formatting pre-commit checks to your repo, from the target repo, run path/to/spacecommander/setup-repo.sh.

Usage

After running setup-repo.sh, formatting checks will run automatically before every commit.

To format an individual file and modify it in place, run format-objc-file.sh <file>. To format it without modification, run format-objc-file-dry-run.sh <file>

To format all of the Objective-C files in your repository in-place, run format-objc-files-in-repo.sh.

Details

To install the pre-commit hook, each developer on the project runs the setup script. This installs a precommit hook which will verify that code is formatted before the commit succeeds.

If there were formatting errors during the commit, a script to fixup code automatically can be run in order to commit without error.

At Square, this formatting repository is referenced as a submodule of a larger iOS project, so that the formatting rules and scripts are locked to a revision of the parent repository. This way, we can check the formatting as part of the build process, and fail the build if the formatting is not current (we can also check out older SHAs without any difficulty).

clang-format expects the custom rules file to exist in the same directory that the command is run from, and so a .gitignore-d symlink of the rules file is added to the target repository. It is a symlink so that the developer only needs to update the git SHA of the formatting repository to get the latest formatting rules from upstream.

Configuration

To format files only within selected directories, specify the name each directory in a file named .formatting-directory, separated by newlines (and without whitespace escaped). Otherwise, all Objective-C files tracked in the repo will be checked.

To ignore files within directories, add the name of each directory on a new line to a file named .formatting-directory-ignore.

To modify the formatting output, edit the following:

  • .clang-format for built in clang-format options.
  • format-objc-file-dry-run.sh and format-objc-file.sh for rules that are implemented in custom/.
  • Testing Support/ files to validate your changes.

Add #pragma Formatter Exempt or // MARK: Formatter Exempt as the first line of the file if the formatter should ignore it.

Installation for Pull Request Validation

The following instructions are Square-specific. We use a build system called mobuild. The hook that we use, which can be integrated into other build systems, is format-objc-mobuild

If you want style checking as a mandatory step to get a mergeable PR, do the following:

  • Add this repository as a cocoapod, or add it as a submodule in a Scripts/ directory.
  • Ensure that your repository has setup .sqiosbuild.json and .stashkins files at the top level (more info on the Square wiki page titled All About Mobuild).
  • The build machines are setup to check for the above conditions, and if they're met, automatically run format-objc-mobuild.
  • Open a PR with a modified Objective-C file to verify these checks are running.

Updating Style Options

Change formatting policies by modifying .clang-format. Available style options are listed on the clang website.

Please also update UnformattedExample.m (under ./Testing Support/) with an example of code that your formatting changes should correct.

Then, update FormattedExample.m (in the same place) with the expected result, and verify that your changes produce the desired result by running a simple test: ./test.sh

Custom Formatters

clang-format is fantastic and we love it, but it has some limitations. We've added our own ad-hoc formatting capabilities through scripts which live in custom/. If you add a custom file formatting script to custom/, invoke it in format-objc-file.sh and format-objc-file-dry-run.sh and add examples of input / output to files in Testing Support/.

Undesired Result?

The formatter can't do everything. It may occasionally produce an undesirable result, in which case you can either:

  • Refactor code to produce a line that is simpler and less confusing to the formatter.
  • Use // clang-format off and // clang-format on to selectively enable/disable clang-format for specific lines of a file.
  • Add #pragma Formatter Exempt or // MARK: Formatter Exempt as the first line of the file, and it will not be formatted at all.
  • Wislawa Szymborska said "All imperfection is easier to tolerate if served up in small doses." [ Space Commander] will remove nearly all formatting imperfections, but you may need to tolerate an occasional deviation from the expected result.

Contributing

We’re glad you’re interested in [ Space Commander], and we’d love to see where you take it. Please read our contributing guidelines prior to submitting a Pull Request.

Thanks, and happy formatting!

Comments
  • Podify [ SpaceCommander]

    Podify [ SpaceCommander]

    This came up in a discussion with @justinseanmartin the other day. Rather than pulling this in as a submodule in newer projects, might be nice to have a pod.

    CC @dnkoutso @alanf @dfed

    opened by EricMuller22 14
  • Support fish shell compatible commit commands

    Support fish shell compatible commit commands

    Hey there, I'm not amazing on my bash skills, so please double check me, but this should be checking for the existence of the $FISH_VERSION env var, and then offering different instructions.

    opened by orta 9
  • clang-format 3.8 and block indentation

    clang-format 3.8 and block indentation

    A follow-up from #30 and #32. clang-format 3.7 and 3.8 have some pretty significant differences in how they do block formatting. The changes appear to be by design, but I disagree pretty strongly with the design (see also this clang Bugzilla bug). I've attached two files showing the difference between 3.7 and 3.8. 3.8 is extremely aggressive about block indentation, regardless of settings.

    format-test-3.8.txt format-test-3.7.txt

    I made a custom build of clang-format that reverts or adds options for the behaviors that cause this change in block formatting behavior (my clang fork at https://github.com/ksuther/clang/tree/clang-format-customization and my spacecommander fork at https://github.com/ksuther/spacecommander/commit/af9708b32bcc36ebc99a4e8e5b569ba2a0dcba20).

    For anyone wondering "upgrade at all?" 3.7 has a number of bugs that have been fixed. The big one is that formatting inside blocks was broken in 3.7, and fixed in 3.8 (I believe this is what #30 is about). Some small ones that I've noticed in my own code have to do with Obj-C literals, handling casting inside Obj-C literals, and general handling of parentheses in Obj-C.

    opened by ksuther 8
  • Directories with spaces in .formatting-directory being ignored

    Directories with spaces in .formatting-directory being ignored

    I can't tell if this is Bash witchcraft, or intended behaviour, or what.

    Looking at https://github.com/square/spacecommander/blob/master/lib/common-lib.sh#L12, we see that directories_to_check() replaces spaces (' ') with escaped spaces ('\ ') via a sed command, which seems like a good idea Because Bash™.

    BUT tracing the output, it seems that Bash will automatically quote the paths automatically (?!), and as such it will be looking for a string with a literal '\' in its path. Obviously it won't find that!

    Detail

    I've cut the .formatting-directory down to the following:

    Clue/Tests
    Clue/Clue WatchKit Extension
    

    Then running the format-objc-files-in-repo.sh, I get the following output:

    $ Submodules/spacecommander/format-objc-files-in-repo.sh
    + IFS='
    '
    ++ date +%s
    + start_date=1446651719
    + export CDPATH=
    + CDPATH=
    +++ dirname Submodules/spacecommander/format-objc-files-in-repo.sh
    ++ cd Submodules/spacecommander
    ++ pwd
    + DIR=/Users/joshua/dev/work/Clue/wheel-iOS/Submodules/spacecommander
    + source /Users/joshua/dev/work/Clue/wheel-iOS/Submodules/spacecommander/lib/common-lib.sh
    ++ IFS='
    '
    ++ all_valid_objc_files_in_repo
    ++ directories_to_check
    ++ locations_to_diff=
    ++ '[' -e .formatting-directory ']'
    +++ cat .formatting-directory
    +++ sed 's/ /\\ /g'
    ++ locations_to_diff='Clue/Tests
    Clue/Clue\ WatchKit\ Extension'
    +++ git ls-tree --name-only --full-tree -r HEAD -- Clue/Tests 'Clue/Clue\ WatchKit\ Extension'
    +++ grep -e '\.m$' -e '\.mm$' -e '\.h$' -e '\.hh$'
    ++ files='Clue/Tests/BWAPICredentialServiceTest.m
    Clue/Tests/BWAPIRequestOperationManagerTest.m
    Clue/Tests/BWAPIServiceTest.m
    ...
    Clue/Tests/TagParsingTest.m'
    ++ grep -v Pods/
    ++ grep -v Carthage/
    + objc_files='Clue/Tests/BWAPICredentialServiceTest.m
    Clue/Tests/BWAPIRequestOperationManagerTest.m
    Clue/Tests/BWAPIServiceTest.mtionManagerTest.m
    Clue/Tests/BWAPIServiceTest.m
    ...
    Clue/Tests/TagParsingTest.m'
    + '[' -z 'Clue/Tests/BWAPICredentialServiceTest.m
    Clue/Tests/BWAPIRequestOperationManagerTest.m
    Clue/Tests/BWAPIServiceTest.m
    ...
    Clue/Tests/TagParsingTest.m' ']'
    ...
    + '[' -z '' ']'
    ++ date +%s
    + end_date=1446651719
    + time_diff=0
    + echo '0 minutes and 0 seconds to format objc.'
    0 minutes and 0 seconds to format objc.
    + exit 0
    

    Specifically the lines:

    ++ locations_to_diff='Clue/Tests
    Clue/Clue\ WatchKit\ Extension'
    +++ git ls-tree --name-only --full-tree -r HEAD -- Clue/Tests 'Clue/Clue\ WatchKit\ Extension'
    

    See the escaping in the quoted string? That's not the best of situations :crocodile:

    The fix I'm using, but I can't tell if it's a totally stupid idea (or else I'd send a PR!) is to remove the sed, and then I get the output as expected:

    ...
    ++ '[' -e .formatting-directory ']'
    +++ cat .formatting-directory
    ++ locations_to_diff='Clue/Tests
    Clue/Clue WatchKit Extension'
    +++ git ls-tree --name-only --full-tree -r HEAD -- Clue/Tests 'Clue/Clue WatchKit Extension'
    ...
    ++ files='Clue/Clue WatchKit Extension/BWWKEApplication.h
    Clue/Clue WatchKit Extension/BWWKEApplication.m
    Clue/Tests/BWAPICredentialServiceTest.m
    Clue/Tests/BWAPIRequestOperationManagerTest.m
    ...
    

    So basically..

    Can we drop that sed command and trust Bash to do the Right Thing™? Is that a flag option, a version thing, an OS thing?

    opened by notjosh 5
  • Fixes to setup-repo.sh

    Fixes to setup-repo.sh

    • Commit hook was missing shebang
    • Commit hook wasn't working correctly with spaces in the repository path
    • .clang-format is no longer overwritten with a symlink if it exists already
    • .clang-format is no longer added to .gitignore if it's already part of the git tree
    opened by ksuther 5
  • Not work quite right when format the Objective-C block

    Not work quite right when format the Objective-C block

    I've got my block formatted like this

    [deviceManager syncDatasByIndexes:indexes finish:^{
    [self doSomething]; // not formatted
    }];
    

    or this way:

    [deviceManager syncDatasByIndexes:indexes
    [deviceManager syncDatasByIndexes
                               finish:^{
      [self doSomething]; // not formatted
                               }];
    

    Should I change the .clang-format "Language" value? Or this feature hasn't supported yet?

    opened by BillZong 4
  • Clean up the echo such that the path can be easily copy pasted.

    Clean up the echo such that the path can be easily copy pasted.

    Currently it outputs the quotes:

    🚸 Format and stage individual files:
    "/Users/cwoodward/Development/register/Pods/SpaceCommander"/format-objc-file.sh 'Frameworks/SquarePOS/Sources/OpenTicket/UI/RQParentOpenTicketsViewController.m' && git add 'Frameworks/SquarePOS/Sources/OpenTicket/UI/RQParentOpenTicketsViewController.m';
    
    🚀  Format and stage all affected files:
    	 "/Users/cwoodward/Development/register/Pods/SpaceCommander"/format-objc-files.sh -s
    
    🔴  There were formatting issues with this commit, run the👆 above👆 command to fix.
    💔  Commit anyway and skip this check by running git commit --no-verify
    

    After fix:

    🚸 Format and stage individual files:
    /Users/cwoodward/Development/register/Pods/SpaceCommander/format-objc-file.sh 'Frameworks/SquarePOS/Sources/OpenTicket/UI/RQParentOpenTicketsViewController.m' && git add 'Frameworks/SquarePOS/Sources/OpenTicket/UI/RQParentOpenTicketsViewController.m';
    
    🚀  Format and stage all affected files:
    	 /Users/cwoodward/Development/register/Pods/SpaceCommander/format-objc-files.sh -s
    
    🔴  There were formatting issues with this commit, run the👆 above👆 command to fix.
    💔  Commit anyway and skip this check by running git commit --no-verify
    
    opened by cwoodwar6 3
  • Add directories to ignore configuration

    Add directories to ignore configuration

    common-lib.sh will now ignore files in directories listed in .formatting-directories-ignore. Included usage under the configuration section in the README.

    Related issue: https://github.com/square/spacecommander/issues/49

    opened by addoshi 3
  • .formatting-directory can now contain multiple directories

    .formatting-directory can now contain multiple directories

    common-lib.sh will now check .formatting-directory for multiple lines. This makes it easier to support the standard Xcode project format where there's one directory per target.

    Ideally I'd be able to exclude individual directories or files, but this is a pretty good solution and works without any other changes.

    opened by ksuther 3
  • Seemingly incorrect space in method signature.

    Seemingly incorrect space in method signature.

    Consider the following method signature:

    + (void)swapImplementationOf:(SEL)old with:(SEL)new
    {
        // ...
    }
    

    For some reason the use of the word new triggers a space being inserted before it:

    -+ (void)swapImplementationOf:(SEL)old with:(SEL)new
    ++ (void)swapImplementationOf:(SEL)old with:(SEL) new
    

    This doesn’t seem to be a configurable option, so it appears to be a bug. I did a quick search through the codebase but couldn’t find anything related to new, so at least filing a ticket for now.

    I’m working around it for now by renaming the parameter.

    opened by alloy 3
  • The Closing Bracket On Method Calls With A Block Argument Does Not Have Matching Indentation

    The Closing Bracket On Method Calls With A Block Argument Does Not Have Matching Indentation

    If you have this block of code:

    [system presentViewControllerWithClass:[TAFOutboundSearchResultsViewController class]
                        configurationBlock:^(TAFOutboundSearchResultsViewController *outboundSearchResultsViewController) {
    // TODO: Fill In Code Here
    }];
    

    When you run the formatter, it converts the block of code to this:

    [system presentViewControllerWithClass:[TAFOutboundSearchResultsViewController class]
                        configurationBlock:^(TAFOutboundSearchResultsViewController *outboundSearchResultsViewController) {
    // TODO: Fill In Code Here
                        }];
    

    screen shot 2015-06-30 at 1 52 07 pm

    This issue existed in the past when I was just using a .clang-format file and the clang-format command-line tool, so I think fixing this is more of a feature request than an actual bug. Thanks again for fixing #10.

    opened by Kurry 3
  • Bump addressable from 2.7.0 to 2.8.1

    Bump addressable from 2.7.0 to 2.8.1

    Bumps addressable from 2.7.0 to 2.8.1.

    Changelog

    Sourced from addressable's changelog.

    Addressable 2.8.1

    • refactor Addressable::URI.normalize_path to address linter offenses (#430)
    • remove redundant colon in Addressable::URI::CharacterClasses::AUTHORITY regex (#438)
    • update gemspec to reflect supported Ruby versions (#466, #464, #463)
    • compatibility w/ public_suffix 5.x (#466, #465, #460)
    • fixes "invalid byte sequence in UTF-8" exception when unencoding URLs containing non UTF-8 characters (#459)
    • Ractor compatibility (#449)
    • use the whole string instead of a single line for template match (#431)
    • force UTF-8 encoding only if needed (#341)

    #460: sporkmonger/addressable#460 #463: sporkmonger/addressable#463 #464: sporkmonger/addressable#464 #465: sporkmonger/addressable#465 #466: sporkmonger/addressable#466

    Addressable 2.8.0

    • fixes ReDoS vulnerability in Addressable::Template#match
    • no longer replaces + with spaces in queries for non-http(s) schemes
    • fixed encoding ipv6 literals
    • the :compacted flag for normalized_query now dedupes parameters
    • fix broken escape_component alias
    • dropping support for Ruby 2.0 and 2.1
    • adding Ruby 3.0 compatibility for development tasks
    • drop support for rack-mount and remove Addressable::Template#generate
    • performance improvements
    • switch CI/CD to GitHub Actions
    Commits
    • 8657465 Update version, gemspec, and CHANGELOG for 2.8.1 (#474)
    • 4fc5bb6 CI: remove Ubuntu 18.04 job (#473)
    • 860fede Force UTF-8 encoding only if needed (#341)
    • 99810af Merge pull request #431 from ojab/ct-_do_not_parse_multiline_strings
    • 7ce0f48 Merge branch 'main' into ct-_do_not_parse_multiline_strings
    • 7ecf751 Merge pull request #449 from okeeblow/freeze_concatenated_strings
    • 41f12dd Merge branch 'main' into freeze_concatenated_strings
    • 068f673 Merge pull request #459 from jarthod/iso-encoding-problem
    • b4c9882 Merge branch 'main' into iso-encoding-problem
    • 08d27e8 Merge pull request #471 from sporkmonger/sporkmonger-enable-codeql
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump tzinfo from 1.2.8 to 1.2.10

    Bump tzinfo from 1.2.8 to 1.2.10

    Bumps tzinfo from 1.2.8 to 1.2.10.

    Release notes

    Sourced from tzinfo's releases.

    v1.2.10

    TZInfo v1.2.10 on RubyGems.org

    v1.2.9

    • Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a zoneinfo file that includes rules specifying an additional transition to the final defined offset (for example, Africa/Casablanca in version 2018e of the Time Zone Database). #123.

    TZInfo v1.2.9 on RubyGems.org

    Changelog

    Sourced from tzinfo's changelog.

    Version 1.2.10 - 19-Jul-2022

    Version 1.2.9 - 16-Dec-2020

    • Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a zoneinfo file that includes rules specifying an additional transition to the final defined offset (for example, Africa/Casablanca in version 2018e of the Time Zone Database). #123.
    Commits
    • 0814dcd Fix the release date.
    • fd05e2a Preparing v1.2.10.
    • b98c32e Merge branch 'fix-directory-traversal-1.2' into 1.2
    • ac3ee68 Remove unnecessary escaping of + within regex character classes.
    • 9d49bf9 Fix relative path loading tests.
    • 394c381 Remove private_constant for consistency and compatibility.
    • 5e9f990 Exclude Arch Linux's SECURITY file from the time zone index.
    • 17fc9e1 Workaround for 'Permission denied - NUL' errors with JRuby on Windows.
    • 6bd7a51 Update copyright years.
    • 9905ca9 Fix directory traversal in Timezone.get when using Ruby data source
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump cocoapods-downloader from 1.4.0 to 1.6.3

    Bump cocoapods-downloader from 1.4.0 to 1.6.3

    Bumps cocoapods-downloader from 1.4.0 to 1.6.3.

    Release notes

    Sourced from cocoapods-downloader's releases.

    1.6.3

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.2

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.1

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.0

    Enhancements
    • None.
    Bug Fixes
    • Adds a check for command injections in the input for hg and git.
      orta #124

    1.5.1

    Enhancements
    • None.
    Bug Fixes
    • Fix "can't modify frozen string" errors when pods are integrated using the branch option
      buju77 #10920

    1.5.0

    ... (truncated)

    Changelog

    Sourced from cocoapods-downloader's changelog.

    1.6.3 (2022-04-01)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.2 (2022-03-28)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.1 (2022-03-23)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.0 (2022-03-22)

    Enhancements
    • None.
    Bug Fixes
    • Adds a check for command injections in the input for hg and git.
      orta #124

    1.5.1 (2021-09-07)

    Enhancements
    • None.

    ... (truncated)

    Commits
    • c03e2ed Release 1.6.3
    • f75bccc Disable Bazaar tests due to macOS 12.3 not including python2
    • 52a0d54 Merge pull request #128 from CocoaPods/validate_before_dl
    • d27c983 Ensure that the git pre-processor doesn't accidentally bail also
    • 3adfe1f [CHANGELOG] Add empty Master section
    • 591167a Release 1.6.2
    • d2564c3 Merge pull request #127 from CocoaPods/validate_before_dl
    • 99fec61 Switches where we check for invalid input, to move it inside the download fun...
    • 96679f2 [CHANGELOG] Add empty Master section
    • 3a7c54b Release 1.6.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • NS_SWIFT_NAME with getter: is formatted incorrectly

    NS_SWIFT_NAME with getter: is formatted incorrectly

    Given the following code in a header:

    typedef NS_ENUM(NSUInteger, MyEnum) {
        MyEnumValueA,
        MyEnumValueB,
        MyEnumValueC,
    };
    
    extern NSString *MyEnumGetDescription(MyEnum value) NS_SWIFT_NAME(getter:MyEnum.description(self:));
    

    running format-objc-file.sh will result in this:

    typedef NS_ENUM(NSUInteger, MyEnum) {
        MyEnumValueA,
        MyEnumValueB,
        MyEnumValueC,
    };
    
    extern NSString *MyEnumGetDescription(MyEnum value) NS_SWIFT_NAME(getter
                                                                      : MyEnum.description(self:));
    

    which is invalid, and throws a warning in Xcode:

    'swift_name' attribute has invalid identifier for context name`

    here's the .clang-format used when running against this code:

    ---
    IndentNestedBlocks: false
    AllowNewlineBeforeBlockParameter: false
    
    Language:        Cpp
    AccessModifierOffset: -1
    ConstructorInitializerIndentWidth: 4
    SortIncludes: false
    
    AlignAfterOpenBracket: true
    AlignEscapedNewlinesLeft: true
    AlignOperands: false
    AlignTrailingComments: true
    
    AllowAllParametersOfDeclarationOnNextLine: false
    AllowShortBlocksOnASingleLine: false
    AllowShortCaseLabelsOnASingleLine: false
    AllowShortFunctionsOnASingleLine: true
    AllowShortIfStatementsOnASingleLine: true
    AllowShortFunctionsOnASingleLine: All
    AllowShortLoopsOnASingleLine: true
    
    AlwaysBreakAfterDefinitionReturnType: false
    AlwaysBreakTemplateDeclarations: false
    AlwaysBreakBeforeMultilineStrings: false
    
    BreakBeforeBinaryOperators: None
    BreakBeforeTernaryOperators: false
    BreakConstructorInitializersBeforeComma: false
    
    BinPackArguments: true
    BinPackParameters: true
    ColumnLimit: 0
    ConstructorInitializerAllOnOneLineOrOnePerLine: true
    DerivePointerAlignment: false
    ExperimentalAutoDetectBinPacking: false
    IndentCaseLabels: true
    IndentWrappedFunctionNames: false
    IndentFunctionDeclarationAfterType: false
    MaxEmptyLinesToKeep: 2
    KeepEmptyLinesAtTheStartOfBlocks: false
    NamespaceIndentation: Inner
    ObjCBlockIndentWidth: 4
    ObjCSpaceAfterProperty: true
    ObjCSpaceBeforeProtocolList: true
    PenaltyBreakBeforeFirstCallParameter: 10000
    PenaltyBreakComment: 300
    PenaltyBreakString: 1000
    PenaltyBreakFirstLessLess: 120
    PenaltyExcessCharacter: 1000000
    PenaltyReturnTypeOnItsOwnLine: 200
    PointerAlignment: Right
    SpacesBeforeTrailingComments: 1
    Cpp11BracedListStyle: true
    Standard:        Auto
    IndentWidth:     4
    TabWidth:        8
    UseTab:          Never
    BreakBeforeBraces: Custom
    BraceWrapping: 
        AfterClass: true
        AfterControlStatement: false
        AfterEnum: false
        AfterFunction: true
        AfterNamespace: true
        AfterObjCDeclaration: true
        AfterStruct: false
        AfterUnion: false
        BeforeCatch: false
        BeforeElse: false
        IndentBraces: false
    
    SpacesInParentheses: false
    SpacesInSquareBrackets: false
    SpacesInAngles:  false
    SpaceInEmptyParentheses: false
    SpacesInCStyleCastParentheses: false
    SpaceAfterCStyleCast: false
    SpacesInContainerLiterals: true
    SpaceBeforeAssignmentOperators: true
    
    ContinuationIndentWidth: 4
    CommentPragmas:  '^ IWYU pragma:'
    ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
    SpaceBeforeParens: ControlStatements
    DisableFormat:   false
    ...
    
    opened by amorde 4
  • Formatting breaks code

    Formatting breaks code

    This:

            NSDateComponents *todayComp = [calendar components:(NSCalendarUnitYear |
                                                                NSCalendarUnitMonth |
                                                                NSCalendarUnitDay |
                                                                NSCalendarUnitWeekday |
                                                                NSCalendarUnitHour |
                                                                NSCalendarUnitMinute |
                                                                NSCalendarUnitSecond)
                                                      fromDate:today];
    

    gets formatted into this:

            NSDateComponents *todayComp = [calendar components:(NSCalendarUnitYear |
                                                                NSCalendarUnitMonth |
                                                                NSCalendarUnitDay |
                                                                NSCalendarUnitWeekday |
                                                                NSCalendarUnitHour |
                                                                NSCalendarUnitMinute |
                                                                NSCalendarUnitSecond);
                                                      fromDate:today];
    
    opened by Cyberbeni 0
Owner
Square
Square
Find common xib and storyboard-related problems without running your app or writing unit tests.

IBAnalyzer Find common xib and storyboard-related problems without running your app or writing unit tests. Usage Pass a path to your project to ibanal

Arek Holko 955 Oct 15, 2022
SwiftCop is a validation library fully written in Swift and inspired by the clarity of Ruby On Rails Active Record validations.

SwiftCop is a validation library fully written in Swift and inspired by the clarity of Ruby On Rails Active Record validations. Objective Build a stan

Andres Canal 542 Sep 17, 2022
Objective-C style checker

ocstyle Objective-C style checker Installation pip install ocstyle Example If you have a file called test.m like this: @implementation SomeClass +(v

Cue 256 Feb 2, 2022
A static source code analysis tool to improve quality and reduce defects for C, C++ and Objective-C

OCLint - https://oclint.org OCLint is a static code analysis tool for improving quality and reducing defects by inspecting C, C++ and Objective-C code

The OCLint Static Code Analysis Tool 3.6k Dec 29, 2022
Xcode plugin to open the GitHub page of the commit of the currently selected line in the editor window.

Show in GitHub / BitBucket Xcode plugin to open a related Github or BitBucket page directly from the Xcode editor code window. Installs easily through

Lars Schneider 242 Jul 20, 2022
A Cocoa NSFormatter subclass to convert dates to and from ISO-8601-formatted strings. Supports calendar, week, and ordinal formats.

ISO 8601: The only date format worth using Obligatory relevant xkcd: How to use this code in your program Add the source files to your project. Parsin

Peter Hosey 601 Sep 4, 2022
A lightweight Swift logger, uses `print` in development and `NSLog` in production. Support colourful and formatted output.

Loggerithm A lightweight Swift logger, uses print in Debug and NSLog in Production with colourful output. Why In Swift, we usually use print to log in

HongHao Zhang 270 Oct 8, 2022
Get formatted call stack symbols.

CallStackSymbols Formatted call stack symbols for iOS. Installation Supports Swift Package Manager. Usage Get current call stack symbols as DLADDR arr

Naruki Chigira 9 Sep 7, 2022
Trying to implement Unit Tests for @Binding properties in a ViewModel

BindingTester Trying to implement Unit Tests for @Binding properties in a ViewModel ViewModel to be tested class SheetViewModel: ObservableObject {

Raphael Guye 0 Oct 22, 2021
Trying TDD with ARKit

ARPlacer BDD Spec As a user I want to place a random object in real world. I also want to see the distance between AR object and my phone. Use Cases

null 0 Dec 21, 2021
I'm trying to make Flutter based Audio Unit Extensions possible.

Flutter AUv3 Audio Unit Error Demo Motivation We are the developers of Audanika, a professional MIDI Controller app written in Flutter. Many of our us

Gabriel Gatzsche 0 Jan 5, 2022
Small app trying to recreate the Github's repos section from the iOS app with RxSwift and .nibs

Github Profile Repos Small app trying to recreate the Github's repos section from the iOS app with RxSwift and .nibs. This project is currently in pro

Leonardo 1 Apr 5, 2022
Proof of concept app for trying to integrate passkeys and WebAuthn into Vapor

Vapor Passkey Demo Proof of concept app for trying to integrate passkeys and WebAuthn into Vapor Usage Clone the project, then in Terminal run swift r

Tim Condon 70 Dec 20, 2022
JSPatch bridge Objective-C and Javascript using the Objective-C runtime. You can call any Objective-C class and method in JavaScript by just including a small engine. JSPatch is generally used to hotfix iOS App.

JSPatch 中文介绍 | 文档 | JSPatch平台 请大家不要自行接入 JSPatch,统一接入 JSPatch 平台,让热修复在一个安全和可控的环境下使用。原因详见 这里 JSPatch bridges Objective-C and JavaScript using the Object

bang 11.4k Jan 1, 2023
Automatic testing of your Pull Requests on GitHub and BitBucket using Xcode Server. Keep your team productive and safe. Get up and running in minutes. @buildasaur

Buildasaur Automatic testing of your Pull Requests on GitHub and BitBucket using Xcode Server. Keep your team productive and safe. Get up and running

Buildasaurs 774 Dec 11, 2022
Allow users to easily share Diagnostics with your support team to improve the flow of fixing bugs.

Example mail composer Example Report Diagnostics is a library written in Swift which makes it really easy to share Diagnostics Reports to your support

WeTransfer 768 Dec 22, 2022
This is an open-source project for the aesthetic evaluation of images based on the deep learning-caffe framework, which we completed in the Victory team of Besti.

This is an open-source project for the aesthetic evaluation of images based on the deep learning-caffe framework, which we completed in the Victory team of Besti.

The Victory Group of Besti 102 Dec 15, 2022
SGS Last Punch - SGS 2021 Dev Camp 2nd Team Last Punch

Snack 여러 협업 툴을 사용하면서 새 창을 키거나 알트탭은 그만! Slack과 Notion의 기능을 합친 Snack으로 쾌적한 협업을 경험해

Jihyo Kim 10 Oct 20, 2022
Apple Developer Academy @ POSTECH, Afternoon Session 17 team's Mini Challenge Project

?? NatureUp Apple Developer Academy @ POSTECH, Afternoon Session 17 team's MC1 Project 사회가 발전하며 환경이 파괴되는 속도가 가속화되고 그 영향이 서서히 드러나며, 사람들의 환경에 대한 관심도는 점점

개발자아카데미_포스텍 5 Jul 22, 2022
Apple Developer Academy @ POSTECH Afternoon Session Team 13 MC2

?? Project Title A brief description of what this project does and who it's for ?? Features Light/dark mode toggle Live previews Fullscreen mode Cross

개발자아카데미_포스텍 12 Dec 13, 2022