Skip to content

Commit d42cc37

Browse files
committed
Refactor name of URL
1 parent d4fa686 commit d42cc37

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

cmd/diagnose.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const FETCH_REPOS_PER_ONCE = 20
2727

2828
type Diagnosis struct {
2929
Name string
30-
Url string
30+
URL string
3131
Archived bool
3232
Ignored bool
3333
Diagnosed bool
@@ -54,12 +54,12 @@ func FetchRepositoryParams(libs []types.Library, g MedicalTechnician) []github.F
5454

5555
fmt.Printf("%s\n", lib.Name)
5656

57-
githubUrl, err := g.SourceCodeURL(lib)
57+
url, err := g.SourceCodeURL(lib)
5858
if err != nil {
5959
return
6060
}
6161

62-
repo, err := github.ParseGitHubUrl(githubUrl)
62+
repo, err := github.ParseGitHubURL(url)
6363
if err != nil {
6464
params = append(params,
6565
github.FetchRepositoryParam{
@@ -116,7 +116,7 @@ func Diagnose(d MedicalTechnician, r io.ReadSeekCloserAt, year int, ignores []st
116116
isIgnore := slices.Contains(ignores, r.Name)
117117
diagnosis := Diagnosis{
118118
Name: r.Name,
119-
Url: r.Url,
119+
URL: r.URL,
120120
Archived: r.Archived,
121121
Ignored: isIgnore,
122122
Diagnosed: true,
@@ -233,11 +233,11 @@ func Report(diagnoses map[string]Diagnosis) error {
233233
continue
234234
}
235235
if diagnosis.Archived {
236-
errMessages = append(errMessages, fmt.Sprintf("[error] %s (archived): %s", diagnosis.Name, diagnosis.Url))
236+
errMessages = append(errMessages, fmt.Sprintf("[error] %s (archived): %s", diagnosis.Name, diagnosis.URL))
237237
errCount += 1
238238
}
239239
if !diagnosis.IsActive {
240-
warnMessages = append(warnMessages, fmt.Sprintf("[warn] %s (not-maintained): %s", diagnosis.Name, diagnosis.Url))
240+
warnMessages = append(warnMessages, fmt.Sprintf("[warn] %s (not-maintained): %s", diagnosis.Name, diagnosis.URL))
241241
warnCount += 1
242242
}
243243
}

cmd/diagnose_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,47 @@ func TestDiagnose(t *testing.T) {
1212
expect := map[string]Diagnosis{
1313
"faker": {
1414
Name: "faker",
15-
Url: "https://github.com/faker-ruby/faker",
15+
URL: "https://github.com/faker-ruby/faker",
1616
Archived: false,
1717
Ignored: false,
1818
Diagnosed: true,
1919
IsActive: true,
2020
},
2121
"concurrent-ruby": {
2222
Name: "concurrent-ruby",
23-
Url: "https://github.com/ruby-concurrency/concurrent-ruby",
23+
URL: "https://github.com/ruby-concurrency/concurrent-ruby",
2424
Archived: false,
2525
Ignored: false,
2626
Diagnosed: true,
2727
IsActive: true,
2828
},
2929
"i18n": {
3030
Name: "i18n",
31-
Url: "https://github.com/ruby-i18n/i18n",
31+
URL: "https://github.com/ruby-i18n/i18n",
3232
Archived: false,
3333
Ignored: true,
3434
Diagnosed: true,
3535
IsActive: true,
3636
},
3737
"method_source": {
3838
Name: "method_source",
39-
Url: "https://github.com/banister/method_source",
39+
URL: "https://github.com/banister/method_source",
4040
Archived: false,
4141
Ignored: false,
4242
Diagnosed: true,
4343
IsActive: true,
4444
},
4545
"paperclip": {
4646
Name: "paperclip",
47-
Url: "https://github.com/thoughtbot/paperclip",
47+
URL: "https://github.com/thoughtbot/paperclip",
4848
Archived: true,
4949
Ignored: false,
5050
Diagnosed: true,
5151
IsActive: false,
5252
},
5353
"dotenv": {
5454
Name: "dotenv",
55-
Url: "https://github.com/bkeepers/dotenv",
55+
URL: "https://github.com/bkeepers/dotenv",
5656
Archived: false,
5757
Ignored: false,
5858
Diagnosed: true,

cmd/github/github.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type GitHubRepository struct {
2323
Name string
2424
Owner string
2525
Repo string
26-
Url string
26+
URL string
2727
Archived bool
2828
LastCommittedAt time.Time
2929
}
@@ -82,7 +82,7 @@ func (githuburl GitHubURL) Parse() (string, string, error) {
8282
return owner, repo, nil
8383
}
8484

85-
func ParseGitHubUrl(url string) (GitHubRepository, error) {
85+
func ParseGitHubURL(url string) (GitHubRepository, error) {
8686
githubURL := GitHubURL{
8787
URL: url,
8888
}
@@ -93,7 +93,7 @@ func ParseGitHubUrl(url string) (GitHubRepository, error) {
9393
return GitHubRepository{
9494
Owner: owner,
9595
Repo: repo,
96-
Url: url,
96+
URL: url,
9797
}, nil
9898
}
9999

@@ -160,7 +160,7 @@ func FetchFromGitHub(params []FetchRepositoryParam) []GitHubRepository {
160160
repos = append(repos, GitHubRepository{
161161
Repo: string(nodeRepo.NameWithOwner),
162162
Archived: bool(nodeRepo.IsArchived),
163-
Url: string(nodeRepo.Url),
163+
URL: string(nodeRepo.Url),
164164
Name: string(nodeRepo.Name),
165165
LastCommittedAt: time.Time(lastCommit.CommittedDate.Time),
166166
})

cmd/github/github_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestGitHubRepository_IsActive(t *testing.T) {
4747
}
4848
}
4949

50-
func TestParseGitHubUrl(t *testing.T) {
50+
func TestParseGitHubURL(t *testing.T) {
5151
tests := []struct {
5252
name string
5353
url string
@@ -91,7 +91,7 @@ func TestParseGitHubUrl(t *testing.T) {
9191

9292
for _, tt := range tests {
9393
t.Run(tt.name, func(t *testing.T) {
94-
r, _ := ParseGitHubUrl(tt.url)
94+
r, _ := ParseGitHubURL(tt.url)
9595
expect := expects[tt.name]
9696
assert.Equal(t, expect.Owner, r.Owner)
9797
assert.Equal(t, expect.Repo, r.Repo)
@@ -123,13 +123,13 @@ func TestFetchFromGitHub(t *testing.T) {
123123
{
124124
Name: "rails",
125125
Repo: "rails/rails",
126-
Url: "https://github.com/rails/rails",
126+
URL: "https://github.com/rails/rails",
127127
Archived: false,
128128
},
129129
{
130130
Name: "strong_parameters",
131131
Repo: "rails/strong_parameters",
132-
Url: "https://github.com/rails/strong_parameters",
132+
URL: "https://github.com/rails/strong_parameters",
133133
Archived: true,
134134
},
135135
}

0 commit comments

Comments
 (0)