• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

badges / shields / 21662529448

03 Feb 2026 07:51PM UTC coverage: 98.148% (+0.06%) from 98.091%
21662529448

push

github

web-flow
chore(deps): bump glob from 10.4.5 to 10.5.0 (#11664)

Bumps [glob](https://github.com/isaacs/node-glob) from 10.4.5 to 10.5.0.
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v10.4.5...v10.5.0)

---
updated-dependencies:
- dependency-name: glob
  dependency-version: 10.5.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

5905 of 6162 branches covered (95.83%)

49655 of 50592 relevant lines covered (98.15%)

136.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.12
/services/codacy/codacy-coverage.service.js
1
import Joi from 'joi'
3✔
2
import { coveragePercentage as coveragePercentageColor } from '../color-formatters.js'
3✔
3
import { BaseSvgScrapingService, NotFound, pathParams } from '../index.js'
3✔
4

3✔
5
const schema = Joi.object({
3✔
6
  message: Joi.alternatives()
3✔
7
    .try(Joi.string().regex(/^[0-9]+%$/), Joi.equal('!'))
3✔
8
    .required(),
3✔
9
}).required()
3✔
10

3✔
11
export default class CodacyCoverage extends BaseSvgScrapingService {
3✔
12
  static category = 'coverage'
3✔
13
  static route = { base: 'codacy/coverage', pattern: ':projectId/:branch*' }
3✔
14

3✔
15
  static openApi = {
3✔
16
    '/codacy/coverage/{projectId}': {
3✔
17
      get: {
3✔
18
        summary: 'Codacy coverage',
3✔
19
        parameters: pathParams({
3✔
20
          name: 'projectId',
3✔
21
          example: 'd5402a91aa7b4234bd1c19b5e86a63be',
3✔
22
        }),
3✔
23
      },
3✔
24
    },
3✔
25
    '/codacy/coverage/{projectId}/{branch}': {
3✔
26
      get: {
3✔
27
        summary: 'Codacy coverage (branch)',
3✔
28
        parameters: pathParams(
3✔
29
          {
3✔
30
            name: 'projectId',
3✔
31
            example: 'd5402a91aa7b4234bd1c19b5e86a63be',
3✔
32
          },
3✔
33
          {
3✔
34
            name: 'branch',
3✔
35
            example: 'master',
3✔
36
          },
3✔
37
        ),
3✔
38
      },
3✔
39
    },
3✔
40
  }
3✔
41

3✔
42
  static defaultBadgeData = { label: 'coverage' }
3✔
43

3✔
44
  static render({ percentage }) {
3✔
45
    return {
3✔
46
      message: `${percentage}%`,
3✔
47
      color: coveragePercentageColor(percentage),
3✔
48
    }
3✔
49
  }
3✔
50

3✔
51
  static transform({ coverageString }) {
3✔
52
    return {
3✔
53
      percentage: parseFloat(coverageString.replace(/%$/, '')),
3✔
54
    }
3✔
55
  }
3✔
56

3✔
57
  async handle({ projectId, branch }) {
3✔
58
    const { message: coverageString } = await this._requestSvg({
4✔
59
      schema,
4✔
60
      url: `https://api.codacy.com/project/badge/coverage/${encodeURIComponent(
4✔
61
        projectId,
4✔
62
      )}`,
4✔
63
      options: { searchParams: { branch } },
4✔
64
      valueMatcher: /text-anchor="middle">([^<>]+)<\/text>/,
4✔
65
      httpErrors: {
4✔
66
        404: 'project not found',
4✔
67
      },
4✔
68
    })
4✔
69

3✔
70
    // When sending an invalid branch, Codacy ignores the branch, failing
3✔
71
    // silently, so we can't provide an error message for this case.
3✔
72

3✔
73
    if (coverageString === '!') {
4!
74
      throw new NotFound({
×
75
        prettyMessage: 'not enabled for this project',
×
76
      })
×
77
    }
×
78

3✔
79
    const { percentage } = this.constructor.transform({ coverageString })
3✔
80
    return this.constructor.render({ percentage })
3✔
81
  }
4✔
82
}
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc