Skip to content

Commit

Permalink
Cleaned up debug and log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarlesky committed Jan 22, 2024
1 parent 53e7265 commit 4cdff8d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
28 changes: 11 additions & 17 deletions lib/ceedling/config_matchinator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class ConfigMatchinator

constructor :configurator, :streaminator
constructor :configurator, :streaminator, :reportinator

def config_include?(primary:, secondary:, tertiary:nil)
# Create configurator accessor method
Expand Down Expand Up @@ -85,8 +85,8 @@ def validate_matchers(hash:, section:, context:, operation:nil)
# Look for matcher keys with missing values
hash.each do |k, v|
if v == nil
path = matcher_path(section:section, context:context, operation:operation)
error = "ERROR: Missing list of values for [#{path}↳ '#{k}' matcher in project configuration."
path = generate_matcher_path(section, context, operation)
error = "ERROR: Missing list of values for [#{path} ↳ '#{k}' matcher in project configuration."
raise CeedlingException.new(error)
end
end
Expand All @@ -98,8 +98,8 @@ def matches?(hash:, filepath:, section:, context:, operation:nil)

# Sanity check
if filepath.nil?
path = matcher_path(section:section, context:context, operation:operation)
error = "ERROR: #{path}#{matcher} matching provided nil #{filepath}"
path = generate_matcher_path(section, context, operation)
error = "ERROR: #{path} #{matcher} matching provided nil #{filepath}"
raise CeedlingException.new(error)
end

Expand Down Expand Up @@ -145,8 +145,8 @@ def matches?(hash:, filepath:, section:, context:, operation:nil)
_values += values
matched_notice(section:section, context:context, operation:operation, matcher:_matcher, filepath:filepath)
else # No match
path = matcher_path(section:section, context:context, operation:operation)
@streaminator.stderr_puts("#{path}#{matcher} did not match #{filepath}", Verbosity::DEBUG)
path = generate_matcher_path(section, context, operation)
@streaminator.stderr_puts("#{path} ↳ `#{matcher}` did not match #{filepath}", Verbosity::DEBUG)
end
end

Expand All @@ -158,18 +158,12 @@ def matches?(hash:, filepath:, section:, context:, operation:nil)
private

def matched_notice(section:, context:, operation:, matcher:, filepath:)
path = matcher_path(section:section, context:context, operation:operation)
@streaminator.stdout_puts("#{path}#{matcher} matched #{filepath}", Verbosity::OBNOXIOUS)
path = generate_matcher_path(section, context, operation)
@streaminator.stdout_puts("#{path} #{matcher} matched #{filepath}", Verbosity::OBNOXIOUS)
end

def matcher_path(section:, context:, operation:)
path = ":#{section} ↳ :#{context} "

if !operation.nil?
return path + "↳ :#{operation} "
end

return path
def generate_matcher_path(*keys)
return @reportinator.generate_config_walk(keys)
end

# Assumes expr is a string and has been stripped
Expand Down
1 change: 1 addition & 0 deletions lib/ceedling/objects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ config_matchinator:
compose:
- configurator
- streaminator
- reportinator

flaginator:
compose:
Expand Down
1 change: 1 addition & 0 deletions lib/ceedling/reportinator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def generate_config_walk(keys, depth=0)

_keys = keys.clone
_keys = _keys.slice(0, depth) if depth > 0
_keys.reject! { |key| key.nil? }
return _keys.map{|key| ":#{key}"}.join(' ↳ ')
end

Expand Down

0 comments on commit 4cdff8d

Please sign in to comment.