Skip to content

Commit

Permalink
RuboCopBear: Use naming_convention dict
Browse files Browse the repository at this point in the history
  • Loading branch information
AsnelChristian committed Oct 19, 2016
1 parent 7fae497 commit 4df9c20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions bears/ruby/RuboCopBear.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def generate_config(filename, file,
"REVIEW"),
min_if_unless_guard: int=1,
indent_size: int=2,
method_naming_convention: str='snake_case',
method_naming_convention: str='snake',
string_literals: str='single_quotes',
variable_naming_convention: str='snake_case',
variable_naming_convention: str='snake',
max_class_length: int=100,
class_length_count_comments: bool=False,
max_module_length: int=100,
Expand Down Expand Up @@ -128,13 +128,13 @@ class members.
Number of spaces per indentation level.
:param method_naming_convention:
Case of a method's name.
options: ``snake_case``, ``camelCase``.
options: ``snake``, ``camel``.
:param string_literals:
Use ' or " as string literals.
options: ``single_quotes``, ``double_quotes``.
:param variable_naming_convention:
Case of a variable's name.
options: ``snake_case``, ``camelCase``.
options: ``snake``, ``camel``.
:param max_class_length:
Max lines in a class.
:param class_length_count_comments:
Expand Down Expand Up @@ -173,7 +173,7 @@ class members.
:param allow_unused_method_keyword_args:
Allows unused keyword arguments in a method.
"""

naming_convention = {'camel': 'camelCase', 'snake': 'snake_case'}
options = {
'Style/AccessModifierIndentation':
{'EnforcedStyle': access_modifier_indentation},
Expand All @@ -195,11 +195,14 @@ class members.
'Style/IndentationWidth':
{'Width': indent_size},
'Style/MethodName':
{'EnforcedStyle': method_maming_convention},
{'EnforcedStyle': naming_convention.get(
method_naming_convention, method_naming_convention)},
'Style/StringLiterals':
{'EnforcedStyle': string_literals},
'Style/VariableName':
{'EnforcedStyle': variable_naming_convention},
{'EnforcedStyle': naming_convention.get(
variable_naming_convention,
variable_naming_convention)},
'Metrics/ClassLength':
{'Max': max_class_length,
'CountComments': class_length_count_comments},
Expand Down
2 changes: 1 addition & 1 deletion tests/ruby/RuboCopBearTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ def badindent
RuboCopBear,
valid_files=(bad_file,),
invalid_files=(good_file,),
settings={"method_name_case": "camelCase"})
settings={"method_name_case": "camel"})

0 comments on commit 4df9c20

Please sign in to comment.