From 482f3ae1278d3bbd3c0a51a7c414126b2ba96ebc Mon Sep 17 00:00:00 2001 From: Alessio Date: Sun, 13 Mar 2022 13:05:37 -0700 Subject: [PATCH] Enable the nolintlint linter --- .golangci.yaml | 35 +++++++++++++++++++---------------- scraper/api_types_v2.go | 4 ++-- scraper/guest_token_test.go | 2 +- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 078ee34..f67186b 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -27,9 +27,16 @@ linters: - lll - godox - errorlint + - nolintlint + + + # Useless linters: + # - dogsled + # - wsl (don't like it for now) + +# TODO: "go fix" -- what is it? What does it do? -# # all available settings of specific linters linters-settings: # cyclop: # # the maximal code complexity to report @@ -39,10 +46,6 @@ linters-settings: # # should ignore tests (default false) # skip-tests: false -# dogsled: -# # checks assignments with too many blank identifiers; default is 2 -# max-blank-identifiers: 2 - # dupl: # # tokens count to trigger issue, 150 by default # threshold: 100 @@ -430,17 +433,17 @@ linters-settings: # # include method names and field names (i.e., qualified names) in checks # q: false -# nolintlint: -# # Enable to ensure that nolint directives are all used. Default is true. -# allow-unused: false -# # Disable to ensure that nolint directives don't have a leading space. Default is true. -# allow-leading-space: true -# # Exclude following linters from requiring an explanation. Default is []. -# allow-no-explanation: [] -# # Enable to require an explanation of nonzero length after each nolint directive. Default is false. -# require-explanation: true -# # Enable to require nolint directives to mention the specific linter being suppressed. Default is false. -# require-specific: true + nolintlint: + # Enable to ensure that nolint directives are all used. Default is true. + allow-unused: false + # Disable to ensure that nolint directives don't have a leading space. Default is true. + allow-leading-space: true + # Exclude following linters from requiring an explanation. Default is []. + allow-no-explanation: [] + # Enable to require an explanation of nonzero length after each nolint directive. Default is false. + require-explanation: true + # Enable to require nolint directives to mention the specific linter being suppressed. Default is false. + require-specific: true # rowserrcheck: # packages: diff --git a/scraper/api_types_v2.go b/scraper/api_types_v2.go index f4513a3..4ebe11b 100644 --- a/scraper/api_types_v2.go +++ b/scraper/api_types_v2.go @@ -366,9 +366,9 @@ func (api_response APIV2Response) ToTweetTrove() (TweetTrove, error) { func get_graphql_user_timeline_url(user_id UserID, cursor string) string { if cursor != "" { - return "https://twitter.com/i/api/graphql/CwLU7qTfeu0doqhSr6tW4A/UserTweetsAndReplies?variables=%7B%22userId%22%3A%22" + fmt.Sprint(user_id) + "%22%2C%22count%22%3A40%2C%22cursor%22%3A%22" + url.QueryEscape(cursor) + "%22%2C%22includePromotedContent%22%3Atrue%2C%22withCommunity%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withBirdwatchPivots%22%3Afalse%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Afalse%2C%22__fs_interactive_text%22%3Afalse%2C%22__fs_responsive_web_uc_gql_enabled%22%3Afalse%2C%22__fs_dont_mention_me_view_api_enabled%22%3Afalse%7D" // nolint:lll + return "https://twitter.com/i/api/graphql/CwLU7qTfeu0doqhSr6tW4A/UserTweetsAndReplies?variables=%7B%22userId%22%3A%22" + fmt.Sprint(user_id) + "%22%2C%22count%22%3A40%2C%22cursor%22%3A%22" + url.QueryEscape(cursor) + "%22%2C%22includePromotedContent%22%3Atrue%2C%22withCommunity%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withBirdwatchPivots%22%3Afalse%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Afalse%2C%22__fs_interactive_text%22%3Afalse%2C%22__fs_responsive_web_uc_gql_enabled%22%3Afalse%2C%22__fs_dont_mention_me_view_api_enabled%22%3Afalse%7D" // nolint:lll // It's a URL, come on } - return "https://twitter.com/i/api/graphql/CwLU7qTfeu0doqhSr6tW4A/UserTweetsAndReplies?variables=%7B%22userId%22%3A%22" + fmt.Sprint(user_id) + "%22%2C%22count%22%3A40%2C%22includePromotedContent%22%3Afalse%2C%22withCommunity%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withBirdwatchPivots%22%3Afalse%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Afalse%2C%22__fs_interactive_text%22%3Afalse%2C%22__fs_dont_mention_me_view_api_enabled%22%3Afalse%7D" // nolint:lll + return "https://twitter.com/i/api/graphql/CwLU7qTfeu0doqhSr6tW4A/UserTweetsAndReplies?variables=%7B%22userId%22%3A%22" + fmt.Sprint(user_id) + "%22%2C%22count%22%3A40%2C%22includePromotedContent%22%3Afalse%2C%22withCommunity%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withBirdwatchPivots%22%3Afalse%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Afalse%2C%22__fs_interactive_text%22%3Afalse%2C%22__fs_dont_mention_me_view_api_enabled%22%3Afalse%7D" // nolint:lll // It's a URL, come on } /** diff --git a/scraper/guest_token_test.go b/scraper/guest_token_test.go index 91abd33..e506950 100644 --- a/scraper/guest_token_test.go +++ b/scraper/guest_token_test.go @@ -24,6 +24,6 @@ func TestGetGuestToken(t *testing.T) { // other than the first use the cache. func BenchmarkGetGuestToken(b *testing.B) { for i := 0; i < b.N; i++ { - GetGuestToken() // nolint:errcheck + GetGuestToken() // nolint:errcheck // Don't care about errors, just want to time it } }