Showing 2,136 of 2,138 total issues
Function initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function(init, element, eventName, selector, callback) {
Function CHILD
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
"CHILD": function( type, what, argument, first, last ) {
Function setSizeAndPos
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function setSizeAndPos( piece, w, h, x, y ) {
Function on
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
Function superMatcher
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
superMatcher = function( seed, context, xml, results, expandContext ) {
Function select
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function select( selector, context, results, seed, xml ) {
Function add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
add: function( elem, types, handler, data, selector ) {
Function condense
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function condense( unmatched, map, filter, context, xml ) {
Function Tween
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function Tween( elem, options, prop, end, easing ) {
Function remove
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
remove: function( elem, types, handler, selector, mappedTypes ) {
Method url_for_offering
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def url_for_offering(offering, user, protocol, host, additional_params = {})
Method offering_report_params
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def offering_report_params(offering, grant, user, url_options, additional_params = {})
Method url_for_class
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def url_for_class(clazz, user, protocol, host, additional_params = {})
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(student, offering, protocol, host_with_port, anonymize = false)
Method set_role_for_projects
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_role_for_projects(role, possible_projects, selected_project_ids, expiration_dates={}, can_manage_permission_forms={})
Method x_button_for
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def x_button_for(component, verb, image = verb, params = {}, run_as = nil)
Method search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def search(search, page, user, includes={}, policy_scope=nil)
Method materials_collection_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def materials_collection_data(name,
materials,
assigned_to_class,
include_related = 0,
skip_lightbox_reloads = false)
Function showModal
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const showModal = function (modalId: any, specialMsg: any, fixedPosition: any, closeFunc: any, modalCloseable: any) {
Identical blocks of code found in 3 locations. Consider refactoring. Open
def self.from_csv_file
body = File.open(self.csv_filemame).read
csv = CSV.new(body, :headers => true, :header_converters => :symbol, :converters => [:all])
hashes = csv.to_a.map {|row| row.to_hash }
hashes.map! { |h| from_hash(remap_keys(h)) }
- 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 36.
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