Commit Graph

862 Commits

Author SHA1 Message Date
Pyves
a168072cd5 [DotnetStatus] Service deprecation (#1630) 2018-04-02 09:40:50 +01:00
Pyves
3aa21301ff [Ansible] Handle no data responses (#1629) 2018-04-02 09:38:25 +01:00
Paul Melnikow
416d433fa0 [appveyor] Error handling in BaseService (#1590)
Make a clear distinction between programmer errors ("internal errors") and runtime errors, and allow configuring the server to let the programmer errors bubble up in development and unit testing. This saves a huge amount of time because it generates ordinary stack traces when things go wrong. And, if these errors occur in production, we'll catch them, and display **shields | internal error** which is the equivalent of a 500 error.
2018-04-01 22:04:22 -05:00
Pyves
dd35739c5c [CodeClimate] Added missing try-catch block (#1613)
* Added missing try-catch block

* Added tests to cover malformed responses
2018-04-01 17:32:43 +02:00
Pyves
66c5d914c7 [CircleCI] Extended existing try-catch block (#1614) 2018-03-30 09:34:20 +01:00
Paul Melnikow
ac7c418222 Extract examples from new-style services (#1582)
Instead of centralizing examples, specify them from within a service.

* Avoid duplication in service loading + refactor
* Avoid duplication in URLs, rename uri -> url in BaseService
2018-03-30 03:07:44 -05:00
Marcin Mielnicki
fe4ac0bf1c Log errors to Sentry (#1422) 2018-03-24 20:30:51 +01:00
Paul Melnikow
ea4b758612 Move service tests alongside code (#1563)
Per discussion in #1543
2018-03-20 18:32:48 -07:00
Darren Labithiotis
a497ccabf7 [dynamic-xml dynamic-json] Set request options for dynamic json badges. (#1575)
* Set request options for dynamic json badges to include accept header of application/json and json:true

* Added headers for XML dynamic badges

* Added tests for dynamic badges to check correct Accept headers are set
2018-03-19 19:23:13 -04:00
Paul Melnikow
6750115b79 Add [npm] type definitions badge (#1541)
Let a package show off its type definitions based on devDependency data in the published npm package.

Close #1252
2018-03-11 18:00:41 -07:00
Paul Melnikow
2d651533aa New API for registering services: #963 #1423 #1425 #1450 #1451 #1544 #1543
This merges the `node-8` branch. The heavy lift was by @Daniel15 with refactoring from me and a patch by @RedSparr0w.

* New API for registering services (#963)
* Disable Node 6 tests on node-8 branch (#1423)
* BaseService: Factor out methods _regex and _namedParamsForMatch (#1425)
    - Adjust test grouping
    - Rename data -> queryParams, text -> message
* BaseService tests: Use Chai (#1450)
* BaseService: make serviceData and badgeData explicit and declarative (#1451)
* fix isValidStyle test (#1544)
* Run tests in Node 9, not Node 6 (#1543)
2018-03-11 17:53:01 -07:00
Eli Perelman
7545dcfe42 Add [Bugzilla] bugstatus badge (#1492) 2018-03-11 21:50:14 +01:00
chris48s
d5fc786ad3 service tests for [dub] (#1559)
- add tests
- improve error handling
- switch to https
2018-03-09 21:37:33 +00:00
Florian Munz
54afdc189c Add Depfu dependencies badge (#1537) 2018-03-08 11:42:25 -08:00
chris48s
1fab9d70de [gratipay gemnasium snap-ci cauditor] add deprecation helpers, deprecate gemnasium (#1524) 2018-03-07 09:08:51 +00:00
Danial
be09cee1f2 User defined XML source badge [dynamic-xml dynamic-json] (#1494)
* add dynamic xml badge support

* add tests

* dynamic badge add tests for query param

* remove try catch

* use `checkErrorResponse()`

* update tests

* [dynamic json] add test for multiple items

* Rebase, [dynamic xml] Add support for multiple items

* 404 response -> resource not found

* multiple results test less greedy regex

still alot of room for improvement to this test

* update dynamic badge gen

* add dynamic xml gen tests

* update tests id & path

* datalist -> select

* uri -> url

kept support for uri, incase of any already existing badges.

* split dynamic gen uri

* update query placeholder
2018-03-06 22:43:02 +01:00
Danial
f4d5c41009 [Cauditor] Replace with error message (#1502)
* Depreciate Cauditor

* explicitly set color to lightgray, update test

* add message for date of badge depreciation
2018-03-05 05:55:52 +01:00
Marcin Mielnicki
0640356f2c Travis service tests from tutorial (#1531)
Service tests for Travis CI from tutorial
2018-03-04 21:03:01 +00:00
Pyves
9b564424ba [Snap-CI] Replace with error message (#1468)
* Depreciated Snap CI

* Updated badge color to light gray
2018-03-04 09:32:02 +00:00
Paul Melnikow
3b08d9cb35 [Gratipay] Replace with error message (#1449)
Gratipay is gone :(

For #1359

This failure from https://circleci.com/gh/badges/shields/1411?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link

```
  7) Gratipay
       Receiving

	[ GET http://localhost:1111/gratipay/Gratipay.json ]:
     ValidationError: child "value" fails because ["value" with value "invalid" fails to match the required pattern: /^\$[0-9]+(\.[0-9]{2})?\/week/]
      at Object.exports.process (node_modules/joi/lib/errors.js:190:19)
      at internals.Object._validateWithOptions (node_modules/joi/lib/types/any/index.js:669:31)
      at module.exports.internals.Any.root.validate (node_modules/joi/lib/index.js:139:23)
      at Object.pathMatch.matchJSONTypes (node_modules/icedfrisby/lib/pathMatch.js:303:9)
      at node_modules/icedfrisby/lib/icedfrisby.js:703:10
      at IcedFrisbyNock._invokeExpects (node_modules/icedfrisby/lib/icedfrisby.js:1294:33)
      at start (node_modules/icedfrisby/lib/icedfrisby.js:1274:12)
      at Request.runCallback [as _callback] (node_modules/icedfrisby/lib/icedfrisby.js:1232:16)
      at Request.self.callback (node_modules/request/request.js:186:22)
      at Request.<anonymous> (node_modules/request/request.js:1163:10)
      at IncomingMessage.<anonymous> (node_modules/request/request.js:1085:12)
      at endReadableNT (_stream_readable.js:1056:12)
      at _combinedTickCallback (internal/process/next_tick.js:138:11)
      at process._tickDomainCallback (internal/process/next_tick.js:218:9)
```
2018-03-03 19:42:54 -05:00
Pyves
abc6e3f181 [microbadger] Handle no DownloadSize (#1536) 2018-03-02 21:48:12 +00:00
Marcin Mielnicki
6b76a6ef24 Use 'default' as default JSON style (#1429)
* Use 'default' as a default JSON style

* Using expect instead of assert

* Assert badge is valid svg in test

* Assert badge is valid json in test
2018-02-26 00:41:30 +01:00
Brad Kent
ae6dd7101c [hhvm] #1499 - update hhvm service (#1508)
* closes #1499 - update hhvm service

http://hhvm.h4cc.de... -> https://php-eye.com/api/v1/package...

* fix typo

* add switch breaks

* typo

* const & let vs var

* hhvm service tests

* unused const/var

* alias master & dev-master

* improved status messages - repo not found, branch not found
better tests:  including invalidJSON fixture
2018-02-19 22:53:32 +01:00
Patrick Streule
57c7279540 [Bitbucket] #1509 - Add Bitbucket Pipelines service (#1510)
* [Bitbucket] #1509 - Add Bitbucket Pipelines service

* Use ES6 const and error helper
2018-02-19 21:33:09 +01:00
chris48s
75503ec514 [hackage] switch to the /licenses endpoint (#1506)
* switch to /licenses endpoint to check if package exists

refs #1498

* trim whitespace from version string
2018-02-17 06:00:13 +01:00
Binh Bui
e773a9f47d Added [Vaadin-Directory] badge service (#1474)
* Integrated Vaadin service to server.js & load age from color-formatters lib

* Added 8 tests for Vaadin services

* Added Vaadin badge to main page under Misc

* Used checkErrorResponse() and fix 404 test return value

* Removed maturity from URL field option

* Remove duplicate `age` module import

* Removed comment

* Changed several URI fields and fixed according tests
2018-02-13 00:52:46 +01:00
Marcin Mielnicki
17b4a70411 [npm bountysource cdnjs circleci clojars docker gem homebrew itunes microbadger nexus requires shippable suggest uptimerobot] Service tests for NPM total downloads + invalidJSON helper (#1471)
* Service tests for NPM total downloads

* Spread syntax removed

* service-tests/helpers/mocks.js -> service-tests/helpers/response-fixtures.js

* Another value an invalid JSON in response-fixtures

* Using invalidJSON helper in service tests

* Working example in a service test of microbadger

* isPercentage supports decimal and integer values
2018-02-12 21:36:23 +01:00
Tomek Łaziuk
8ad176d014 [bundlephobia] add badge for the npm package size (#1481)
* Added a shield for calculating npm bundle sizes

* Fix linting errors

* Fixed badges for bundlephobia

* Remove un-required keywords

* Simplified handler based on feedback

* Use isFileSize for validation

* Convert camel-cased error codes to space separated ones

* Updated error format

* Fixed error formatting

* Renamed gzip to minzip

* Fixes lint error

* Remove test that times out

* refactor tests to make it more readable

* meaningless change

* use trim
2018-02-03 08:31:10 -08:00
chris48s
cbb263b102 service tests for [cocoapods] (#1472)
* service tests for [cocoapods]

* Add tests for CocoaPods Endpoints

Bug fixes:
* Call `metrics.cocoapods.org` API endpoints over HTTPs
* Show correct left-side badge text on error in version/platform/license badges
* Handle null doc coverage gracefully
* Add handling for 'not found' responses

* drop last param to checkErrorResponse

* remove redundant line

* set badge label using more terse notation

* specify allowed platform values
2018-02-03 08:11:28 -08:00
chris48s
e4199bc806 service tests for [david] (#1465)
* service tests for [david]

* update 500 handling
2018-02-02 15:11:50 -08:00
Pyves
435903ae4a [CodeClimate] Fix remaining badges (#1387)
* Fixed remaining CodeClimate badges

* Added explicit percentage keyword and dropped top level URL

* Merged the two badge handlers into one

* Removed trailing space

* Switched to "dash" URL style

* Reinstated top-level URL

* Swicthed to use letter as optional keyword

* Updated badge examples

* Cleaned up

* Changed badge label to technical debt

* Switched tests to more mainstream projects as previous ones were deleted

* Rearranged badge URLs and default formats

* Updated examples
2018-02-01 09:33:29 +13:00
chris48s
b7228ae89e update codacy urls (#1477) 2018-02-01 09:24:42 +13:00
chris48s
ec38c2e4da [shippable] add tests for shippable service (#1362)
* add test suite to formalise existing behaviour of shippable service

* throw more descriprive errors, use es6 declarations

* switch from SVG parsing to shippable API

* add test case for unexpected status code

* remove unused import

* link to source for status codes
2018-01-22 19:28:59 -08:00
chris48s
e3ac9c3db5 service tests for [itunes] (#1464) 2018-01-21 17:50:04 -05:00
chris48s
7c6723a79d service tests for [docker] (#1428) 2018-01-15 22:03:52 -05:00
Danial
65e1d69f53 [badge/dynamic/json] fix colorscheme on error (#1445)
* [FIX] error colorscheme

* throw error if jsonpath query non existent

* fixup

* show brightgreen badge by default

* update test

* let -> var

* set lightgrey when no uri specified

* update tests

* red color for no uri specified

* dynamic badge use setBadgecolor()
2018-01-16 13:53:30 +13:00
chris48s
e1f0e2598d tests for ruby [gem] service (#1444)
* add tests for ruby gems version badge

* add tests for ruby gems users badge

* add tests for ruby gems rank badge

* add tests for ruby gems downloads badges

* don't allow 0th rank

* move version info to left side of badge
2018-01-15 15:20:48 -05:00
chris48s
be3bc45d66 service tests for [homebrew] (#1443)
* add tests and 'not found' handling for homebrew service

* add test with mocked response
2018-01-14 16:51:24 -05:00
chris48s
2de53ce7bd add tests for [hackage] (#1416)
* add tests for hackage, handle 'not found'

* add 'not found' case for hackage-deps

* use es6 declarations

* change badge label to 'dependencies'
2018-01-06 22:02:34 -07:00
chris48s
e614d19355 service tests for [uptimerobot] (#1426)
* use the same error handling on /status and /ratio endpoints

* add service tests for uptime robot
2018-01-05 20:51:05 -07:00
chris48s
9cb9d5984d [requires] add tests for requires.io service, review error handling (#1361) 2018-01-02 20:13:10 -07:00
Sebastian Staudt
e62c085922 Update URL for Homebrew formula versions (#1408)
braumeister.org is now part of Homebrew and available at formulae.brew.sh.
2018-01-01 17:40:05 -05:00
chris48s
e2ee997f07 service tests for [clojars] (#1410) 2018-01-01 17:15:55 -05:00
chris48s
21b1ad73e7 Service tests for [cdnjs] (#1409) 2018-01-01 17:14:16 -05:00
chris48s
438e47adfb Add tests for codeship service (#1411) 2018-01-01 17:10:02 -05:00
Paul Melnikow
60959bf7e7 Use github auth in php-v badges (#1403)
To fix service test that fails in CI (due to no github auth) https://github.com/badges/shields/issues/1359#issuecomment-354184074

- DRY getPhpReleases()
- Pass named options to regularUpdate
    - Add json option
- php-version: Move helpers before functions, and move exports to end
2017-12-28 21:30:30 -05:00
Danial
3281005c26 Add [twitter] tests (#1394)
* twitter | add error text

inaccessable = 404 etc
invalid user = no data returned from endpoint
invalid = error thrown

* Twitter add tests

* add test for twitter url badge
2017-12-29 09:54:08 +13:00
Peter Gribanov
f719705518 Get tested PHP version from PHP-Eye (#1372) 2017-12-28 13:44:50 -05:00
Paul Melnikow
cc9a6db853 Speed up font-width computation in most cases (#1390)
Ref: #1379

This takes a naive approach to font-width computation, the most compute-intensive part of rendering badges.

1. Add the widths of the individual characters.
    - These widths are measured on startup using PDFKit.
2. For each character pair, add a kerning adjustment
    - The difference between the width of each character pair, and the sum of the characters' separate widths.
    - These are computed for each character pair on startup using PDFKit.
3. For a string with characters outside the printable ASCII character set, fall back to PDFKit.

This branch averaged 0.041 ms in `makeBadge`, compared to 0.144 ms on master, a speedup of 73%. That was on a test of 10,000 consecutive requests (using the `benchmark-performance.sh` script, now checked in).

The speedup applies to badges containing exclusively printable ASCII characters. It wouldn't be as dramatic on non-ASCII text. Though, we could add some frequently used non-ASCII characters to the cached set.
2017-12-26 23:57:46 -05:00
Pyves
9c2645b41e Fixed Code Climate coverage and maintainability score badges (#1368) 2017-12-18 18:20:29 +13:00