Skip to content

Instantly share code, notes, and snippets.

@chinshr
Created November 9, 2015 18:50
Show Gist options
  • Save chinshr/83e1bda20e11523d43d0 to your computer and use it in GitHub Desktop.
Save chinshr/83e1bda20e11523d43d0 to your computer and use it in GitHub Desktop.
Codeclimate complexity 33
def perform
Rails.logger.info "AudioExtractor: creating Elastic Transcoder Job for #{ingest.video.handle}"
client.create_job({
pipeline_id: PIPELINE_ID,
input: {
key: "#{ingest.video.handle}.mp4"
},
output: {
key: "#{ingest.video.handle}.mp3",
preset_id: PRESET_ID,
},
user_metadata: {
ingest_id: ingest.id.to_s,
video_id: ingest.video.id.to_s,
session_id: ingest.video.session_id.to_s
}
})
end
@kblake
Copy link

kblake commented Nov 9, 2015

I'm curious what CC uses for analysis. Is it looking at the number of curly brace pairs in a scope of code and interpreting them as conditionals? I don't know.

@imouaddine
Copy link

One way to reduce the complexity there, is to extract the user_metadata into a private method that returns a hash. However, I am not convinced you should do it just for CC sake.

@towfiq
Copy link

towfiq commented Nov 10, 2015

It may respond to simply setting the hash to a local var and then calling client.create_job with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment