MCPcopy Index your code
hub / github.com/XmirrorSecurity/OpenSCA-cli / OpenReader

Method OpenReader

opensca/model/file.go:47–58  ·  view source on GitHub ↗

OpenReader 打开文件reader

(do func(reader io.Reader))

Source from the content-addressed store, hash-verified

45
46// OpenReader 打开文件reader
47func (file *File) OpenReader(do func(reader io.Reader)) error {
48 if file == nil || file.abspath == "" {
49 return nil
50 }
51 f, err := os.Open(file.abspath)
52 if err != nil {
53 return err
54 }
55 defer f.Close()
56 do(f)
57 return nil
58}
59
60// ReadLine 按行读取文件内容 去除行尾换行符
61func (file File) ReadLine(do func(line string)) {

Callers 15

mainFunction · 0.95
ReadLineMethod · 0.95
ReadLineNoCommentMethod · 0.95
ParseSetupFunction · 0.80
ParsePipfileFunction · 0.80
ParsePipfileLockFunction · 0.80
ParseGopkgTomlFunction · 0.80
ParseGopkgLockFunction · 0.80
ScaMethod · 0.80
ScanMethod · 0.80
ParseCdxJsonFunction · 0.80
ParseCdxXmlFunction · 0.80

Calls 1

CloseMethod · 0.45

Tested by

no test coverage detected