{"action":"created","issue":{"url":"https://api.github.com/repos/brigade/overcommit/issues/423","repository_url":"https://api.github.com/repos/brigade/overcommit","labels_url":"https://api.github.com/repos/brigade/overcommit/issues/423/labels{/name}","comments_url":"https://api.github.com/repos/brigade/overcommit/issues/423/comments","events_url":"https://api.github.com/repos/brigade/overcommit/issues/423/events","html_url":"https://github.com/brigade/overcommit/issues/423","id":172970970,"number":423,"title":"Overcommit should error when environment variables are not strings","user":{"login":"binarymason","id":12122953,"avatar_url":"https://avatars.githubusercontent.com/u/12122953?v=3","gravatar_id":"","url":"https://api.github.com/users/binarymason","html_url":"https://github.com/binarymason","followers_url":"https://api.github.com/users/binarymason/followers","following_url":"https://api.github.com/users/binarymason/following{/other_user}","gists_url":"https://api.github.com/users/binarymason/gists{/gist_id}","starred_url":"https://api.github.com/users/binarymason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/binarymason/subscriptions","organizations_url":"https://api.github.com/users/binarymason/orgs","repos_url":"https://api.github.com/users/binarymason/repos","events_url":"https://api.github.com/users/binarymason/events{/privacy}","received_events_url":"https://api.github.com/users/binarymason/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/brigade/overcommit/labels/bug","name":"bug","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-24T14:43:25Z","updated_at":"2016-08-24T19:07:45Z","closed_at":null,"body":"#### When env variable value is a boolean...\r\n```yml\r\nPrePush:\r\n  RSpec:\r\n    enabled: true\r\n    quiet: false\r\n    description: 'Run RSpec test suite'\r\n    env:\r\n      CODE_COVERAGE: true\r\n    command: ['bundle', 'exec', 'rspec', 'spec', '--tag', '~type:request']\r\n```\r\n\r\n#### Overcommit blows up.\r\n```sh\r\n$ git push\r\nRunning pre-push hooks\r\nRun RSpec test suite..........................................[RSpec] FAILED\r\nHook raised unexpected error\r\nno implicit conversion of true into String\r\n```\r\n\r\n#### When env variable is string...\r\n```yml\r\nPrePush:\r\n  RSpec:\r\n    enabled: true\r\n    quiet: false\r\n    description: 'Run RSpec test suite'\r\n    env:\r\n      CODE_COVERAGE: 'truthy' # why does this have to be a string?\r\n    command: ['bundle', 'exec', 'rspec', 'spec', '--tag', '~type:request']\r\n```\r\n\r\n#### Overcommit works with no issues.\r\n\r\n\r\nAm I missing something or does overcommit depend on having a string?"},"comment":{"url":"https://api.github.com/repos/brigade/overcommit/issues/comments/242175197","html_url":"https://github.com/brigade/overcommit/issues/423#issuecomment-242175197","issue_url":"https://api.github.com/repos/brigade/overcommit/issues/423","id":242175197,"user":{"login":"sds","id":677877,"avatar_url":"https://avatars.githubusercontent.com/u/677877?v=3","gravatar_id":"","url":"https://api.github.com/users/sds","html_url":"https://github.com/sds","followers_url":"https://api.github.com/users/sds/followers","following_url":"https://api.github.com/users/sds/following{/other_user}","gists_url":"https://api.github.com/users/sds/gists{/gist_id}","starred_url":"https://api.github.com/users/sds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sds/subscriptions","organizations_url":"https://api.github.com/users/sds/orgs","repos_url":"https://api.github.com/users/sds/repos","events_url":"https://api.github.com/users/sds/events{/privacy}","received_events_url":"https://api.github.com/users/sds/received_events","type":"User","site_admin":false},"created_at":"2016-08-24T19:07:44Z","updated_at":"2016-08-24T19:07:44Z","body":"My concern with that approach is that developers who don't understand that environment variables are strings will be confused when running:\r\n\r\n```ruby\r\nif ENV['MY_BOOLEAN_VALUE']\r\n  puts 'True!'\r\nelse\r\n  puts 'False!'\r\nend\r\n```\r\n\r\n...returns `True!` when they've set their environment variable to `false` (which was converted to the string `\"false\"`, which is truthy."}}
{"actor":{"display_login":"sds"}}