Skip to content

Instantly share code, notes, and snippets.

@mohammad19991
Last active April 25, 2018 11:26
Show Gist options
  • Select an option

  • Save mohammad19991/61b6619c83d489a6ce9615f692cda251 to your computer and use it in GitHub Desktop.

Select an option

Save mohammad19991/61b6619c83d489a6ce9615f692cda251 to your computer and use it in GitHub Desktop.

Revisions

  1. mohammad19991 revised this gist Apr 25, 2018. No changes.
  2. mohammad19991 revised this gist Apr 25, 2018. No changes.
  3. mohammad19991 renamed this gist Apr 25, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. mohammad19991 revised this gist Apr 25, 2018. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions swiftlint
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    ```bash
    #if [ "${CONFIGURATION}" = "Debug" ]; then
    if which swiftlint >/dev/null; then
    count=0
    @@ -22,5 +21,4 @@ if which swiftlint >/dev/null; then
    else
    echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
    fi
    #fi
    ```
    #fi
  5. mohammad19991 revised this gist Apr 25, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion swiftlint
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    ```bash
    #if [ "${CONFIGURATION}" = "Debug" ]; then
    if which swiftlint >/dev/null; then
    count=0
    @@ -21,4 +22,5 @@ if which swiftlint >/dev/null; then
    else
    echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
    fi
    #fi
    #fi
    ```
  6. mohammad19991 created this gist Apr 25, 2018.
    24 changes: 24 additions & 0 deletions swiftlint
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    #if [ "${CONFIGURATION}" = "Debug" ]; then
    if which swiftlint >/dev/null; then
    count=0

    for file_path in $(git diff --diff-filter=ACM --name-only | grep ".*.swift$"); do
    export SCRIPT_INPUT_FILE_$count=$file_path
    count=$((count + 1))
    done

    for file_path in $(git diff --cached --name-only --diff-filter=ACM | grep ".*.swift$"); do
    export SCRIPT_INPUT_FILE_$count=$file_path
    count=$((count + 1))
    done

    export SCRIPT_INPUT_FILE_COUNT=$count

    if (( $count > 0 )); then
    swiftlint --config .swiftlint.yml --use-script-input-files
    fi

    else
    echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
    fi
    #fi