CycloneDX/Vulnerability/Rating.pm

filter: Statementstmt 75.6% 28 / 37 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 100% 1 / 1 totaltotal 62.0% 36 / 58 CC 7 SCAR 33.5
CC
7
Cov
57%
TO_JSON
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 28.5
« CycloneDX/Attachment.pm ↑ Summary CycloneDX/Timestamp.pm »
1 package SBOM::CycloneDX::Vulnerability::Rating;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Types::Standard qw(Str Num InstanceOf Enum);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 extends 'SBOM::CycloneDX::Base';
14  
15 1 has source => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Source']);
16 1 has score => (is => 'rw', isa => Num);
17 1 has severity => (is => 'rw', isa => Enum [qw(critical high medium low info none unknown)]);
18 1 has method => (is => 'rw', isa => Enum [qw(CVSSv2 CVSSv3 CVSSv31 CVSSv4 OWASP SSVC other)]);
19 1 has vector => (is => 'rw', isa => Str);
20 1 has justification => (is => 'rw', isa => Str);
21  
22 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=7 SCAR=40.3
Pod documented
23  
24 0 my $self = shift;
25  
26 0 my $json = {};
27  
28 0 ▶ $json->{source} = $self->source if $self->source;
Branch: 1 branch
BranchTrueFalseTotal
if $self->source 0 0 0
29 0 ▶ $json->{score} = $self->score if $self->score;
Branch: 1 branch
BranchTrueFalseTotal
if $self->score 0 0 0
30 0 ▶ $json->{severity} = $self->severity if $self->severity;
Branch: 1 branch
BranchTrueFalseTotal
if $self->severity 0 0 0
31 0 ▶ $json->{method} = $self->method if $self->method;
Branch: 1 branch
BranchTrueFalseTotal
if $self->method 0 0 0
32 0 ▶ $json->{vector} = $self->vector if $self->vector;
Branch: 1 branch
BranchTrueFalseTotal
if $self->vector 0 0 0
33 0 ▶ $json->{justification} = $self->justification if $self->justification;
Branch: 1 branch
BranchTrueFalseTotal
if $self->justification 0 0 0
34  
35 0 return $json;
36  
37 }
38  
39 1 1;
40  
41 =encoding utf-8
42  
43 =head1 NAME
44  
45 SBOM::CycloneDX::Vulnerability::Rating - Rating
46  
47 =head1 SYNOPSIS
48  
49 SBOM::CycloneDX::Vulnerability::Rating->new();
50  
51  
52 =head1 DESCRIPTION
53  
54 L<SBOM::CycloneDX::Vulnerability::Rating> Defines the severity or risk ratings of a
55 vulnerability.
56  
57 =head2 METHODS
58  
59 L<SBOM::CycloneDX::Vulnerability::Rating> inherits all methods from L<SBOM::CycloneDX::Base>
60 and implements the following new ones.
61  
62 =over
63  
64 =item SBOM::CycloneDX::Vulnerability::Rating->new( %PARAMS )
65  
66 Properties:
67  
68 =over
69  
70 =item * C<justification>, A reason for rating the vulnerability as
71 it was
72  
73 =item * C<method>, Specifies the severity or risk scoring methodology or standard
74 used.
75  
76 =item * C<score>, The numerical score of the rating.
77  
78 =item * C<severity>, Textual representation of the severity that corresponds
79 to the numerical score of the rating.
80  
81 =item * C<source>, The source that calculated the severity or risk rating of
82 the vulnerability.
83  
84 =item * C<vector>, Textual representation of the metric values used to score
85 the vulnerability
86  
87 =back
88  
89 =item $rating->justification
90  
91 =item $rating->method
92  
93 =item $rating->score
94  
95 =item $rating->severity
96  
97 =item $rating->source
98  
99 =item $rating->vector
100  
101 =back
102  
103  
104 =head1 SUPPORT
105  
106 =head2 Bugs / Feature Requests
107  
108 Please report any bugs or feature requests through the issue tracker
109 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
110 You will be notified automatically of any progress on your issue.
111  
112 =head2 Source Code
113  
114 This is open source software. The code repository is available for
115 public review and contribution under the terms of the license.
116  
117 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
118  
119 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
120  
121  
122 =head1 AUTHOR
123  
124 =over 4
125  
126 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
127  
128 =back
129  
130  
131 =head1 LICENSE AND COPYRIGHT
132  
133 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
134  
135 This is free software; you can redistribute it and/or modify it under
136 the same terms as the Perl 5 programming language system itself.
137  
138 =cut
« CycloneDX/Attachment.pm ↑ Summary CycloneDX/Timestamp.pm »