codeclimate / test-reporter

Code Climate Test Reporter
MIT License
156 stars 76 forks source link

cc-test-reporter false error message if id unset #404

Open pieterza opened 5 years ago

pieterza commented 5 years ago

cc-test-reporter wrongly reports file not found when both -r and -i specified, and -r given an empty var/value. It should report a missing reporter id instead.

./cc-test-reporter upload-coverage -r ${EMPTY} -i coverage/codeclimate.total.json
Error: open coverage/codeclimate.json: no such file or directory
Usage:
  cc-test-reporter upload-coverage [flags]

Flags:
  -s, --batch-size int    batch size for source files (default 500)
  -e, --endpoint string   endpoint to upload coverage information to (default "https://api.codeclimate.com/v1/test_reports")
  -r, --id string         reporter identifier (default "1")
  -i, --input string      input path (default "coverage/codeclimate.json")
      --insecure          send coverage insecurely (without HTTPS)

Global Flags:
  -d, --debug   run in debug mode

Versus:

 ./cc-test-reporter upload-coverage -r foobar  -i coverage/codeclimate.total.json
Error: response from https://api.codeclimate.com/v1/test_reports.
HTTP 401: You are not authorized for this action
Usage:
  cc-test-reporter upload-coverage [flags]

Flags:
  -s, --batch-size int    batch size for source files (default 500)
  -e, --endpoint string   endpoint to upload coverage information to (default "https://api.codeclimate.com/v1/test_reports")
  -r, --id string         reporter identifier (default "1")
  -i, --input string      input path (default "coverage/codeclimate.json")
      --insecure          send coverage insecurely (without HTTPS)

Global Flags:
  -d, --debug   run in debug mode