402 Commits

Author SHA1 Message Date
Paul Melnikow
b3ec3e7a96 Generalized rotating token pool (#1736)
This was designed as part of a rewrite of the Github auth code in #1205 which is stalled because I don't want to deploy it without access to server logs. The need for token rotation came up recently in #541, so I picked up this code, removed the github-specific bits, and pulled it in. Ordinarily I wouldn't merge helper code without a use, though sadly it seems like the best way to move forward this rewrite.
2018-07-11 23:08:56 -04:00
Danial
d8cf836264 Add support for rgb, rgba, hsl, hsla, css named colors (#1635)
* add support for rgb, rgb, css named colors

* add support for hsl, hsla & add color-validate

* update makeBadge test, better coverage

* re-add comment

* add comment for supported colors

* dynamic badge gen, remove 'hex'

* add support for 1.0 opacity & fix 101-109

* fix colorscheme tests

* remove extra tests

* add test for negative values

* add test for uppercase & mixed case colors

* fix mixed case/uppercase test

* allow whitespace around color

* update test error messages

* add comments

* add more uppercase test

* update error message

* default to grey/red if invalid color chosen

default colorscheme:
colorA: grey
colorB: red

* Revert "default to grey/red if invalid color chosen"

This reverts commit 10db0c6d74.
Reverted as this affects the CLI version/when no color specified.

* validColor -> isCSSColor

* assignColor function

* update tests to use sazerac
2018-07-12 10:26:17 +12:00
Stanley Ng
85dd5f0809 Add [Jenkins] Jacoco coverage badge ☘ (#1593)
* Add Jenkins Jacoco coverage badge

* [Jenkins] add service test for jacoco coverage

* Added Jenkins Coverage (Jacoco) in all-badge-examples page

* Defined variables using let/const instead of var

* Used template string for the uri

* Used checkErrorResponse helper function for the error check

* Used NaN method for not a number test

* Prefixed the original Jenkin coverage test with "cobertura:"

* Moved the happy test case at front

* Merge the business logic between jacoco and cobertura

* Fixed lint issue

* Trigger notification
2018-07-10 18:12:26 +12:00
Pyves
8ad3bc7e90 [scrutinizer] Fix #1739, add tests and refactor (#1759)
* Added tests for Scrutinizer service

* Refactored service and fixed NaN bug

* Updated example

* Improved badge regex
2018-07-08 10:32:13 +01:00
chris48s
b05d93c9c1 fix [waffle] labels badge (#1745)
fix [waffle] labels badge

- update URL and parsing code to use /columns endpoint
- add error handling for 'not found' case
- add missing test cases
- update home page example

Closes #1731
2018-07-05 19:06:06 +01:00
Grey Baker
ca58d84447 Add [dependabot] SemVer compatibility badge (#1734)
* Add [dependabot] SemVer compatibility badge

* Add dependabot logo

* Clean up and additional tests
2018-06-17 21:32:57 +02:00
Paul Melnikow
028d8d7691 Fix sinon deprecation warning (#1737)
`sandbox.create()` is deprecated. Use default sandbox at `sinon.sandbox` or create new sandboxes with `sinon.createSandbox()`
2018-06-17 12:58:59 -04:00
Ivan de la Beldad Fernandez
4308b60c8f [Travis] Add travis-ci.com support (#1711) 2018-06-17 10:14:00 +02:00
Paul Melnikow
fa61247dba Rewrite [npm] typedefs badge using new-style service (#1735)
For #1358
2018-06-16 16:38:52 -04:00
chris48s
f78e6f1f8a [gem cdnjs appveyor clojars] refactor clojars, establish BaseJsonService (#1702)
* refactor clojars integration

* DRY up services that request data from JSON endpoints
2018-06-16 20:50:14 +01:00
tooomm
fc3b793155 extend for pr in title (#1720) 2018-06-16 12:33:48 -04:00
Marcin Mielnicki
b418235c7f Standard name in nuget v2 downloads badge (#1726) 2018-06-10 21:36:40 +02:00
Matthias Koch
7f9102dbb5 Add ReSharper gallery badge. (#1722) 2018-06-09 21:51:58 +02:00
Marcin Mielnicki
9d90bd1f95 [github] Commit merge status badge (#1709)
* Basic version of commit-status badge added

* Support for case with no common ancestor

* Handle unknown branch

* Service tests with error responses

* Handle unexpected 404 responses from github

* Branch is a base

* Tests reordered

* Using not the newest commit in tests

* Test for checked commit identical with the newest commit in branch

* Code refactoring

* Example for Github commit merge status
2018-05-30 18:51:52 +02:00
chris48s
8ba33d419f [bower clojars] version() should throw on invalid inputs (#1705)
Throw Error in version() on invalid inputs
2018-05-28 20:08:30 +01:00
Raziel
c76e221b47 [david] add support for path (#1687)
* Example with a path query parameter

* Support for David path query parameters

* David path not found test

* [david] updated invalid path test
2018-05-18 11:50:04 +12:00
chris48s
bf53e612f5 [cdnjs gem] make exception classes more consistent (#1683)
make exception classes more consistent
2018-05-15 18:57:33 +01:00
Sam Lanning
4f8414c003 Add grade badge for [lgtm] (#1681)
* Add LGTM Grade badge

* Add new tests for LGTM Grade badge

* Add lgtm grade example to homepage
2018-05-12 10:30:48 +01:00
chris48s
b5635bf55a [gem cdnjs appveyor] refactor ruby gems service (#1680)
* allow services to export >1 classes

This change to loadServiceClasses() allows us to define
services which either export a single service class e.g:

module.exports = class Cdnjs extends BaseService {
  //...
}

or more than one. e.g:

module.exports = {
  GemVersion,
  GemDownloads,
  GemOwner,
  GemRank,
}

* refactor ruby gem badges

- move badge code to service classes
- throw exceptions for errors
- use let and const
- change tests to expect 'downloads' label for error badges
- general tidying

* fix typo in tests

* Don't always use class name in example label

This allows (for example) GemVersion and GemDownloads
both to use the example label 'Gem'
2018-05-10 17:32:45 +01:00
Sam Lanning
45ff94d5a3 Add [LGTM] service (#1672) 2018-05-05 19:14:58 +01:00
chris48s
8fcc13d5bc refactor [cdnjs] integration (#1668)
* pass error object to InvaildResponse()

this prevents us from throwing
TypeError: Cannot read property 'stack' of undefined
when we attempt to parse invalid json

* refactor [cdnjs] integration
2018-05-04 21:55:51 +01:00
Raul Riera
f607ad787e Add [buildkite] service (#1657)
* Support for buildkite

* Added to the examples as well

* Removed the unnecessary label property

* Fixed the example

* Improve the tests

* Made the branch optional and review suggestions

* Added network error test

* Unexpected response test

* PR review suggestions

* Updated test to include all responses

* Forgot one of the tests
2018-04-24 08:13:24 +12:00
Danial
8fda86fcf1 set expires header corresponding to maxAge (#1651)
* set expires header corresponding to maxAge

* add tests
2018-04-22 13:48:01 +12:00
Binh Bui
e1755df212 [vaadin-directory] Support star and stars endpoints (#1603) 2018-04-09 20:14:21 +01:00
Danial
c0bdf54e4b optimize cssColor check regex (#1602)
* optimize cssColor regex

* Add comment & tests

* update test to not export cssColor

* [0-9] -> \d
2018-04-05 00:31:58 +02:00
Paul Melnikow
f2efd751b5 Minor refactor of examples preparation (#1632)
This cleans up the work from #1582, clarifying concerns, removing a bit of duplication, and renaming for clarity.
2018-04-02 07:03:52 -05:00
Pyves
a168072cd5 [DotnetStatus] Service deprecation (#1630) 2018-04-02 09:40:50 +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
greenkeeper[bot]
724abd06dc Update svgo to the latest version 🚀 (#1473)
* fix(package): update svgo to version 1.0.5
* Update package-lock
* Update invocation for SVGO 1.x
* Remove helper
2018-04-01 21:57:20 -05:00
Pyves
c5884b1915 Handled capitalization with empty keys (#1625) 2018-04-01 09:46:13 +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
Pyves
1dff491a24 Added number support to version text formatter (#1620) 2018-03-29 10:08:23 -07:00
Pyves
16eea6d7db Number support for version color formatter (#1615) 2018-03-29 18:04:42 +01:00
Pyves
ed419b0a77 [microbadger] Fix tests (#1600) 2018-03-27 11:15:51 +01:00
Thaddée Tyl
17ddd180bb Skip Twitter suggestion if URL does not have protocol (#1604)
This resolves the following error occurring in production:

```
TypeError: Cannot read property 'slice' of null
/home/m/shields/lib/suggest.js in twitterPage at line 63:31
  const schema = url.protocol.slice(0, -1);
```
2018-03-26 15:33:59 -07:00
Thaddée Tyl
0a248998f2 Only compute user/repo if suggesting badges for GitHub (#1601)
This resolves the following error occurring in production:

```
TypeError: Cannot read property 'slice' of null
/home/m/shields/lib/suggest.js in findSuggestions at line 40:33
  const userRepo = url.pathname.slice(1).split('/');
```
2018-03-25 14:47:54 -07: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
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