Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2021-11-25 08:30:03 +0300
committerJaime Martinez <jmartinez@gitlab.com>2021-11-25 08:30:03 +0300
commit10bd057380f7c01891a4b5c68c771b03a4d85607 (patch)
treea091bf01a1a8f5e89f2205736df13af223807824
parentc494cbb93ed7cb2fd64233073025d73964807d0c (diff)
parent29313a48ca36e5bb003785fbcdee71a91cb6cd77 (diff)
Merge branch 'fix/nolint' into 'master'
lint: remove outdated nolint directives Closes #557 and #606 See merge request gitlab-org/gitlab-pages!625
-rw-r--r--.golangci.yml1
-rw-r--r--internal/handlers/handlers_test.go5
-rw-r--r--internal/httprange/resource.go1
-rw-r--r--internal/httptransport/transport_test.go2
-rw-r--r--main.go2
5 files changed, 1 insertions, 10 deletions
diff --git a/.golangci.yml b/.golangci.yml
index 2b97de09..abb21b68 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -48,6 +48,7 @@ linters:
- unused
- varcheck
- whitespace
+ - nolintlint
fast: false
issues:
diff --git a/internal/handlers/handlers_test.go b/internal/handlers/handlers_test.go
index a5044d09..d71e9b91 100644
--- a/internal/handlers/handlers_test.go
+++ b/internal/handlers/handlers_test.go
@@ -74,7 +74,6 @@ func TestNotFoundWithTokenIsNotHandled(t *testing.T) {
reqURL, _ := url.Parse("/")
r := &http.Request{URL: reqURL}
response := &http.Response{StatusCode: http.StatusNotFound}
- // nolint:bodyclose // TODO investigate https://gitlab.com/gitlab-org/gitlab-pages/-/issues/606
handled := handlers.checkIfLoginRequiredOrInvalidToken(w, r, "token")(response)
require.False(t, handled)
@@ -116,7 +115,6 @@ func TestForbiddenWithTokenIsNotHandled(t *testing.T) {
w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodGet, "/", nil)
response := &http.Response{StatusCode: tc.StatusCode}
- // nolint:bodyclose // TODO investigate https://gitlab.com/gitlab-org/gitlab-pages/-/issues/606
handled := handlers.checkIfLoginRequiredOrInvalidToken(w, r, tc.Token)(response)
require.Equal(t, tc.Handled, handled)
@@ -135,7 +133,6 @@ func TestNotFoundWithoutTokenIsNotHandledWhenNotAuthSupport(t *testing.T) {
w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodGet, "/", nil)
response := &http.Response{StatusCode: http.StatusNotFound}
- // nolint:bodyclose // TODO investigate https://gitlab.com/gitlab-org/gitlab-pages/-/issues/606
handled := handlers.checkIfLoginRequiredOrInvalidToken(w, r, "")(response)
require.False(t, handled)
@@ -152,7 +149,6 @@ func TestNotFoundWithoutTokenIsHandled(t *testing.T) {
w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodGet, "/", nil)
response := &http.Response{StatusCode: http.StatusNotFound}
- // nolint:bodyclose // TODO investigate https://gitlab.com/gitlab-org/gitlab-pages/-/issues/606
handled := handlers.checkIfLoginRequiredOrInvalidToken(w, r, "")(response)
require.True(t, handled)
@@ -169,7 +165,6 @@ func TestInvalidTokenResponseIsHandled(t *testing.T) {
w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodGet, "/", nil)
response := &http.Response{StatusCode: http.StatusUnauthorized}
- // nolint:bodyclose // TODO investigate https://gitlab.com/gitlab-org/gitlab-pages/-/issues/606
handled := handlers.checkIfLoginRequiredOrInvalidToken(w, r, "token")(response)
require.True(t, handled)
diff --git a/internal/httprange/resource.go b/internal/httprange/resource.go
index 1da1af95..f90e6f5f 100644
--- a/internal/httprange/resource.go
+++ b/internal/httprange/resource.go
@@ -78,7 +78,6 @@ func NewResource(ctx context.Context, url string, httpClient *http.Client) (*Res
// we fetch a single byte and ensure that range requests is additionally supported
req.Header.Set("Range", fmt.Sprintf("bytes=%d-%d", 0, 0))
- // nolint: bodyclose
// body will be closed by discardAndClose
res, err := httpClient.Do(req)
if err != nil {
diff --git a/internal/httptransport/transport_test.go b/internal/httptransport/transport_test.go
index 7fce1b15..feaf63b6 100644
--- a/internal/httptransport/transport_test.go
+++ b/internal/httptransport/transport_test.go
@@ -58,7 +58,6 @@ func Test_withRoundTripper(t *testing.T) {
mtr := &meteredRoundTripper{next: next, durations: histVec, counter: counterVec, ttfbTimeout: DefaultTTFBTimeout}
r := httptest.NewRequest("GET", "/", nil)
- // nolint:bodyclose // res.Body is nil
res, err := mtr.RoundTrip(r)
if tt.err != nil {
counterCount := testutil.ToFloat64(counterVec.WithLabelValues("error"))
@@ -91,7 +90,6 @@ func TestRoundTripTTFBTimeout(t *testing.T) {
req, err := http.NewRequest("GET", "https://gitlab.com", nil)
require.NoError(t, err)
- // nolint:bodyclose // res is nil
res, err := mtr.RoundTrip(req)
require.Nil(t, res)
require.True(t, errors.Is(err, context.Canceled), "context must have been canceled after ttfb timeout")
diff --git a/main.go b/main.go
index 8d7af93a..438ac43f 100644
--- a/main.go
+++ b/main.go
@@ -31,8 +31,6 @@ func initErrorReporting(sentryDSN, sentryEnvironment string) error {
errortracking.WithSentryEnvironment(sentryEnvironment))
}
-// nolint: gocyclo
-// TODO: reduce cyclomatic complexity https://gitlab.com/gitlab-org/gitlab-pages/-/issues/557
func appMain() {
if err := validateargs.NotAllowed(os.Args[1:]); err != nil {
log.WithError(err).Fatal("Using invalid arguments, use -config=gitlab-pages-config file instead")