Coder Social home page Coder Social logo

rogerluan / danger-ruby-swiftformat Goto Github PK

View Code? Open in Web Editor NEW

This project forked from garriguv/danger-ruby-swiftformat

0.0 2.0 0.0 105 KB

A danger plugin to check Swift formatting using SwiftFormat.

License: MIT License

Ruby 98.45% Shell 1.55%

danger-ruby-swiftformat's Introduction

danger-swiftformat Gem Version

A Danger plugin to check Swift formatting using SwiftFormat.

This plugin is heavily inspired by danger-swiftlint.

Installation

Add this line to your Gemfile:

gem 'danger-swiftformat'

SwiftFormat also needs to be installed before you run Danger.

Usage

Add this to your Dangerfile

swiftformat.check_format

By default, danger-swiftformat will check added and modified files.

Options and parameters

If you want errors to fail Danger, you can use the fail_on_error option:

swiftformat.check_format(fail_on_error: true)

You can specify the swiftformat binary using the binary_path parameter:

swiftformat.binary_path = "/path/to/swiftformat"

You can specify the Swift version of your project using the swiftversion parametter:

swiftformat.swiftversion = "5"

You can specify additional swiftformat arguments using the additional_args parameter:

swiftformat.additional_args = "--indent tab --self insert"

You can specify additional message (e.g. how to fix format issue) for danger comment using the additional_message parameter:

swiftformat.additional_message = "your additional message for contributor"

By default, danger-swiftformat will run on any modified or created file ending in .swift. If you'd like to exclude certain directories or files such as Pods, you can use the exclude parameter:

swiftformat.exclude = %w(Pods/** Carthage/** Sources/Nope.swift **/*_autogenerated.swift)

The exclude option takes an array of glob patterns; you can find additional documentation on the patterns here.

Development

  1. Clone this repo
  2. Run bundle install to setup dependencies.
  3. Run bundle exec rake spec to run the tests.
  4. Use bundle exec guard to automatically have tests run as you make changes.
  5. Make your changes.

Releasing a new version

Use the release.sh script:

./scripts/release.sh

Then bump the gem to the next patch version.

danger-ruby-swiftformat's People

Contributors

alephao avatar bawjensen avatar dependabot[bot] avatar garriguv avatar giginet avatar ileitch avatar lexrus avatar mgrebenets avatar nickdomenicali avatar r-plus avatar trispo avatar

Watchers

 avatar  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.