Passed
Pull Request — master (#6)
by Serhii
02:04
created

parser.go   A

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
cc 2
eloc 13
dl 0
loc 23
ccs 5
cts 6
cp 0.8333
crap 2.0185
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A timeago.parseNeededFile 0 12 2
1
package timeago
2
3
import (
4
	"encoding/json"
5
	"log"
6
7
	"github.com/SerhiiCho/timeago/models"
8
	"github.com/SerhiiCho/timeago/utils"
9
)
10
11
// Parses json file and unmarshals result into a struct
12
func parseNeededFile(fileName string) models.Lang {
13 1
	content := utils.GetFileContent(fileName)
14
15 1
	var result models.Lang
16
17 1
	err := json.Unmarshal(content, &result)
18
19 1
	if err != nil {
20
		log.Fatal(err)
21
	}
22
23 1
	return result
24
}
25