Showing 317 of 317 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
if is_true(os.environ.get('ODOO_LOGGING_JSON')):
format = ('%(asctime)s %(pid)s %(levelname)s'
'%(dbname)s %(name)s: %(message)s')
formatter = OdooJsonFormatter(format)
logging.getLogger().handlers[0].formatter = formatter
- 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 copy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def copy(self, cr, uid, id, default=None, context=None):
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 search_matches
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def search_matches(self, cr, uid, conf, mail_message, mail_message_org):
Function _create_qweb
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_qweb(self, name, qweb_name, module, model, arch):
Function equals
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def equals(self, ldap_entry, attribute, value, ldap_config, company):
Function contains
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def contains(self, ldap_entry, attribute, value, ldap_config, company):
Function datetime_formatter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def datetime_formatter(self, value, lang=None, template=MODE_DATETIME,
Function create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(self, cr, uid, ids, data, context=None):
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 attach_mail
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def attach_mail(self, connection, object_id, folder, mail_message, msgid):
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 do_deactivate_unknown_users
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def do_deactivate_unknown_users(
Function query
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def query(self, ldap_entry, attribute, value, ldap_config, company):
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 write
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def write(self, cr, uid, ids, vals, context=None):
Function create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(self, cr, uid, vals, context=None, **kwargs):
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,