Showing 10 of 16 total issues
Function initQtip
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initQtip() {
$selectedWord.qtip({
position: {
my: 'bottom left',
at: 'top right',
Function text
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
text: function(event, api) {
$.ajax({
url: '/api/web/translations',
data: {
word: $(this).text(),
Method update_with_password
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_with_password(params, *options)
current_password = params.delete(:current_password)
if params[:password].blank?
params.delete(:password)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method text
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def text
result = "*#{word.value}*"
result << ' '
result << "_[#{word_transcription}]_ " if word_transcription.present?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method execute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def execute
unless word
tr = yandex_translate
return tr ? { translation: tr, text: text, youglish: youglish, sound_url: sound_url, from: from, to: to } : nil
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method process_word
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_word
unless word
return I18n.t('telegram.process_message.only_one_word', locale: :ru) if clean_text.split(' ').size > 1
return I18n.t('telegram.process_message.go_premium', locale: :ru) unless telegram_chat_user.premium?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method update_trans
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_trans(trans)
return unless word && trans
return if word.data&.dig('trans', to)
data = word.data || {}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method build_get_response
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_get_response(url, params = {})
uri = URI(url)
uri.query = URI.encode_www_form(params)
response = Net::HTTP.get_response(uri)
response = Net::HTTP.get_response(URI.parse(response.header['location'])) if response.code == '301'
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def execute
result =
if status
case status
when 'learning' then learning
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method update_word_status
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_word_status
return unless telegram_chat
if word && word.language == telegram_chat_user.learning_language
Word::UpdateState.run(ids: [word.id], to_state: 'learning', user: telegram_chat_user)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"