Skip to content

Commit

Permalink
fix: metric shouldn't error on empty files
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Aug 28, 2023
1 parent f6c9cdf commit ea43b41
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions internal/core/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package core

import (
"bytes"
"errors"
"os"
"path/filepath"
"sort"
Expand Down Expand Up @@ -143,7 +142,7 @@ func (f *File) ComputeMetrics() (map[string]interface{}, error) {

doc := summarize.NewDocument(f.Summary.String())
if doc.NumWords == 0 {
return params, errors.New("empty file")
return params, nil
}

params["complex_words"] = doc.NumComplexWords
Expand Down

0 comments on commit ea43b41

Please sign in to comment.