36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
from odoo import models, fields, api
|
|
import sys # Unused import - will trigger F401
|
|
|
|
class EventErrorTest(models.Model):
|
|
_name = 'event.error.test'
|
|
_description = 'Test Model with Errors'
|
|
|
|
name = fields.Char(string='Name', required=True)
|
|
|
|
# ERROR 1: Syntax error - missing colon after function definition
|
|
def broken_method(self)
|
|
return "This will cause syntax error"
|
|
|
|
# ERROR 2: Line too long (PEP8 E501)
|
|
description = fields.Text(string='This is an extremely long field description that definitely exceeds the maximum line length of 79 characters recommended by PEP8 style guide')
|
|
|
|
# ERROR 3: Undefined variable
|
|
def process_data(self):
|
|
result = undefined_variable_name + 10 # F821: undefined name
|
|
return result
|
|
|
|
# ERROR 4: Unused variable
|
|
def calculate(self):
|
|
unused_var = 100 # F841: local variable assigned but never used
|
|
return 50
|
|
|
|
# ERROR 5: Multiple statements on one line (E701)
|
|
def compact(self): x = 1; y = 2; return x + y
|
|
|
|
# ERROR 6: Trailing whitespace (W291)
|
|
status = fields.Selection([('draft', 'Draft'), ('done', 'Done')])
|
|
|
|
# ERROR 7: Missing whitespace around operator (E225)
|
|
count=fields.Integer(default=0)
|