Showing 30 of 30 total issues
Class Entity
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Entity
# rubocop:disable Metrics/ModuleLength, Naming/MethodName
module Attributes
# Schema: person
def cn
Class StudentCourseEnrollmentService
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class StudentCourseEnrollmentService # rubocop:disable Metrics/ClassLength
ECTS = 30
CompulsoryCourseGroup = OpenStruct.new(name: 'compulsories', completed: false)
EnrollableError = Class.new(StandardError)
Function exports
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Function DynamicSelect
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
var DynamicSelect = function (parameters) { // eslint-disable-line no-unused-vars
var Store = {}
function init () {
$.each(parameters, function (k, parameter) {
Method prospective_student_params
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prospective_student_params
params.require(:prospective_student).permit(
:academic_term_id,
:additional_score,
:address,
Function OptionsBuilder
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
var OptionsBuilder = function (datas, config = {}) {
var options = []
function build () {
if (options.length > 0) return options
- 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 merge_keep!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def merge_keep!(other)
merge!(other)
self.class.members.each do |member|
next if (value = __send__(member)).nil?
next unless (member_string = member.to_s).end_with? SUFFIX_INDICATING_KEEP
- 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
enum index: {
ssci: 5,
sci_expanded: 6,
ahci: 7,
field_indexes: 8,
- 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 53.
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
ATTRIBUTES = {
cn: :single,
displayName: :single,
eduPersonAffiliation: :multiple,
eduPersonPrimaryAffiliation: :single,
- 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 53.
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 build_operations_for_update
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def build_operations_for_update(entity)
current_values = find_values_via_ldap(entity).with_indifferent_access
values = entity.values.with_indifferent_access
operations = []
- 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 TelInputValidation
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var TelInputValidation = function (inputId, errorMsgId, errorMessages) { // eslint-disable-line no-unused-vars
var input = document.querySelector(inputId)
var errorMsg = document.querySelector(errorMsgId)
var reset = function () {
Similar blocks of code found in 2 locations. Consider refactoring. Open
def non_graduates
data = Xokul::UBS::Statistic::Student.non_graduates
@degrees = data.pluck(:degree).uniq!
@series = data.group_by { |item| item[:status] }.map do |status, values|
{
- 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 45.
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
def genders_and_degrees
data = Xokul::UBS::Statistic::Student.by_genders_and_degree
@degrees = data.pluck(:degree).uniq!
@series = data.group_by { |item| item[:gender] }.map do |gender, values|
{
- 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 45.
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 load
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load(fallback: DEFAULT_TENANT)
tenant = self.name = (ENV['NOKUL_TENANT'] || fallback)&.downcase
raise Error::LoadError, 'No tenant defined through NOKUL_TENANT environment' if tenant.blank?
raise Error::LoadError, 'Tenant "common" is not a concrete tenant' if tenant == 'common'
- 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 find_values_via_ldap
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_values_via_ldap(entity)
current_values = find_by(entity.dn, uid: entity.uid)
Entity::ATTRIBUTES.each_with_object({}) do |(attribute, type), hash|
value = current_values.public_send(attribute.downcase)
hash[attribute] = (type == :single ? value.first : value)
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update
if user_params[:password].blank? || user_params[:password_confirmation].blank?
@user.update_without_password(user_params) ? redirect_with('.success') : render(:edit)
else
@user.update(user_params) ? redirect_with('.success') : render(:edit)
- 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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
@prospective_employee = ProspectiveEmployee.new(prospective_employee_params)
prospective = FirstRegistration::ProspectiveService.new(@prospective_employee)
if prospective.register
- 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 included
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def included(base)
super
# Support mixins as in the following use cases
- 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 dynamic_search
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def dynamic_search(params = {})
raise ArgumentError, 'parameter must be Hash' unless [ActionController::Parameters, Hash].include?(params.class)
results = dynamic_where(params)
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process(page: 0)
response = Xokul::Yoksis::Prospectives.all(@type, @year, page: page) || {}
response.fetch(:data, []).each do |params|
Actions::ProspectiveStudent::Upsert.call(params.merge(year: @year), academic_term: @academic_term)
- 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"