Commit Graph

32 Commits

Author SHA1 Message Date
chris48s
954147f7d9 URL validator tidyup; affects [discourse dynamic endpoint gerrit jira maven nexus osslifecycle python vpm website] securityheaders sonar swagger w3c (#10810)
* add a required url validator

* replace occurrences of optionalUrl.required() with url

* use standard validators in server.js
2025-01-18 19:16:41 +00:00
chris48s
bd3a11b4b6 upgrade to docusaurus 3 (#9820)
* update packages

* add plugin to strip autolinks in code blocks

* fix all the documentation for MDXv3

* remove check-docusaurus-versions

in docusaurus 3 this is now a hard error, not just a warning

* port upstream change to Curl component

fixes performing the 'execute' action when pressing enter
2024-03-23 19:54:57 +00:00
chris48s
9cfd301b82 Complete the examples --> openApi migration; affects [node sonar travis wordpress visualstudio librariesio] (#9977)
* you missed one

* remove examples from deprecatedService()

I'm not going to replace this with openApi
We have zero examples of deprecated services that declare examples

* remove examples from redirector()

* update test

* remove compatibility code for converting examples to openApi

* remove all the code for handling examples

* remove a few bits of redundant code

* improve docs for openApi property

* last one, I promise
2024-02-24 18:14:44 +00:00
chris48s
39ec09329a migrate some services from examples to openApi part 44; affects [sonar] (#9919)
* fix sonar tests

* migrate some services from examples to openApi

* migrate some services from examples to openApi
2024-02-05 11:01:58 +00:00
dependabot[bot]
b9d96755ec chore(deps-dev): bump prettier from 2.8.8 to 3.0.0 (#9357)
* chore(deps-dev): bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* reformat all the things (prettier 3)

* update tests to await calls to prettier.format()

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <git@chris-shaw.dev>
2023-07-10 09:27:51 +00:00
chris48s
14892e3943 Implement a pattern for dealing with upstream APIs which are slow on the first hit; affects [endpoint] (#9233)
* allow serviceData to override cacheSeconds with a longer value

* prevent [endpoint] json cacheSeconds property exceeding service default

* allow ShieldsRuntimeError to specify a cacheSeconds property

By default error responses use the cacheLength of
the service class throwing the error.

This allows error to tell the handling layer the maxAge
that should be set on the error badge response.

* add customExceptions param

This

1. allows us to specify custom properties to pass to the exception
   constructor if we throw any of the standard got errors
   e.g: `ETIMEDOUT`, `ECONNRESET`, etc
2. uses a custom `cacheSeconds` property (if set on the exception)
   to set the response maxAge

* customExceptions --> systemErrors

* errorMessages --> httpErrors
2023-06-13 21:08:43 +01:00
chris48s
26bf69cfe7 misc minor fixes to [githubsize node pypi] (#8946)
* fix some params incorrectly marked as optional

all of these are really required

* make '@' part of the param (not route) for scoped packages

* minor HTML tweaks to sonar help

---------

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2023-03-01 20:24:41 +00:00
Caleb Cartwright
6ea690c446 fix: various sonar service tests (#7836)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-04-14 22:08:05 +00:00
chris48s
c73072deed Remove requestOptions2GotOptions compatibility layer (#7270)
* gzip --> decompress

* strictSSL --> https.rejectUnauthorized

* auth --> username/password

* qs --> searchParams

* fix base service auth docs

* completely remove requestOptions2GotOptions layer

* update the docs

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-11-15 19:56:08 +00:00
Caleb Cartwright
6dc8aac451 feat: create new Test Results category (#7218)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-11-05 22:35:40 +00:00
Caleb Cartwright
8a6eba330e feat: support branches in sonar badges (#7065)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-10-13 21:31:45 +00:00
Caleb Cartwright
b7ec6c0cb3 tests: add live Sonar tests with >=6.6 API changes (#6817)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-07-25 16:32:38 +00:00
Rafał Maciejewski
96a7f36e08 [Sonar] Fix invalid fetch query to sonarqube >=6.6 (#6636)
* fix(sonar): fix invalid fetch query to sonarqube >=6.6

* fix(sonar): reverse comparison to preserve default behavior

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-07-25 01:30:47 +00:00
Pierre-Yves B
23c0406bed Migrate from CommonJS to ESM (#6651) 2021-07-09 12:53:55 +01:00
homersimpsons
3597b7e80f Refactor forgotten static get in services (#5794)
Co-authored-by: Guillaume <g.alabre@thecodingmachine.com>
2020-11-05 20:35:10 +00:00
Christian Haag
fba860fbe9 Refactor service classes [snyk sonar sourceforge sourcegraph spack] (#5632)
* Refactor service classes snyk-sonar-sourceforge-sourcegraph-spack

* Amend end-line issue on pull-request #5632

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-10-03 16:14:47 +00:00
chris48s
504015c0ba migrate hapi/joi to joi (#5624)
* update joi + joi-extension-semver

* @hapi/joi --> joi

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-09-30 17:51:02 +00:00
chris48s
13d75e0607 upgrade to prettier 2 (#5051)
* arrowParens: avoid
* remove trailingComma setting
2020-05-05 21:07:43 +01:00
dependabot-preview[bot]
478d14300c Build(deps-dev): bump eslint-plugin-import from 2.20.1 to 2.20.2 (#4859)
* Build(deps-dev): bump eslint-plugin-import from 2.20.1 to 2.20.2

Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.20.1 to 2.20.2.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.20.1...v2.20.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Fixes

* refactor: combine imports

* refactor: combine imports

* refactor: combine imports

* refactor: update import ordering

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
Co-authored-by: Paul Melnikow <email@paulmelnikow.com>
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
Co-authored-by: Caleb Cartwright <caleb.cartwright@outlook.com>
2020-04-16 18:39:13 -05:00
chris48s
d8831729cb Check request origin before sending credentials (#4729)
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
Co-authored-by: chris48s <chris48s@users.noreply.github.com>

Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
Co-authored-by: chris48s <chris48s@users.noreply.github.com>
2020-03-04 20:42:27 +00:00
chris48s
347e0a81f3 set followRedirect: false by default in tests (#4491)
* set followRedirect: false by default in tests

* update tests implicitly relying on redirects

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-01-07 21:13:48 +00:00
chris48s
9a6b96effc Use expectRedirect helper in redirect tests; affects [circleci codeclimate codecov discourse endpoint github jenkins jira jitpack lgtm maven nexus scrutinizer sonar swagger symfony teamcity travis twitter vso waffle website wordpress] (#4481)
* Convert remaining tests to use expectRedirect() helper

* convert last few redirect tests to use svg not json

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-01-03 21:39:58 +00:00
Caleb Cartwright
b05fe5f62c fix [Sonar] legacy API tests (#4251)
* tests: fix sonar legacy API tests

* docs: add inline documentation on sonar mocked tests

* docs: add more inline sonar docs
2019-10-26 17:23:04 -05:00
chris48s
c762d971b4 upgrade Joi and related packages (#4060)
* update dependencies

* (core) children --> keys

* (core) fix/update BaseService validate

* (core) update error messages in tests

* (core) only Joi.attempt if we've got a Joi schema

* (core) allow 'expected' to be a regex

* (services) pass 2 schema to .alternatives()

* (services) functions --> Joi schema

* (services) update expected error message

* (services) explicit check for color: undefined

* re-bump joi

* (services) wrap another regex

* (core/services) remove use of array arguments

* (core/services) when --> conditional

* (services) remove more array arguments

* fix spelling in var name

* DRY up sonar helper
2019-09-23 17:36:56 +01:00
Paul Melnikow
6a2f384860 Update [Sonar] routes: metric first, and server in the query string (#3696)
This is the preferred way we’re handling server URLs: in the query string.

While we still have a mix of these, I’ve argued this way is better for these reasons:

1. It allows us to make the URLs a bit more standardized across services.
2. It makes the routes unambiguous.
3. It requires less code.

While it introduces a URL-encoding requirement on the parameter, I think these tradeoffs are worth it.
2019-07-14 17:06:14 -04:00
Paul Melnikow
ce0ddf93fc Inject secrets into the services (#3652)
This is a reworking of #3410 based on some feedback @calebcartwright left on that PR.

The goals of injecting the secrets are threefold:

1. Simplify testing
2. Be consistent with all of the other config (which is injected)
3. Encapsulate the sensitive auth-related code in one place so it can be studied and tested thoroughly

- Rather than add more code to BaseService to handle authorization logic, it delegates that to an AuthHelper class.
- When the server starts, it fetches the credentials from `config` and injects them into `BaseService.register()` which passes them to `invoke()`.
- In `invoke()` the service's auth configuration is checked (`static get auth()`, much like `static get route()`).
- If the auth config is present, an AuthHelper instance is created and attached to the new instance.
- Then within the service, the password, basic auth config, or bearer authentication can be accessed via e.g. `this.authHelper.basicAuth` and passed to `this._requestJson()` and friends.
- Everything is being done very explicitly, so it should be very clear where and how the configured secrets are being used.
- Testing different configurations of services can now be done by injecting the config into `invoke()` in `.spec` files instead of mocking global state in the service tests as was done before. See the new Jira spec files for a good example of this.

Ref #3393
2019-07-09 23:14:36 -04:00
dependabot-preview[bot]
294aa1e1df Build(deps-dev): bump eslint-plugin-import from 2.17.3 to 2.18.0; autofixes (#3671)
* Build(deps-dev): bump eslint-plugin-import from 2.17.3 to 2.18.0

Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.17.3 to 2.18.0.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.17.3...v2.18.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Autofixes
2019-07-08 12:13:46 -04:00
Caleb Cartwright
ea865436a1 add [Sonar] badges for various test metrics (#3571)
* feat: add SonarTests badges

* chore: remove commented out line

* refactor: update SonarTestsSummary to override transform
2019-07-01 15:46:51 -05:00
chris48s
8621fe42d7 Upgrade Joi (#3505)
* upgrade joi
* find & replace ALL THE THINGS
* update related deps
2019-06-02 21:59:55 +01:00
Paul Melnikow
1dd8d1329c Unify order of another handful of services (#3356)
Ref #3353
2019-04-24 15:03:23 -04:00
Paul Melnikow
1cdcaabd38 Unify order of properties and methods in services (#3353)
I find having these in a consistent order makes the services much faster to read.

This is the order I’ve generally been using:

1. Category
2. Route
3. Examples
4. Rendering
5. Other helpers (`fetch()`, `transform()`)
6. `handle()`
2019-04-23 21:36:04 -04:00
Caleb Cartwright
700b61e16b Refactor [Sonar] (#3189)
* refactor(sonar)

* refactor(sonarqube): creating separate services for SQ badges

* refactor(sonar): more sonar refactorings

* refactor(sonar): fixed duplicate service names from c/p

* refactor(sonar): finished violations service impl

* refactor(sonar): finished unit tests for violations service

* feat(sonar): violation badge updates

* refactor(sonar): finished doc. api density service

* feat(sonar): added quality gate service

* chore: sonar doc tweaks

* refactor(sonar): added redirector service

* refactor(sonar): added examples

* refactor(sonar): minor example updates

* refactor(sonar): added final tests

* chore(sonar): removed unneeded test spec file for base class

* refactor(sonar): updates based on PR feedback

* refactor(sonar): change query param to sonarVersion

* refactor(sonar): fixing query param issue

* refactor(sonar): fix test color for generic metric

* chore: fix lint/prettier issue

* chore(sonar): update query param name in examples

* refactor(sonar): make schema metric key required

* reactor(sonar): fix tests

* refactor(sonar): added more example listings

* refactor(sonar): minor style updates

* refactor(sonar): update examples

* refactor(Sonar): minor example tweaks
2019-04-15 17:03:57 -05:00