Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/cc/engine/analyzers/engine_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ def mass_threshold_for(language)
end
end

private

attr_reader :config

def fetch_language(language)
language = config.
fetch("languages", {}).
Expand All @@ -46,6 +42,10 @@ def fetch_language(language)
end
end

private

attr_reader :config

def normalize(hash)
hash.tap do |config|
languages = config.fetch("config", {}).fetch("languages", {})
Expand Down
2 changes: 1 addition & 1 deletion lib/cc/engine/analyzers/python/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def parser(path)
end

def python_version
engine_config.languages.fetch("python", {}).fetch("python_version", DEFAULT_PYTHON_VERSION)
engine_config.fetch_language(LANGUAGE).fetch("python_version", DEFAULT_PYTHON_VERSION)
end
end
end
Expand Down
17 changes: 17 additions & 0 deletions spec/cc/engine/analyzers/python/main_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,23 @@ def c(thing: str):
end
end

it "handles an empty yml key in config" do
create_source_file("foo.py", <<-EOPY)
def a(thing):
print("Hello", thing)
EOPY

conf = CC::Engine::Analyzers::EngineConfig.new({
"config" => {
"languages" => {
"python" => ""
}
}
})

expect(run_engine(engine_conf)).to eq("")
end

def engine_conf
CC::Engine::Analyzers::EngineConfig.new({
"config" => {
Expand Down