Skip to content

Commit e127923

Browse files
committed
updates
1 parent 34eda4b commit e127923

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

pkg/analyzer/nodes/node.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ import (
1919

2020
// Information about extracted files.
2121
type fileMetadata struct {
22-
// If true, the file has executable permissions.
22+
// If true, the file is regular and has executable permissions.
2323
isExecutable bool
2424
// If true, contents can be extracted from the filesystem.
2525
isExtractable bool
2626
}
2727

28+
var _ analyzer.Files = (*filesMap)(nil)
29+
2830
// filesMap is an analyzer.Files implementation mapping files extracted from
2931
// filesystem directories. In this implementation the file content is read lazily
3032
// when calls to Get() are made. If an error occurs during content read the map
@@ -40,7 +42,7 @@ type filesMap struct {
4042
readError error
4143
}
4244

43-
// Components contains the result of a node analyzis, listing the O.S. namespace,
45+
// Components contains the result of a node analysis, listing the OS namespace,
4446
// components and language components.
4547
type Components struct {
4648
OSNamespace *database.Namespace
@@ -64,7 +66,7 @@ func Analyze(nodeName, rootFSdir string, uncertifiedRHEL bool) (*Components, err
6466
if err != nil {
6567
return nil, nil
6668
}
67-
// File reading errors during analysis are not exposed to DetectFiles, hence we
69+
// File reading errors during analysis are not exposed to DetectComponents, hence we
6870
// check it and if there were any we fail.
6971
if err := files.readErr(); err != nil {
7072
return nil, errors.Wrapf(err, "analysis of node %q failed", nodeName)

pkg/analyzer/nodes/node_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func Test_filesMap_extractFile(t *testing.T) {
129129
wantErr: assert.NoError,
130130
},
131131
{
132-
name: "when file is extractable and size is bigger then the limit then return nothing",
132+
name: "when file is extractable and size is bigger than the limit then return nothing",
133133
maxFileSize: 1, // minimal size set to fail
134134
args: args{
135135
fileMatcherMock: matcherMock{

pkg/metrics/extractfiles.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ func (m *FileExtractionMetrics) Emit() {
6363
fileExtractionCountMetric.Observe(m.matchCount)
6464
fileExtractionMatchCountMetric.Observe(m.fileCount)
6565
fileExtractionInaccessibleCountMetric.Observe(m.inaccessibleCount)
66+
*m = FileExtractionMetrics{}
6667
}
67-
*m = FileExtractionMetrics{}
6868
}

0 commit comments

Comments
 (0)