Skip to content

Commit 4f1505f

Browse files
author
remi Taylor
committed
Update style cops and Vision sample to fix offenses
1 parent 6f328a5 commit 4f1505f

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

.rubocop.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ Performance/RedundantBlockCall:
7676
Style/EmptyLinesAroundBlockBody:
7777
Enabled: false
7878

79+
# Allow any level of comment indentation for documentation region tag comments
80+
Style/CommentIndentation:
81+
Enabled: false
82+
83+
# Methods in this repository are often used to wrap code snippets
84+
# These snippets may be long, so the method length cop is disabled
85+
Style/MethodLength:
86+
Enabled: false
87+
7988
Style/NumericLiterals:
8089
Enabled: false
8190
Style/SpaceAroundOperators:
@@ -109,4 +118,4 @@ Style/DotPosition:
109118
Style/WordArray:
110119
MinSize: 4
111120
Metrics/AbcSize:
112-
Max: 20
121+
Enabled: false

vision/vision_samples.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
def detect_labels path_to_image_file
15+
# TODO: update to use named parameters
16+
17+
def detect_labels path_to_image_file:
1618
# [START detect_labels]
1719
# [START importing_libraries]
1820
require "google/cloud"
@@ -38,7 +40,7 @@ def detect_labels path_to_image_file
3840
# [END detect_labels]
3941
end
4042

41-
def detect_landmark path_to_image_file
43+
def detect_landmark path_to_image_file:
4244
# [START detect_landmark]
4345
# [START importing_libraries]
4446
require "google/cloud"
@@ -61,7 +63,7 @@ def detect_landmark path_to_image_file
6163
# [END detect_landmarks]
6264
end
6365

64-
def detect_faces path_to_image_file, path_to_output_file
66+
def detect_faces path_to_image_file:, path_to_output_file:
6567
# [START detect_faces]
6668
# [START importing_libraries]
6769
require "google/cloud"
@@ -115,11 +117,12 @@ def detect_faces path_to_image_file, path_to_output_file
115117

116118
case command
117119
when "labels"
118-
detect_labels ARGV.shift
120+
detect_labels path_to_image_file: ARGV.shift
119121
when "landmarks"
120-
detect_landmark ARGV.shift
122+
detect_landmark path_to_image_file: ARGV.shift
121123
when "faces"
122-
detect_faces ARGV.shift, ARGV.shift
124+
detect_faces path_to_image_file: ARGV.shift,
125+
path_to_output_file: ARGV.shift
123126
else
124127
puts <<-usage
125128
Usage: ruby vision_samples.rb <command> [arguments]

0 commit comments

Comments
 (0)