* refactor(github): separate pull request count service
Count all pull request badge variants through GitHub search so draft qualifiers can be composed consistently. Keep issue badges on the repository issues connection and document each preserved PR route explicitly.
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* test(github): move pull request badge coverage
Keep the existing live picture checks with the service that now owns the pull request routes.
* test(github): cover pull request search variants
Assert the exact unfiltered GitHub search qualifier and preserve open, closed, raw, and non-raw badge rendering.
* test(github): cover draft pull request filters
Verify excludeDrafts, onlyDrafts, label composition, and closed raw rendering against exact GitHub search qualifiers.
* test(github): cover pull request request errors
Reject incompatible draft filters before an outbound request and keep missing repositories distinct from valid zero-count results.
* test(github): guard GraphQL response boundaries
Cover malformed pull request search data and prove issue badges remain on the repository issues query after the service split.
* fix(github): preserve unfiltered pull request counts
* test(github): use live pull request fixtures
---------
Co-authored-by: Philippe Martin <phmartin@redhat.com>
While playing around with a badge for Hacktoberfest I noticed the GitHub Issues badge fetches a huge amount of JSON to render just the total count. There doesn’t seem to be a way to limit the response size through the REST API, so I thought I’d switch this to use GraphQL instead.
* add base class for Graphql APIs
* add GithubAuthV4Service + updates to GH token pool
* update github forks to use GithubAuthV4Service
* rename GithubAuthService to GithubAuthV3Service
* which --> variant
* which --> alias
* which --> format
* improve param names in codeclimate
* improve param names in github-issue-detail
* update github-issue-detail unit tests
This moves a few helpers from `lib/` to `services/`:
build-status.js
build-status.spec.js
color-formatters.js
color-formatters.spec.js
contributor-count.js
licenses.js
licenses.spec.js
php-version.js
php-version.spec.js
text-formatters.js
text-formatters.spec.js
version.js
version.spec.js
And one from `lib/` to `core/`:
unhandled-rejection.spec.js
The diff is long, but the changes are straightforward.
Ref #2832
This pull request closes#2551: making sure that the keywords don't already appear in the example's title.
I also added validation that checks that they are at least two characters long, as this is enforced by the homepage when type your search.
This is consistent with what we're pretty much already doing, and saves us from making the request during code review.
These were all autofixed and most of them seem easier to read. Some in the legacy services should be rewritten in more legible forms during refactor (ie using intermediate variables, or using request’s qs option). There are some in helper functions and elsewhere that should get rewritten separately. I don't want to change them in this PR because the changes will get lost in this diff, though we could identify them here and fix them before or just after.