Showing 467 of 467 total issues
File redactor.js
has 5811 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Redactor v9.1.9
Updated: Dec 12, 2013
http://imperavi.com/redactor/
Method mon_pk
has a Cognitive Complexity of 344 (exceeds 5 allowed). Consider refactoring. Open
def mon_pk
xitems = []
Entrance::Campaign.find(2014).items.sort_by { |i| "#{i.direction.name} #{i.direction.new_code} #{i.payed? ? '2' : '1'}" }.each do |item|
# Выкидываем профессиональное обучение, по которому у нас не было набора.
next if [244350,237078,244351].include?(item.id)
- 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 report
has a Cognitive Complexity of 234 (exceeds 5 allowed). Consider refactoring. Open
def report
#.
# find_all { |a| [11, 12].include?(a.form) && !a.payed? && %w(03 05).include?(a.direction.new_code.split('.')[1]) && 32014 != a.campaign.id }
respond_to do |format|
- 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 to_fis
has a Cognitive Complexity of 180 (exceeds 5 allowed). Consider refactoring. Open
def to_fis
builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
xml.Application do
xml.UID id
xml.ApplicationNumber number
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
$('#form-fio input').on('blur', function() {
if (checkFill()) {
var fio =
$('#user_fname_attributes_ip').val()
+ ' ' + $('#user_iname_attributes_ip').val()
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 502.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
$('#form-student-fio input').on('blur', function() {
if (checkStudentFill()) {
var fio =
$('#person_fname_attributes_ip').val()
+ ' ' + $('#person_iname_attributes_ip').val()
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 502.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method index
has a Cognitive Complexity of 114 (exceeds 5 allowed). Consider refactoring. Open
def index
# Проверяем созданные заявления на предмет наличия оригинала.
@has_original = false
@applications.each do |a|
@has_original = true if a.original?
- 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
File application.rb
has 813 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Entrance::Application < ActiveRecord::Base
# TODO XXX
self.table_name_prefix = 'entrance_'
belongs_to :campaign, class_name: 'Entrance::Campaign'
Method mon_pk
has 357 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mon_pk
xitems = []
Entrance::Campaign.find(2014).items.sort_by { |i| "#{i.direction.name} #{i.direction.new_code} #{i.payed? ? '2' : '1'}" }.each do |item|
# Выкидываем профессиональное обучение, по которому у нас не было набора.
next if [244350,237078,244351].include?(item.id)
File gzgu_controller.rb
has 668 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Report::GzguController < ApplicationController
def mon_pk
xitems = []
Entrance::Campaign.find(2014).items.sort_by { |i| "#{i.direction.name} #{i.direction.new_code} #{i.payed? ? '2' : '1'}" }.each do |item|
File student.rb
has 649 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Student < ActiveRecord::Base
include Filterable
include ActionView::Helpers::NumberHelper
include Study::CheckpointmarkHelper
Method init_applications
has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring. Open
def init_applications
@exam_names = {}
@exam_names_crimea = {}
@exam_names_foreign = {}
- 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
Function toolbarInit
has 267 lines of code (exceeds 25 allowed). Consider refactoring. Open
toolbarInit: function(lang)
{
return {
html:
{
File campaigns_controller.rb
has 578 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Entrance::CampaignsController < ApplicationController
# skip_before_action :authenticate_user!, only: [:applications, :balls, :rating, :crimea_rating]
# skip_before_action :authenticate_user!, only: [:applications, :balls, :stats]
skip_before_action :authenticate_user!, only: [:applications, :balls, :stats]
Method to_fis
has 236 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_fis
builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
xml.Application do
xml.UID id
xml.ApplicationNumber number
Method stats
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def stats
@directions = Entrance::Campaign.where(start_year: Entrance::Campaign::CURRENT_YEAR).
map(&:competitive_groups).sum.map(&:items).sum.map(&:direction).uniq.sort_by do |d|
[d.bachelor? || d.specialist? ? 1 : 2, d.master? ? 1 : 2, d.name]
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 mon_pk_f1_2014_06_23
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
def mon_pk_f1_2014_06_23
@data = []
Entrance::Campaign.find(2014).items.find_all { |i| !i.payed? }.sort_by { |i| "#{i.direction.name} #{i.direction.new_code}" }.each do |item|
next if item.direction.new_code.split('.')[1] == '06'
next if [244350,237078,244351].include?(item.id)
- 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 report
has 214 lines of code (exceeds 25 allowed). Consider refactoring. Open
def report
#.
# find_all { |a| [11, 12].include?(a.form) && !a.payed? && %w(03 05).include?(a.direction.new_code.split('.')[1]) && 32014 != a.campaign.id }
respond_to do |format|
Method to_sberbank
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
def self.to_sberbank
# windows-1251
doc = Nokogiri::XML::Builder.new(encoding: 'utf-8' ) do |xml|
xml.СчетаПК(ДатаФормирования: I18n.l(Date.today, format: '%d.%m.%Y'), НомерДоговора: '',
- 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 to_soccard
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def self.to_soccard
doc = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
xml.file do
xml.parent.namespace = xml.parent.add_namespace_definition('tns', 'http://university.sm.msr.com/schemas/incoming')
# xml.parent.namespace = 'tns'
- 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"