Skip to content

Commit

Permalink
FormatRBear.py: disable parameter-options
Browse files Browse the repository at this point in the history
r_keep_comments,r_keep_blank_lines,
r_braces_on_next_line,r_use_arrows are
disabled and will not be checked
untill the user provides value.

closes #514
  • Loading branch information
yogupta committed Jan 21, 2017
1 parent 670b12a commit a4de771
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions bears/r/FormatRBear.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class FormatRBear:
@staticmethod
@deprecate_settings(indent_size='tab_width')
def create_arguments(filename, file, config_file,
r_keep_comments: bool=True,
r_keep_blank_lines: bool=True,
r_braces_on_next_line: bool=False,
r_use_arrows: bool=False,
r_keep_comments: bool=None,
r_keep_blank_lines: bool=None,
r_braces_on_next_line: bool=None,
r_use_arrows: bool=None,
indent_size:
int=SpacingHelper.DEFAULT_TAB_WIDTH,
r_max_expression_length: int=0):
Expand Down Expand Up @@ -78,13 +78,18 @@ def create_arguments(filename, file, config_file,
```
"""
options = {'source="' + escape(filename, '"\\') + '"',
'blank=' + _map_to_r_bool(r_keep_blank_lines),
'brace.newline=' + _map_to_r_bool(r_braces_on_next_line),
'comment=' + _map_to_r_bool(r_keep_comments),
'arrow=' + _map_to_r_bool(r_use_arrows),
'indent=' + str(indent_size)}
if r_max_expression_length:
options.add('width.cutoff=' + str(r_max_expression_length))
if r_braces_on_next_line is not None:
options.add('brace.newline=' +
_map_to_r_bool(r_braces_on_next_line))
if r_keep_blank_lines is not None:
options.add('blank=' + _map_to_r_bool(r_keep_blank_lines))
if r_keep_comments is not None:
options.add('comment=' + _map_to_r_bool(r_keep_comments))
if r_use_arrows is not None:
options.add('arrow=' + _map_to_r_bool(r_use_arrows))

rcode = 'library(formatR);formatR::tidy_source({})'.format(
','.join(options))
Expand Down

0 comments on commit a4de771

Please sign in to comment.