Skip to content

Commit

Permalink
RuleBasedEditor: more clarifications and reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jouvin committed May 8, 2016
1 parent 27eb7d2 commit 1660a6f
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/main/perl/RuleBasedEditor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ Readonly my $BACKUP_FILE_EXT => ".old";
Update configuration file contents, applying configuration rules.
Arguments :
config_rules: config rules corresponding to the file to build
config_options: configuration parameters used to build actual configuration
config_rules: a hashref containing config rules corresponding to the file to build
config_options: a hashref for configuration parameters used to build actual configuration
options: a hashref defining options to modify the behaviour of this function
Supported entries for options hash:
Expand All @@ -329,7 +329,7 @@ Supported entries for options hash:
Return value
sucess: 1
argument error: undef
argument error or error duing rule processing: undef
=cut

Expand Down Expand Up @@ -974,7 +974,7 @@ sub _apply_rules
$rule_id++;

# Initialize parser_options for this rule according the default for this file
my $rule_parsing_options = {%{$parser_options}};
my $rule_parsing_options = {%$parser_options};

# Check if the keyword is prefixed by:
# - a '-': in this case the corresponding line must be unconditionally
Expand Down Expand Up @@ -1019,8 +1019,7 @@ sub _apply_rules
# Parse rule if it is non empty
my $rule_info;
if ($rule ne '') {
*$self->{LOG}
->debug(1, "$function_name: processing rule $rule_id (variable=>>>$keyword<<<, rule=>>>$rule<<<, fmt=$line_fmt)");
*$self->{LOG}->debug(1, "$function_name: processing rule $rule_id (variable=>>>$keyword<<<, rule=>>>$rule<<<, fmt=$line_fmt)");
$rule_info = $self->_parse_rule($rule, $config_options, $rule_parsing_options);
next unless $rule_info;
*$self->{LOG}->debug(2, "$function_name: information returned by rule parser: " . join(" ", sort(keys(%$rule_info))));
Expand Down Expand Up @@ -1050,14 +1049,12 @@ sub _apply_rules
if ($rule_info->{attribute}) {
foreach my $option_set (@{$rule_info->{option_sets}}) {
my $attr_value;
*$self->{LOG}
->debug(1, "$function_name: retrieving '" . $rule_info->{attribute} . "' value in option set $option_set");
*$self->{LOG}->debug(1, "$function_name: retrieving '" . $rule_info->{attribute} . "' value in option set $option_set");
if ($option_set eq $RULE_OPTION_SET_GLOBAL) {
if (exists($config_options->{$rule_info->{attribute}})) {
if ( $config_options->{$rule_info->{attribute}} ) {
$attr_value = $config_options->{$rule_info->{attribute}};
} else {
*$self->{LOG}
->debug(1, "$function_name: attribute '" . $rule_info->{attribute} . "' not found in global option set");
*$self->{LOG}->debug(1, "$function_name: attribute '" . $rule_info->{attribute} . "' not found in global option set");
$attribute_present = 0;
}
} else {
Expand Down

0 comments on commit 1660a6f

Please sign in to comment.