Showing 317 of 317 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
cols = ([x for i, x in enumerate(res['cols'])
if x.upper() != 'NONE'] + ['id'])
- 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 34.
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
Function write
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def write(self, cr, uid, ids, vals, context=None):
Function write
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def write(self, cr, uid, ids, vals, context=None):
Function map_ldap_attributes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def map_ldap_attributes(self, cr, uid, conf, login, ldap_entry):
Function datetime_formatter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def datetime_formatter(self, value, lang=None, template=MODE_DATETIME,
Function text_from_html
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def text_from_html(self, html_content, max_words=None, max_chars=None,
Function _create_qweb
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_qweb(self, name, qweb_name, module, model, arch):
Function do_deactivate_unknown_users
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def do_deactivate_unknown_users(
Function search_matches
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def search_matches(self, cr, uid, conf, mail_message, mail_message_org):
Function search_matches
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def search_matches(self, cr, uid, conf, mail_message, mail_message_org):
Function field_to_populate_as_related
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def field_to_populate_as_related(self, cr, uid, field, company_cols, context=None):
Function get_email_template
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_email_template(self, cr, uid, template_id=False, record_id=None,
Function create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(self, cr, uid, vals, context=None, **kwargs):
Function attach_mail
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def attach_mail(self, connection, object_id, folder, mail_message, msgid):
Function equals
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def equals(self, ldap_entry, attribute, value, ldap_config, company):
Function copy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def copy(self, cr, uid, id, default=None, context=None):
Function onchange_company_id
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def onchange_company_id(self, cr, uid, ids, company_id, context=None):
Function _get_graphical_representation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_graphical_representation(
Function contains
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def contains(self, ldap_entry, attribute, value, ldap_config, company):
Function write
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def write(self, cr, uid, ids, vals, context=None):