Should RuboCop check low-level files (GAPIC and associated)? - Ruby google-cloud-ruby

I believe that the RuboCop configuration files for all packages containing GAPIC code exclude that code from analysis. Recently, a question about style came up in a PR adding GAPIC code. Should this code be covered by RuboCop?

Updating these files to pass RuboCop analysis could require significant work. For example, if I remove the following lines from google-cloud-logging/.rubocop.yml:

    - "lib/google/logging/**/*"
    - "lib/google/cloud/logging/v2.rb"
    - "lib/google/cloud/logging/v2/**/*"

The result is 285 offenses detected:

Running RuboCop...
/Users/quartzmo/code/google/codez/gcloud-ruby/google-cloud-logging/.rubocop.yml: Style/RescueException has the wrong namespace - should be Lint
Inspecting 42 files


lib/google/cloud/logging/v2/config_service_v2_api.rb:35:81: C: Line is too long. [86/80]
        # Service for configuring sinks used to export log entries outside Stackdriver
lib/google/cloud/logging/v2/config_service_v2_api.rb:62:81: C: Line is too long. [81/80]
          # The scopes needed to make gRPC calls to all of the methods defined in
lib/google/cloud/logging/v2/config_service_v2_api.rb:89:15: C: Use the new Ruby 1.9 hash syntax.
              :"project" => project
lib/google/cloud/logging/v2/config_service_v2_api.rb:89:15: C: Do not use strings for word-like symbol literals.


lib/google/logging/v2/logging_services_pb.rb:46:81: C: Line is too long. [130/80]
          rpc :ListMonitoredResourceDescriptors, ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse

42 files inspected, 285 offenses detected
RuboCop failed!
Asked Oct 12 '21 11:10
avatar quartzmo

1 Answer:

I think the generate protobuf classes should remain exempt from rubocop linting, because the protobuf ruby compiler is an independent project of its own.

The GAPIC generated code could probably benefit from some simple linting, like the missing new line at end of file. But I'm not sure how feasible it is to fix all the other NITs. Especially GAPIC generated code has to deal with the super long protobuf classes. (cc @swcloud) I'm wonder if it's possible to have two sets of rubocop style definitions coexist. A stricter style for hand written code, and a simpler style for generated GAPIC code.

Answered Nov 23 '16 at 00:11
avatar  of hxiong388