Giter Club home page Giter Club logo

sharpshooter's Introduction

Sharpshooter

Sharpshooter is an Xcode extension for Swift developers who like to debug code by inserting print() statements everywhere, which is totally not you, right?

The name comes from a joke about a Texan sharpshooter who fires gunshots at the door of a barn, then draws a target around the biggest cluster of hits and claims to be a sharpshooter – a pretty accurate analogy for finding bugs using print(), I think.

It has only two features: Add Comments places print() calls at the start of all your methods, and Remove Comments removes the print() calls that were inserted.

Here’s an example of code before adding comments:

class BrokenStuff {
    func broken() {
        print("<Silent screaming>")
    }

    private func reallyBroken() {
        print("<Tears>")
    }

    static private func superBroken() {
        print("<Silent screaming *and* tears>")
    }
}

And after:

class BrokenStuff {
    func broken() {
        print("# Sharpshooter: Entering broken()")
        print("<Silent screaming>")
    }

    private func reallyBroken() {
        print("# Sharpshooter: Entering reallyBroken()")
        print("<Tears>")
    }

    static private func superBroken() {
        print("# Sharpshooter: Entering superBroken()")
        print("<Silent screaming and tears>")
    }
}

Installation

Xcode extensions are compiled as part of a basically useless macOS app. I've built the extension for you and in theory it should work:

  1. Go to the latest release
  2. Download and extract the zip.
  3. Move Sharpshooter.app to your Mac's Applications directory. You may need to launch the app at least once to register its extension.
  4. Relaunch Xcode.

To build the extension from scratch you need to:

  1. Clone this repository.
  2. Activate your team for signing both the macOS app and the extension.
  3. Build the macOS app.
  4. Move the built macOS app to your Mac’s Applications folder. You may need to launch the app at least once to register its extension.
  5. Relaunch Xcode.

You can check that the extension is installed by going to your Mac's system preferences, choosing Extensions > Xcode Source Editor, and verifying that there's a check next to Sharpshooter.

Contributing

Contributions are welcome as pull requests. You can file issues if you want, but realistically it’s probably better for everyone if you just fix the issue and open a pull request – the code is really simple.

License

MIT, natch.

sharpshooter's People

Contributors

twostraws avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.