Commit Graph

164 Commits

Author SHA1 Message Date
Paul Melnikow
6c2ce413b1 Adopt async-await for most promise-based code (#1565)
* Address todo for Node 8 upgrade
2018-03-15 09:36:40 -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
Paul Melnikow
ae848f38f4 Add snapshot tests for SVG and JSON (#1557)
These tests should fail if something is accidentally changed that affects the SVG or JSON files. In the case of deliberate changes, we can update the snapshots.
2018-03-11 09:07:03 -07:00
Florian Munz
54afdc189c Add Depfu dependencies badge (#1537) 2018-03-08 11:42:25 -08:00
Paul Melnikow
8fde79b793 Make tests more resilient to time zone (#1558)
These tests were failing locally and I suspect it’s because I’m in a different time zone.
2018-03-08 11:09:26 -08:00
Danial
a89b6bb163 remove whitespace from data URIs (#1546)
* remove newlines from datauri

* update test, remove decode

* support multiline datauris

* replace whitespace before checking isDataUri

removed multiline support from regex

* prependPrefix set default as empty string

* update
2018-03-08 03:09:29 +01:00
chris48s
1fab9d70de [gratipay gemnasium snap-ci cauditor] add deprecation helpers, deprecate gemnasium (#1524) 2018-03-07 09:08:51 +00:00
chris48s
06fe43c51f [chocolatey powershellgallery myget nuget] tests for NuGet v3 services (#1542) 2018-03-07 09:08:14 +00: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
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
greenkeeper[bot]
ab5514651f Update eslint-plugin-node to the latest version 🚀 (#1489) 2018-03-03 20:36:46 -05:00
Pyves
abc6e3f181 [microbadger] Handle no DownloadSize (#1536) 2018-03-02 21:48:12 +00:00
Danial
5ded37b5ff logo data uri encoding (#1527)
* logo datauri encode

no longer need to replace `+` with `%2B`

* add comment & tests for spaces
2018-02-27 21:57:06 +01: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
Fuzz Stati0n
3f933594a0 Uncaught TypeError crashes server on numeric or boolean 'link' parameter (#1520) 2018-02-25 22:46:35 +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
Danial
3cb71037fd checkErrorResponse update default (#1501) 2018-02-15 23:34:38 +01:00
chris48s
581546d58e [chocolatey powershellgallery] add service tests for NuGet v2 services (#1487)
* add service tests for NuGet v2 services

* fixup - test the correct endpoint

* remove superfluous try/catch blocks

* test the colors too

* use invalid json fixture
2018-02-13 22:09:04 +01:00
Binh Bui
143ec95bf0 Update [Vaadin-Directory] previewUri in all-badge-examples.js (#1496)
* Changed previewUri in all-badge
2018-02-13 03:18:10 +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
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
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
3c551a6156 clarify default for Uptime Robot ratio (#1463)
Fix #1462
2018-01-21 18:01:31 -05:00
Danial
9aafe86247 Show logos by default on social badges (regression fix) (#1456)
* Show logos on social badges

* Revert "Showcase logos in social badges on the front page"

This reverts commit 61fa22b7e4.

* Update footer badges to all be social style

as per reverted commit 61fa22b7e4
2018-01-21 23:57:58 +01:00
chris48s
7c6723a79d service tests for [docker] (#1428) 2018-01-15 22:03:52 -05:00
Paul Melnikow
e358ebe6b3 Refactor LRU cache test asserts (#1418) 2018-01-15 14:15:27 -05:00
Paul Melnikow
606946f24a Log + fail tests on unhandled promise rejections (#1424) 2018-01-14 16:57:40 -05:00
Thaddee Tyl
09a2ca144d Tweak IP and badge type rate limits 2018-01-13 18:34:48 +01:00
Thaddee Tyl
61fa22b7e4 Showcase logos in social badges on the front page 2018-01-13 15:33:41 +01:00
Thaddee Tyl
ac8935cecb Add rate limiting
We now rate limit IPs, referers and badge type.
2018-01-09 02:35:51 +01:00
Paul Melnikow
7c1a3fef69 Adopt Chai for assertions (#1419) 2018-01-08 14:18:07 -07:00
Daniel Lo Nigro
02683afd04 Don't crash when logo passed as integer (#1319) 2018-01-04 17:11:59 -07:00
Paul Melnikow
ccb3eb8fdf Fix January unit test (#1417) 2018-01-03 20:37:35 -07:00
chris48s
9cb9d5984d [requires] add tests for requires.io service, review error handling (#1361) 2018-01-02 20:13:10 -07: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
Paul Melnikow
84c60c8730 Optimization + cleanup in makeBadge (#1405)
- Avoid mutating the inputs
- Declare all the input and output keys
- Avoid recomputing escapeXml on the same values
- Capitalize social badge labels before measuring
2017-12-28 21:28:47 -05:00
Paul Melnikow
09cf211786 Fix tests for [suggest] endpoint (#1398) 2017-12-28 14:21:16 -05: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
Paul Melnikow
46a05e42b8 Add list of critical services (#1386)
I have a branch going to automatically generate stats on which services have tests, and make a line chart over time. I'm having a lot of fun with that so I'll keep at it.

Meanwhile, here is my subjective list of critical services, for #1358.
2017-12-25 22:21:37 -05:00
Pyves
32671dfd87 Removal of hasPrefix function in badge-data.js (#1376)
* Removed hasPrefix method and added tests to cover prependPrefix
2017-12-18 17:58:28 +13:00
Thaddée Tyl
ea405e04e6 Default to not logging GitHub token debugging (#1364)
As argued for in
https://github.com/badges/shields/issues/1314#issuecomment-350564524.

It populates large quantities of text in the logs, where I wish to only
see errors.
2017-12-10 13:02:03 -05:00
Krutov Alexander
b1ca6391d0 Add MicroBadger (#1340) 2017-12-07 17:30:42 -05:00
Peter Gribanov
962cf61b82 PHP version from .travis.yml (#1258)
Reference: #819
2017-12-06 11:04:24 -05:00
mattbk
2028251ca0 Add [Liberapay] (#1251) 2017-12-05 23:01:02 -05:00
Paul Melnikow
7c1b1fc621 Fix style picker in markup modal (#1331)
- Restore correct list of styles to markup modal
- DRY lists of styles

Fix #1330
2017-12-05 18:08:13 -05:00
Eric Berry
3581efe5e1 Add [Discourse] status/stats shield (#1326)
Close #1325
2017-12-05 17:34:59 -05:00
Marcin Mielnicki
0570a9e920 License badge colour corresponding to license type (#1190) 2017-12-05 16:43:29 -05:00