Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
CCOLLOT committed Dec 18, 2023
1 parent 53df6fd commit f466ee5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
4 changes: 0 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ linters:
enable-all: false
disable-all: false
enable:
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
- asciicheck
- bodyclose
- dogsled
Expand All @@ -41,7 +38,6 @@ linters:
- gomodguard
- goprintffuncname
- gosec
- ifshort
- importas
- makezero
- misspell
Expand Down
10 changes: 5 additions & 5 deletions internal/app/calculators/date_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (

func TestDateCalculateObsolescenceScore(t *testing.T) {
testCases := []struct {
software s.Software
software *s.Software
expectedScore int
}{
{
software: s.Software{
software: &s.Software{
Version: s.Version{ReleaseDate: time.Now()},
VersionCandidates: []s.Version{},
Dependencies: []*s.Software{
Expand All @@ -31,7 +31,7 @@ func TestDateCalculateObsolescenceScore(t *testing.T) {
expectedScore: 25,
},
{
software: s.Software{
software: &s.Software{
Version: s.Version{ReleaseDate: time.Now()},
VersionCandidates: []s.Version{},
Dependencies: []*s.Software{
Expand All @@ -51,7 +51,7 @@ func TestDateCalculateObsolescenceScore(t *testing.T) {
expectedScore: 25,
},
{
software: s.Software{
software: &s.Software{
Version: s.Version{ReleaseDate: time.Now().Add(-73 * time.Hour)},
VersionCandidates: []s.Version{
{ReleaseDate: time.Now().Add(-23 * time.Hour)},
Expand All @@ -62,7 +62,7 @@ func TestDateCalculateObsolescenceScore(t *testing.T) {
}
calculator := New(zap.NewExample(), s.ReleaseDateCalculator, true)
for _, tc := range testCases {
err := calculator.CalculateObsolescenceScore(&tc.software)
err := calculator.CalculateObsolescenceScore(tc.software)
if err != nil {
t.Fatal(err)
}
Expand Down
8 changes: 4 additions & 4 deletions internal/app/calculators/default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (

func TestCalculateObsolescenceScore(t *testing.T) {
testCases := []struct {
software s.Software
software *s.Software
expectedScore int
}{
{
software: s.Software{
software: &s.Software{
Name: "no-deps-and-up-to-date",
Version: s.Version{Version: "11.1.1"},
VersionCandidates: []s.Version{},
Expand All @@ -23,7 +23,7 @@ func TestCalculateObsolescenceScore(t *testing.T) {
expectedScore: 0,
},
{
software: s.Software{
software: &s.Software{
Name: "deps and up-to-date",
Version: s.Version{Version: "11.1.1"},
VersionCandidates: []s.Version{},
Expand All @@ -47,7 +47,7 @@ func TestCalculateObsolescenceScore(t *testing.T) {
for _, tc := range testCases {
fmt.Println(tc.software.Name)
calculator := New(zap.NewExample(), tc.software.Calculator, true)
err := calculator.CalculateObsolescenceScore(&tc.software)
err := calculator.CalculateObsolescenceScore(tc.software)
if err != nil {
t.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/app/calculators/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (

func TestMetaCalculateObsolescenceScore(t *testing.T) {
testCases := []struct {
software s.Software
software *s.Software
expectedScore int
}{
{
software: s.Software{
software: &s.Software{
Name: "EKS-cluster-metacalculator",
Calculator: s.MetaCalculator,
Dependencies: []*s.Software{
Expand All @@ -38,7 +38,7 @@ func TestMetaCalculateObsolescenceScore(t *testing.T) {
for _, tc := range testCases {
fmt.Println(tc.software.Name)
calculator := New(zap.NewExample(), tc.software.Calculator, true)
err := calculator.CalculateObsolescenceScore(&tc.software)
err := calculator.CalculateObsolescenceScore(tc.software)
if err != nil {
t.Fatal(err)
}
Expand Down
8 changes: 4 additions & 4 deletions internal/app/sources/aws/rds/source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@ func TestLoad(t *testing.T) {
)

tcases := []struct {
cfg Config
cfg *Config
expectedSoftwareCount int
}{
{
cfg: Config{
cfg: &Config{
AggregationLevel: "cluster",
},
expectedSoftwareCount: 2,
},
{
cfg: Config{
cfg: &Config{
AggregationLevel: "instance",
},
expectedSoftwareCount: 3,
},
}
for _, tc := range tcases {
src, err := NewSource(api, zap.NewExample(), &tc.cfg)
src, err := NewSource(api, zap.NewExample(), tc.cfg)
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit f466ee5

Please sign in to comment.