MCPcopy Create free account
hub / github.com/crashappsec/github-analyzer / parseStats

Function parseStats

pkg/output/html/html.go:90–118  ·  view source on GitHub ↗
(statsJson string)

Source from the content-addressed store, hash-verified

88}
89
90func parseStats(statsJson string) (org.OrgStats, []InstallationInfo, error) {
91 var stats org.OrgStats
92
93 jsonFile, err := os.Open(statsJson)
94 defer jsonFile.Close()
95 if err != nil {
96 return stats, nil, err
97 }
98 jsonBytes, err := ioutil.ReadAll(jsonFile)
99 if err != nil {
100 return stats, nil, err
101 }
102 json.Unmarshal(jsonBytes, &stats)
103
104 var wrappedInstallations []InstallationInfo
105 for _, i := range stats.Installations {
106 perm := strings.Split(github.Stringify(i.Permissions), "{")
107 description := strings.Split(strings.Split(perm[1], "}")[0], ", ")
108 sort.Strings(description)
109 finalPerm := strings.Join(description, ", ")
110 wrappedInstallations = append(wrappedInstallations,
111 InstallationInfo{
112 ID: *i.ID,
113 Name: *i.AppSlug,
114 Permissions: finalPerm,
115 })
116 }
117 return stats, wrappedInstallations, nil
118}
119
120func parseOauthApps(appJson string) ([]WrappedOAuthApp, error) {
121 var apps []scrape.OAuthApp

Callers 1

ServeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected