Add linting
This commit is contained in:
parent
5b7d3dcdc4
commit
5290a0b549
18
.build.yml
18
.build.yml
@ -27,3 +27,21 @@ tasks:
|
|||||||
cd twitter_offline_engine/scraper
|
cd twitter_offline_engine/scraper
|
||||||
|
|
||||||
go test -bench=.
|
go test -bench=.
|
||||||
|
|
||||||
|
- install_golangci-lint: |
|
||||||
|
SECONDS=0
|
||||||
|
|
||||||
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/local/go/bin v1.40.1
|
||||||
|
sudo ln /usr/local/go/bin/golangci-lint /usr/bin/golangci-lint
|
||||||
|
|
||||||
|
duration=$SECONDS
|
||||||
|
echo "Task completed in $(($duration / 60))m$(($duration % 60))s."
|
||||||
|
|
||||||
|
- run_lint: |
|
||||||
|
SECONDS=0
|
||||||
|
|
||||||
|
cd twitter_offline_engine/scraper
|
||||||
|
golangci-lint run
|
||||||
|
|
||||||
|
duration=$SECONDS
|
||||||
|
echo "Task completed in $(($duration / 60))m$(($duration % 60))s."
|
||||||
|
@ -142,7 +142,7 @@ type TweetResponse struct {
|
|||||||
Cursor struct {
|
Cursor struct {
|
||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
} `json:"cursor"`
|
} `json:"cursor"`
|
||||||
} `json:"operation`
|
} `json:"operation"`
|
||||||
} `json:"content"`
|
} `json:"content"`
|
||||||
} `json:"entries"`
|
} `json:"entries"`
|
||||||
} `json:"addEntries"`
|
} `json:"addEntries"`
|
||||||
|
@ -22,6 +22,6 @@ func TestGetGuestToken(t *testing.T) {
|
|||||||
// other than the first use the cache.
|
// other than the first use the cache.
|
||||||
func BenchmarkGetGuestToken(b *testing.B) {
|
func BenchmarkGetGuestToken(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
scraper.GetGuestToken()
|
_, _ = scraper.GetGuestToken()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,9 @@ func TestParseSingleRetweet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
retweet, err := scraper.ParseSingleRetweet(api_tweet)
|
retweet, err := scraper.ParseSingleRetweet(api_tweet)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
if retweet.RetweetID != scraper.TweetID("1404270043018448896") {
|
if retweet.RetweetID != scraper.TweetID("1404270043018448896") {
|
||||||
t.Errorf("Expected %q, got %q", scraper.TweetID("1404270043018448896"), retweet.RetweetID)
|
t.Errorf("Expected %q, got %q", scraper.TweetID("1404270043018448896"), retweet.RetweetID)
|
||||||
|
@ -21,6 +21,9 @@ func TestParseSingleUser(t *testing.T) {
|
|||||||
apiUser := user_resp.ConvertToAPIUser()
|
apiUser := user_resp.ConvertToAPIUser()
|
||||||
|
|
||||||
user, err := scraper.ParseSingleUser(apiUser)
|
user, err := scraper.ParseSingleUser(apiUser)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
if user.ID != "44067298" {
|
if user.ID != "44067298" {
|
||||||
t.Errorf("Expected %q, got %q", "44067298", user.ID)
|
t.Errorf("Expected %q, got %q", "44067298", user.ID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user