danger / danger-plugin-template

An opinionated template for creating a Danger plugin
Other
20 stars 10 forks source link

Remind users to setup a git repository and add as a remote #7

Closed dbgrandi closed 7 years ago

dbgrandi commented 8 years ago

If you create a new plugin from this and run bundle exec rake spec before setting up a git repo and adding it to your project as a remote, you'll get a runtime error

     RuntimeError:
       Could not find a Request Source

This is hard to parse for users, so we should explicitly let users know to do this either in the README, printing out when you run configure, or adding a default failing spec that reminds you to set it up.

felipesabino commented 7 years ago

@dbgrandi Oh thank you!

However, I did not have this exact error message, but a warning instead

Could not set up API to Code Review site for Danger

For Danger to run on this project, you need to expose a set of following the ENV vars:
 - GitHub: DANGER_GITHUB_API_TOKEN
 - GitLab: DANGER_GITLAB_API_TOKEN
 - BitbucketServer: DANGER_BITBUCKETSERVER_USERNAME, DANGER_BITBUCKETSERVER_PASSWORD, DANGER_BITBUCKETSERVER_HOST
 - BitbucketCloud: DANGER_BITBUCKETCLOUD_USERNAME, DANGER_BITBUCKETCLOUD_PASSWORD

Found these keys in your ENV: HAS_JOSH_K_SEAL_OF_APPROVAL, TRAVIS_PULL_REQUEST, TRAVIS_REPO_SLUG, TRAVIS_COMMIT_RANGE, DANGER_GITHUB_API_TOKEN.

Failing the build, Danger cannot run without API access.
You can see more information at http://danger.systems/guides/getting_started.html

The main problem is that this warning was shown after it failed silently at a RequestSource exception, which I found only after a while because I desperately added many begin/rescue statements, which then gave me enough information to connect it with this issue.

This is hard to parse for users

That's true, I have been trying to parse this it has been a while.

so we should explicitly let users know to do this either in the README, printing out when you run configure

Don't know about README, just noticed that it was not the place I went to when I started having this issues (I just checked it now that I read your message) and if this had been printed when I ran configure and I missed, I would have lost the same amount of time.

Do you know if there an easy way to check it and improve the error message instead? I mean, I could always do something like system("git remote -v"), but I am assuming that the must be a more elegant way inside danger environment and I am just not aware.


Environment:

OSX 10.11.6 Ruby 2.2.3p173 Danger 3.4.0