Skip to content

Sadler and SwiftLint #48

@bolom

Description

@bolom

Hi

I have tried to create my shell script

# Run SwiftLint for given filename
run_swiftlint() {
    local filename="${1}"
    if [[ "${filename##*.}" == "swift" ]]; then
        ${SWIFT_LINT} autocorrect --path "${filename}"
        ${SWIFT_LINT} lint --path "${filename}" --reporter checkstyle | checkstyle_filter-git diff origin/master \
        | saddler report \
       --require saddler/reporter/github \
       --reporter Saddler::Reporter::Github::PullRequestReviewComment
    fi
}

if [[ -e "${SWIFT_LINT}" ]]; then
    echo "SwiftLint version: $(${SWIFT_LINT} version)"
    # Run for both staged and unstaged files
    git diff --name-only origin/master| while read filename; do run_swiftlint "${filename}"; done
else
    echo "${SWIFT_LINT} is not installed."
    exit 0
fi

  github-status-notifier notify --exit-status $? --context lobobot/swift
END_DATE=$(date +"%s")

DIFF=$(($END_DATE - $START_DATE))
echo "SwiftLint took $(($DIFF / 60)) minutes and $(($DIFF % 60)) seconds to complete."

It's return me this error

Done linting! Found 12 violations, 5 serious in 1 file.
E, [2016-05-16T06:38:19.707098 #59864] ERROR -- Saddler: options
E, [2016-05-16T06:38:19.707261 #59864] ERROR -- Saddler: {"options"=>{}, "debug"=>false, "verbose"=>false, "require"=>"saddler/reporter/github", "reporter"=>"Saddler::Reporter::Github::PullRequestReviewComment"}
E, [2016-05-16T06:38:19.707333 #59864] ERROR -- Saddler: input data
E, [2016-05-16T06:38:19.707355 #59864] ERROR -- Saddler: <?xml version='1.0' encoding='UTF-8'?>
<checkstyle version='4.3'>

and issue with the token

E, [2016-05-16T06:38:19.708048 #59864] ERROR -- Saddler: reporter
E, [2016-05-16T06:38:19.708101 #59864] ERROR -- Saddler: #<Saddler::Reporter::Github::PullRequestReviewComment:0x007fd74b583250 @output=#<IO:<STDOUT>>>
/Users/Michelin/.rvm/gems/ruby-2.3.1/gems/octokit-4.3.0/lib/octokit/response/raise_error.rb:16:in `on_complete': GET https://api.github.com/repos/stefanka-lingerie/mirada/pulls/files: 404 - Not Found // See: https://developer.github.com/v3 (Octokit::NotFound)

i have set the token, it's working bc when i have tested

github-status-notifier notify --exit-status pending --context lobobot/swift

It's working

tks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions