Skip to content

Fix rubocop for gitlab json

Linjie Zhang请求将fix-rubocop-gitlab-json合并到main-jh

What does this MR do and why?

fix rubocop rule for Gitlab::Json

jh/app/controllers/jh/projects/graphs_controller.rb:34:22: C: [Correctable] Gitlab/Json: Prefer Gitlab::Json over calling JSON or to_json directly. See https://docs.gitlab.com/ee/development/json.html

        render json: @log.to_json
                     ^^^^^^^^^^^^
jh/lib/gitlab/content_validation/client.rb:16:34: C: [Correctable] Gitlab/Json: Prefer Gitlab::Json over calling JSON or to_json directly. See https://docs.gitlab.com/ee/development/json.html

        response = request(path, { content: content }.to_json)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jh/lib/gitlab/content_validation/client.rb:28:58: C: [Correctable] Gitlab/Json: Prefer Gitlab::Json over calling JSON or to_json directly. See https://docs.gitlab.com/ee/development/json.html

        request("/api/content_validation/blob_validate", data.to_json)
                                                         ^^^^^^^^^^^^
jh/lib/gitlab/content_validation/client.rb:34:54: C: [Correctable] Gitlab/Json: Prefer Gitlab::Json over calling JSON or to_json directly. See https://docs.gitlab.com/ee/development/json.html

        request("/api/content_validation/complaint", data.to_json)
                                                     ^^^^^^^^^^^^
jh/spec/support/helpers/jh/content_validation_request.rb:21:17: C: [Correctable] Gitlab/Json: Prefer Gitlab::Json over calling JSON or to_json directly. See https://docs.gitlab.com/ee/development/json.html

          body: { 'code' => 200, 'message' => 'validation success"' }.to_json,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jh/spec/support/helpers/jh/content_validation_request.rb:28:17: C: [Correctable] Gitlab/Json: Prefer Gitlab::Json over calling JSON or to_json directly. See https://docs.gitlab.com/ee/development/json.html

          body: { code: 406, message: "validation block" }.to_json,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jh/spec/support/helpers/jh/content_validation_request.rb:46:15: C: [Correctable] Gitlab/Json: Prefer Gitlab::Json over calling JSON or to_json directly. See https://docs.gitlab.com/ee/development/json.html

        body: { code: 406, message: "validation block" }.to_json,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Describe in detail what your merge request does and why.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Linjie Zhang 编辑于

合并请求报告

加载中