Fixed the CI tests

This commit is contained in:
Eduard Urbach 2019-04-28 01:08:34 +09:00
parent fc840296ca
commit b9c4bd748c
4 changed files with 94 additions and 89 deletions

View File

@ -46,10 +46,10 @@ script:
- pack # Pack assets - pack # Pack assets
- revive ./... # Linter - revive ./... # Linter
- go vet ./... # go vet is the official Go static analyzer - go vet ./... # go vet is the official Go static analyzer
- gocyclo -over 19 ./ # forbid code with huge functions
# - go test -v -race ./... # Run all the tests with the race detector enabled # - go test -v -race ./... # Run all the tests with the race detector enabled
# - codecoroner -ignore components funcs ./... # dead code analysis # - codecoroner -ignore components funcs ./... # dead code analysis
- staticcheck -checks all,-ST1000,-ST1005 ./... # static analysis - staticcheck -checks all,-ST1000,-ST1005 ./... # static analysis
- gocyclo -top 10 ./ # List huge functions
- make server bots jobs patches # Build - make server bots jobs patches # Build
- go test -v . # Run all the tests - go test -v . # Run all the tests

4
go.mod
View File

@ -9,7 +9,7 @@ require (
github.com/aerogo/aero v1.1.1 github.com/aerogo/aero v1.1.1
github.com/aerogo/api v0.1.3 github.com/aerogo/api v0.1.3
github.com/aerogo/crawler v0.2.0 github.com/aerogo/crawler v0.2.0
github.com/aerogo/http v1.0.0 github.com/aerogo/http v1.0.1
github.com/aerogo/layout v0.1.4 github.com/aerogo/layout v0.1.4
github.com/aerogo/log v0.1.1 github.com/aerogo/log v0.1.1
github.com/aerogo/markdown v0.1.4 github.com/aerogo/markdown v0.1.4
@ -18,7 +18,7 @@ require (
github.com/aerogo/sitemap v0.1.1 github.com/aerogo/sitemap v0.1.1
github.com/akyoto/color v1.8.1 github.com/akyoto/color v1.8.1
github.com/animenotifier/anilist v0.2.0 github.com/animenotifier/anilist v0.2.0
github.com/animenotifier/arn v1.1.5 github.com/animenotifier/arn v1.1.6
github.com/animenotifier/kitsu v0.2.0 github.com/animenotifier/kitsu v0.2.0
github.com/animenotifier/mal v0.2.0 github.com/animenotifier/mal v0.2.0
github.com/animenotifier/shoboi v0.2.0 github.com/animenotifier/shoboi v0.2.0

10
go.sum
View File

@ -38,6 +38,8 @@ github.com/aerogo/http v0.1.2 h1:3O2qhk2H5HkJg9QzMGEF7z04xRTyrD1raNV1z5QBpaY=
github.com/aerogo/http v0.1.2/go.mod h1:biG/HWNyTuOlNiyQgGTw9Vg6QFpZf5f1qsGJAocmAsI= github.com/aerogo/http v0.1.2/go.mod h1:biG/HWNyTuOlNiyQgGTw9Vg6QFpZf5f1qsGJAocmAsI=
github.com/aerogo/http v1.0.0 h1:15a7Px8wGZbmgFqJMR1kBy3fWFkDfMZWexJzxhmFKe4= github.com/aerogo/http v1.0.0 h1:15a7Px8wGZbmgFqJMR1kBy3fWFkDfMZWexJzxhmFKe4=
github.com/aerogo/http v1.0.0/go.mod h1:B1igUmMLpE6KabMpc9reHCJJNUOJ2U/PR9s1fF3TpPQ= github.com/aerogo/http v1.0.0/go.mod h1:B1igUmMLpE6KabMpc9reHCJJNUOJ2U/PR9s1fF3TpPQ=
github.com/aerogo/http v1.0.1 h1:KTzYarhp5yougurxuAhJKFh3YvZ7R7CfaDVwJv5+xIs=
github.com/aerogo/http v1.0.1/go.mod h1:B1igUmMLpE6KabMpc9reHCJJNUOJ2U/PR9s1fF3TpPQ=
github.com/aerogo/layout v0.1.4 h1:tgYR1AGONZFK0ChK3Snk93iMBhHscH10KdYcVH988Iw= github.com/aerogo/layout v0.1.4 h1:tgYR1AGONZFK0ChK3Snk93iMBhHscH10KdYcVH988Iw=
github.com/aerogo/layout v0.1.4/go.mod h1:NAfsNlQmfEPEmQkEAI47OrxCgTnE61EtAwjhuoFrqnw= github.com/aerogo/layout v0.1.4/go.mod h1:NAfsNlQmfEPEmQkEAI47OrxCgTnE61EtAwjhuoFrqnw=
github.com/aerogo/linter-performance v0.1.2 h1:eKETM6L+7PGTh40p9dtZFE4ZXIS8Fho8wDSvGQwiqB0= github.com/aerogo/linter-performance v0.1.2 h1:eKETM6L+7PGTh40p9dtZFE4ZXIS8Fho8wDSvGQwiqB0=
@ -84,12 +86,12 @@ github.com/andybalholm/cascadia v1.0.0 h1:hOCXnnZ5A+3eVDX8pvgl4kofXv2ELss0bKcqRy
github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/animenotifier/anilist v0.2.0 h1:ntjGlRbJIUGJaXuvE+561vwvmUA8ZyYpLLCKR3SoQ2o= github.com/animenotifier/anilist v0.2.0 h1:ntjGlRbJIUGJaXuvE+561vwvmUA8ZyYpLLCKR3SoQ2o=
github.com/animenotifier/anilist v0.2.0/go.mod h1:giZcbmITsICRCZHJ1eWcuYpQp5ZJK0gnMMaiUD0P4Yo= github.com/animenotifier/anilist v0.2.0/go.mod h1:giZcbmITsICRCZHJ1eWcuYpQp5ZJK0gnMMaiUD0P4Yo=
github.com/animenotifier/arn v1.1.5 h1:R1Mp/17v/XsHzUBCXkrKFWD5tePy06sgn5/M8AiBsL8= github.com/animenotifier/arn v1.1.6 h1:pSiKJoTH3xAaZFUS9vie913zPmV4RQQsRcfw6tL6vMI=
github.com/animenotifier/arn v1.1.5/go.mod h1:orUD7qxAoRPov0bPpehfT5xsSDdiGoZiln2BOyd91S0= github.com/animenotifier/arn v1.1.6/go.mod h1:K99a69VUMDZ9jSK211WoLaLxPHgB9tfxkKy03FUVr9c=
github.com/animenotifier/ffxiv v0.1.0 h1:N9gX5iUtD+g/KW4OjKIclS0y2WrL/+Ko9rGEFDaLf1w= github.com/animenotifier/ffxiv v0.1.0 h1:N9gX5iUtD+g/KW4OjKIclS0y2WrL/+Ko9rGEFDaLf1w=
github.com/animenotifier/ffxiv v0.1.0/go.mod h1:oBHhRzQAUv+dBe4qFJAFnTg7qv5Gl6QFHQphyJla74Q= github.com/animenotifier/ffxiv v0.1.0/go.mod h1:oBHhRzQAUv+dBe4qFJAFnTg7qv5Gl6QFHQphyJla74Q=
github.com/animenotifier/japanese v0.2.0 h1:REdBmsBGB1LY8/bnAJ3akb5W4mKzQfathGTQp1pO4K8= github.com/animenotifier/japanese v0.2.1 h1:O2Fui6+8pmdniQ+swSf+Yp276+iTrSTfvImPRclbFFU=
github.com/animenotifier/japanese v0.2.0/go.mod h1:dznbgicVFy7Ucuyu9pHT7VJv5QKS+7dgFWDnTTpaYP4= github.com/animenotifier/japanese v0.2.1/go.mod h1:HLrrnBE9ztkw9iMcVrm7DKaXydAq21UpZIp1MpKajQI=
github.com/animenotifier/kitsu v0.2.0 h1:Zzr2/GIR+KZn7elZjwtprjwCA0LCKmJ7hcMt7qGT3DM= github.com/animenotifier/kitsu v0.2.0 h1:Zzr2/GIR+KZn7elZjwtprjwCA0LCKmJ7hcMt7qGT3DM=
github.com/animenotifier/kitsu v0.2.0/go.mod h1:Mp8rgLFsGlHiSqYnLtQOWrAIs3x4HVIkKY1cXa8HHJs= github.com/animenotifier/kitsu v0.2.0/go.mod h1:Mp8rgLFsGlHiSqYnLtQOWrAIs3x4HVIkKY1cXa8HHJs=
github.com/animenotifier/mal v0.2.0 h1:v0D9Wf9W0nbIH91L6Ho8BqSECNn8XTVqc4OjyfNEyhw= github.com/animenotifier/mal v0.2.0 h1:v0D9Wf9W0nbIH91L6Ho8BqSECNn8XTVqc4OjyfNEyhw=

View File

@ -123,87 +123,7 @@ component ProfileHead(viewUser *arn.User, animeList *arn.AnimeList, user *arn.Us
.profile-introduction!= markdown.Render(viewUser.Introduction) .profile-introduction!= markdown.Render(viewUser.Introduction)
.profile-tags-container .profile-tags-container
.profile-tags ProfileTags(viewUser, animeList, user)
a.profile-tag.mountable.never-unmount(href="/+" + viewUser.Nick + "/animelist/watching", data-mountable-type="header")
Icon("list")
span= fmt.Sprintf("%d anime", len(animeList.Items))
if user != nil && viewUser.Settings().Privacy.ShowAge && viewUser.Settings().Privacy.ShowGender && viewUser.AgeInYears() != 0
.profile-tag.mountable.never-unmount(data-mountable-type="header")
if viewUser.Gender == "male"
Icon("mars")
else if viewUser.Gender == "female"
Icon("venus")
else
Icon("venus-mars")
span= viewUser.AgeInYears()
if user != nil && viewUser.Settings().Privacy.ShowLocation && viewUser.Location.CountryName != ""
a.profile-tag.mountable.never-unmount(href="/users/country/" + strings.ToLower(viewUser.Location.CountryName), data-mountable-type="header")
Icon("map-marker")
span= viewUser.Location.CountryName
if viewUser.IsPro()
a.profile-tag.mountable.never-unmount(href="/support", aria-label="Supporter", data-mountable-type="header")
Icon("star")
span.profile-pro-status-text PRO
if viewUser.Role != ""
a.profile-tag.mountable.never-unmount(href="/users/staff", aria-label="Staff member", data-mountable-type="header")
Icon("rocket")
span= stringutils.Capitalize(viewUser.Role)
if viewUser.Registered != ""
.profile-tag.mountable.never-unmount(title="Member since", data-mountable-type="header")
Icon("calendar")
span= viewUser.RegisteredTime().Format("Jan 2006")
if !viewUser.IsActive()
.profile-tag.mountable.never-unmount(title="Hasn't been online for the past 2 weeks", data-mountable-type="header")
Icon("bed")
span Inactive
.profile-tag.action.tip.mountable.never-unmount(data-action="showMore", data-trigger="click", aria-label="Show more", data-mountable-type="header")
RawIcon("ellipsis-h")
if viewUser.Website != ""
a.profile-tag.tip.mountable.never-unmount.show-more(href=viewUser.WebsiteURL(), target="_blank", rel="noopener", aria-label=viewUser.WebsiteShortURL(), data-mountable-type="header")
RawIcon("globe")
if viewUser.Accounts.Osu.Nick != "" && viewUser.Accounts.Osu.PP >= 100
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://osu.ppy.sh/u/" + viewUser.Accounts.Osu.Nick, aria-label=fmt.Sprintf("osu! | %.0f pp | Level %.0f | Accuracy: %.1f%%", viewUser.Accounts.Osu.PP, viewUser.Accounts.Osu.Level, viewUser.Accounts.Osu.Accuracy), target="_blank", rel="noopener", data-mountable-type="header")
RawIcon("trophy")
if viewUser.Accounts.Overwatch.BattleTag != "" && viewUser.Accounts.Overwatch.SkillRating >= 1000
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://playoverwatch.com/en-us/career/pc/" + strings.Replace(viewUser.Accounts.Overwatch.BattleTag, "#", "-", 1), aria-label=fmt.Sprintf("Overwatch | %d SR | %s", viewUser.Accounts.Overwatch.SkillRating, stringutils.Capitalize(viewUser.Accounts.Overwatch.Tier)), target="_blank", rel="noopener", data-mountable-type="header")
RawIcon("overwatch")
if viewUser.Accounts.FinalFantasyXIV.Nick != "" && viewUser.Accounts.FinalFantasyXIV.Class != ""
.profile-tag.tip.mountable.never-unmount.show-more(aria-label=fmt.Sprintf("Final Fantasy XIV | %s | Level %d | IL %d", viewUser.Accounts.FinalFantasyXIV.Class, viewUser.Accounts.FinalFantasyXIV.Level, viewUser.Accounts.FinalFantasyXIV.ItemLevel), data-mountable-type="header")
RawIcon("gamepad")
if viewUser.Accounts.Discord.Nick != "" && viewUser.Accounts.Discord.Verified
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://discord.gg/0kimAmMCeXGXuzNF", aria-label=fmt.Sprintf("Discord | %s", viewUser.Accounts.Discord.Nick), data-mountable-type="header")
RawIcon("discord")
if user != nil && user.ID != viewUser.ID
a.profile-tag.tip.mountable.never-unmount.show-more(href="/compare/animelist/" + user.Nick + "/" + viewUser.Nick, aria-label="Compare", data-mountable-type="header")
RawIcon("exchange")
a.profile-tag.tip.mountable.never-unmount.show-more(href="/+" + viewUser.Nick + "/anime/recommended", aria-label="Recommendations", data-mountable-type="header")
RawIcon("archive")
a.profile-tag.tip.mountable.never-unmount.show-more(href="/+" + viewUser.Nick + "/anime/sequels", aria-label="Sequels", data-mountable-type="header")
RawIcon("forward")
if user != nil && (user.Role == "editor" || user.Role == "admin")
a.profile-tag.tip.mountable.never-unmount.show-more(href="/+" + viewUser.Nick + "/log", aria-label="Log", data-mountable-type="header")
RawIcon("list")
if user != nil && user.Role == "admin"
a.profile-tag.tip.mountable.never-unmount.show-more(href="/api/user/" + viewUser.ID, aria-label="API", target="_blank", rel="noopener", data-mountable-type="header")
RawIcon("search-plus")
.profile-actions .profile-actions
if user != nil && user.ID != viewUser.ID if user != nil && user.ID != viewUser.ID
@ -214,4 +134,87 @@ component ProfileHead(viewUser *arn.User, animeList *arn.AnimeList, user *arn.Us
else else
button.profile-action.action.mountable.never-unmount(data-action="unfollowUser", data-trigger="click", data-api="/api/userfollows/" + user.ID + "/remove/" + viewUser.ID) button.profile-action.action.mountable.never-unmount(data-action="unfollowUser", data-trigger="click", data-api="/api/userfollows/" + user.ID + "/remove/" + viewUser.ID)
Icon("user-times") Icon("user-times")
span Unfollow span Unfollow
component ProfileTags(viewUser *arn.User, animeList *arn.AnimeList, user *arn.User)
.profile-tags
a.profile-tag.mountable.never-unmount(href="/+" + viewUser.Nick + "/animelist/watching", data-mountable-type="header")
Icon("list")
span= fmt.Sprintf("%d anime", len(animeList.Items))
if user != nil && viewUser.Settings().Privacy.ShowAge && viewUser.Settings().Privacy.ShowGender && viewUser.AgeInYears() != 0
.profile-tag.mountable.never-unmount(data-mountable-type="header")
if viewUser.Gender == "male"
Icon("mars")
else if viewUser.Gender == "female"
Icon("venus")
else
Icon("venus-mars")
span= viewUser.AgeInYears()
if user != nil && viewUser.Settings().Privacy.ShowLocation && viewUser.Location.CountryName != ""
a.profile-tag.mountable.never-unmount(href="/users/country/" + strings.ToLower(viewUser.Location.CountryName), data-mountable-type="header")
Icon("map-marker")
span= viewUser.Location.CountryName
if viewUser.IsPro()
a.profile-tag.mountable.never-unmount(href="/support", aria-label="Supporter", data-mountable-type="header")
Icon("star")
span.profile-pro-status-text PRO
if viewUser.Role != ""
a.profile-tag.mountable.never-unmount(href="/users/staff", aria-label="Staff member", data-mountable-type="header")
Icon("rocket")
span= stringutils.Capitalize(viewUser.Role)
if viewUser.Registered != ""
.profile-tag.mountable.never-unmount(title="Member since", data-mountable-type="header")
Icon("calendar")
span= viewUser.RegisteredTime().Format("Jan 2006")
if !viewUser.IsActive()
.profile-tag.mountable.never-unmount(title="Hasn't been online for the past 2 weeks", data-mountable-type="header")
Icon("bed")
span Inactive
.profile-tag.action.tip.mountable.never-unmount(data-action="showMore", data-trigger="click", aria-label="Show more", data-mountable-type="header")
RawIcon("ellipsis-h")
if viewUser.Website != ""
a.profile-tag.tip.mountable.never-unmount.show-more(href=viewUser.WebsiteURL(), target="_blank", rel="noopener", aria-label=viewUser.WebsiteShortURL(), data-mountable-type="header")
RawIcon("globe")
if viewUser.Accounts.Osu.Nick != "" && viewUser.Accounts.Osu.PP >= 100
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://osu.ppy.sh/u/" + viewUser.Accounts.Osu.Nick, aria-label=fmt.Sprintf("osu! | %.0f pp | Level %.0f | Accuracy: %.1f%%", viewUser.Accounts.Osu.PP, viewUser.Accounts.Osu.Level, viewUser.Accounts.Osu.Accuracy), target="_blank", rel="noopener", data-mountable-type="header")
RawIcon("trophy")
if viewUser.Accounts.Overwatch.BattleTag != "" && viewUser.Accounts.Overwatch.SkillRating >= 1000
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://playoverwatch.com/en-us/career/pc/" + strings.Replace(viewUser.Accounts.Overwatch.BattleTag, "#", "-", 1), aria-label=fmt.Sprintf("Overwatch | %d SR | %s", viewUser.Accounts.Overwatch.SkillRating, stringutils.Capitalize(viewUser.Accounts.Overwatch.Tier)), target="_blank", rel="noopener", data-mountable-type="header")
RawIcon("overwatch")
if viewUser.Accounts.FinalFantasyXIV.Nick != "" && viewUser.Accounts.FinalFantasyXIV.Class != ""
.profile-tag.tip.mountable.never-unmount.show-more(aria-label=fmt.Sprintf("Final Fantasy XIV | %s | Level %d | IL %d", viewUser.Accounts.FinalFantasyXIV.Class, viewUser.Accounts.FinalFantasyXIV.Level, viewUser.Accounts.FinalFantasyXIV.ItemLevel), data-mountable-type="header")
RawIcon("gamepad")
if viewUser.Accounts.Discord.Nick != "" && viewUser.Accounts.Discord.Verified
a.profile-tag.tip.mountable.never-unmount.show-more(href="https://discord.gg/0kimAmMCeXGXuzNF", aria-label=fmt.Sprintf("Discord | %s", viewUser.Accounts.Discord.Nick), data-mountable-type="header")
RawIcon("discord")
if user != nil && user.ID != viewUser.ID
a.profile-tag.tip.mountable.never-unmount.show-more(href="/compare/animelist/" + user.Nick + "/" + viewUser.Nick, aria-label="Compare", data-mountable-type="header")
RawIcon("exchange")
a.profile-tag.tip.mountable.never-unmount.show-more(href="/+" + viewUser.Nick + "/anime/recommended", aria-label="Recommendations", data-mountable-type="header")
RawIcon("archive")
a.profile-tag.tip.mountable.never-unmount.show-more(href="/+" + viewUser.Nick + "/anime/sequels", aria-label="Sequels", data-mountable-type="header")
RawIcon("forward")
if user != nil && (user.Role == "editor" || user.Role == "admin")
a.profile-tag.tip.mountable.never-unmount.show-more(href="/+" + viewUser.Nick + "/log", aria-label="Log", data-mountable-type="header")
RawIcon("list")
if user != nil && user.Role == "admin"
a.profile-tag.tip.mountable.never-unmount.show-more(href="/api/user/" + viewUser.ID, aria-label="API", target="_blank", rel="noopener", data-mountable-type="header")
RawIcon("search-plus")