File tree Expand file tree Collapse file tree 4 files changed +11
-14
lines changed
Expand file tree Collapse file tree 4 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 11package cwe
22
3+ import "fmt"
4+
35const (
46 // Acronym is the acronym of CWE
57 Acronym = "CWE"
@@ -14,6 +16,11 @@ const (
1416)
1517
1618var (
19+ // InformationURI link to the published CWE PDF
20+ InformationURI = fmt .Sprintf ("https://cwe.mitre.org/data/published/cwe_v%s.pdf/" , Version )
21+ // DownloadURI link to the zipped XML of the CWE list
22+ DownloadURI = fmt .Sprintf ("https://cwe.mitre.org/data/xml/cwec_v%s.xml.zip" , Version )
23+
1724 data = map [string ]* Weakness {}
1825
1926 weaknesses = []* Weakness {
Original file line number Diff line number Diff line change @@ -32,13 +32,3 @@ func (w *Weakness) MarshalJSON() ([]byte, error) {
3232 URL : w .SprintURL (),
3333 })
3434}
35-
36- // InformationURI link to the published CWE PDF
37- func InformationURI () string {
38- return fmt .Sprintf ("https://cwe.mitre.org/data/published/cwe_v%s.pdf/" , Version )
39- }
40-
41- // DownloadURI link to the zipped XML of the CWE list
42- func DownloadURI () string {
43- return fmt .Sprintf ("https://cwe.mitre.org/data/xml/cwec_v%s.xml.zip" , Version )
44- }
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ var _ = Describe("CWE Types", func() {
1111 })
1212 Context ("when consulting cwe types" , func () {
1313 It ("it should retrieves the information and download URIs" , func () {
14- Expect (cwe .InformationURI () ).To (Equal ("https://cwe.mitre.org/data/published/cwe_v4.4.pdf/" ))
15- Expect (cwe .DownloadURI () ).To (Equal ("https://cwe.mitre.org/data/xml/cwec_v4.4.xml.zip" ))
14+ Expect (cwe .InformationURI ).To (Equal ("https://cwe.mitre.org/data/published/cwe_v4.4.pdf/" ))
15+ Expect (cwe .DownloadURI ).To (Equal ("https://cwe.mitre.org/data/xml/cwec_v4.4.xml.zip" ))
1616 })
1717
1818 It ("it should retrieves the weakness ID and URL" , func () {
Original file line number Diff line number Diff line change @@ -104,9 +104,9 @@ func buildSarifReportingDescriptorRelationship(weakness *cwe.Weakness) *Reportin
104104}
105105
106106func buildCWETaxonomy (taxa []* ReportingDescriptor ) * ToolComponent {
107- return NewToolComponent (cwe .Acronym , cwe .Version , cwe .InformationURI () ).
107+ return NewToolComponent (cwe .Acronym , cwe .Version , cwe .InformationURI ).
108108 WithReleaseDateUtc (cwe .ReleaseDateUtc ).
109- WithDownloadURI (cwe .DownloadURI () ).
109+ WithDownloadURI (cwe .DownloadURI ).
110110 WithOrganization (cwe .Organization ).
111111 WithShortDescription (NewMultiformatMessageString (cwe .Description )).
112112 WithIsComprehensive (true ).
You can’t perform that action at this time.
0 commit comments