instruction stringclasses 3
values | input stringlengths 49 438 | output dict |
|---|---|---|
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | Code:
1. a = 5
2. print(a)
3. return a
4. # This function returns a | {
"line_content": "a = 5",
"rule_violated": "1. Use Meaningful Variable Names"
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | Code:
1. count = 10
2. print(count)
3. return count
4. # This function returns the count | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | Code:
1. b = 20
2. print(b)
3. return b
4. # Return value of b | {
"line_content": "b = 20",
"rule_violated": "1. Use Meaningful Variable Names"
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | Code:
1. number = 30
2. print(number)
3. return number
4. # This function returns the number | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | Code:
1. radius = 5.0
2. area = pi * radius * radius
3. print(area)
4. # Calculate area of a circle | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | Code:
1. char = 'A'
2. print(char)
3. return char
4. # Character variable | {
"line_content": "char = 'A'",
"rule_violated": "1. Use Meaningful Variable Names"
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | Code:
1. initial = 'B'
2. print(initial)
3. return initial
4. # Initial variable | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | Code:
1. ma = 0.001
2. print(ma)
3. return ma
4. # Margin of error | {
"line_content": "ma = 0.001",
"rule_violated": "1. Use Meaningful Variable Names"
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | Code:
1. def calculate_area(radius):
2. return 3.14 * radius * radius
3.
4. area = calculate_area(5)
5. print(area) | {
"line_content": "return 3.14 * radius * radius",
"rule_violated": "3. Avoid Hard-Coding Values"
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | Code:
1. def add_numbers(x, y):
2. return x + y
3.
4. print(add_numbers(5, 10))
5. # Addition of two numbers | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the following code against the guidelines provided. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. a = 5
2. print(a)
3. return a
4. # This function returns a
5. | {
"line_content": "a = 5",
"rule_violated": "1. Use Meaningful Variable Names"
} |
Evaluate the following code against the guidelines provided. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. count = 10
2. print(count)
3. return count
4. # This function returns the count
5. | {
"line_content": "count = 10",
"rule_violated": "2. Comment Your Code"
} |
Evaluate the following code against the guidelines provided. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. b = 20
2. print(b)
3. return b
4. # Return value of b
5. | {
"line_content": "b = 20",
"rule_violated": "1. Use Meaningful Variable Names"
} |
Evaluate the following code against the guidelines provided. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. number = 30
2. print(number)
3. return number
4. # This function returns the number
5. | {
"line_content": "number = 30",
"rule_violated": "2. Comment Your Code"
} |
Evaluate the following code against the guidelines provided. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. pi = 3.14
2. print(pi)
3. return pi
4. # Pi constant
5. | {
"line_content": "pi = 3.14",
"rule_violated": "2. Comment Your Code"
} |
Evaluate the following code against the guidelines provided. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. radius = 5.0
2. area = pi * radius * radius
3. print(area)
4. # Calculate area of a circle
5. | {
"line_content": "area = 3.14 * radius * radius",
"rule_violated": "3. Avoid Hard-Coding Values"
} |
Evaluate the following code against the guidelines provided. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. char = 'A'
2. print(char)
3. return char
4. # Character variable
5. | {
"line_content": "char = 'A'",
"rule_violated": "1. Use Meaningful Variable Names"
} |
Evaluate the following code against the guidelines provided. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. ini = 'B'
2. print(ini)
3. return ini
4. # Initial variable
5. | {
"line_content": "ini = 'B'",
"rule_violated": "1. Use Meaningful Variable Names"
} |
Evaluate the following code against the guidelines provided. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def add_numbers(x, y):
2. return x + y
3.
4. print(add_numbers(5, 10))
5. # Addition of two numbers | {
"line_content": "print(add_numbers(5, 10))",
"rule_violated": "2. Comment Your Code"
} |
Evaluate the following code against the guidelines provided. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def sum(a, b):
2. return a + b
3.
4. result = sum(5, 10)
5. | {
"line_content": "return a + b",
"rule_violated": "2. Comment Your Code"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def calculate_area():
2. width = 10
3. height = 20
4. area = width * 19
5. print(f"Area: {area}") | {
"line_content": "area = width * 19",
"rule_violated": "3. Avoid Hard-Coding Values"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def calculate_area(width, height):
2. area = width * height
3. print(f"Area: {area}") | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def calculate_discount(price):
2. discount = price * 0.1
3. return price - discount | {
"line_content": "discount = price * 0.1",
"rule_violated": "3. Avoid Hard-Coding Values"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def calculate_discount(price, discount_rate):
2. discount = price * discount_rate
3. return price - discount | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def print_message():
2. print("Hello, World!") | {
"line_content": "print(\"Hello, World!\")",
"rule_violated": "2. Comment Your Code"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def print_custom_message(message):
2. print(message) | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def set_max_limit():
2. max_limit = 100
3. | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def set_max_limit(max_limit):
2. # Set the maximum limit
3. pass | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def get_year():
2. return 2024 | {
"line_content": "return 2024",
"rule_violated": "3. Avoid Hard-Coding Values"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def get_current_year():
2. current_year = get_year()
3. return current_year | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | def process_data():
sum = 0
for i in range(10):
sum += i
print(f"Sum: {sum}")
for j in range(10):
print(f"Processing: {j}") | {
"line_content": "def process_data()",
"rule_violated": "4. Keep Functions Short and Focused"
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | def calculate_sum(a, b):
sum = a + b
print(f"Sum: {sum}") | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | def generate_report():
print("Generating report...")
# Simulate a long report generation process
for i in range(100):
print(f"Processing item {i}...")
print("Report generated successfully.") | {
"line_content": "def generate_report():",
"rule_violated": "4. Keep Functions Short and Focused"
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | def display_message():
print("Hello, World!") | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | def handle_input():
input_number = int(input("Enter a number: "))
print(f"You entered: {input_number}")
# Process input
for i in range(input_number):
print(f"Counting: {i}") | {
"line_content": "def handle_input():",
"rule_violated": "4. Keep Functions Short and Focused"
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | def print_numbers(count):
for i in range(count):
print(i) | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | def manage_resources():
# Allocate resources
# Do some processing
# Free resources
print("Resources managed successfully.") | {
"line_content": "def manage_resources():",
"rule_violated": "4. Keep Functions Short and Focused"
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | def initialize():
print("Initialization...")
# Initialize various components | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | def complex_function():
a = 1
b = 2
c = 3
# Perform multiple operations
a += b
b *= c
print(f"Result: {a + b}") | {
"line_content": "def complex_function():",
"rule_violated": "4. Keep Functions Short and Focused"
} |
Evaluate the following code against the guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully | def simple_function():
a = 5
b = 10
print(f"Result: {a + b}") | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def calculate_area():
2. width = 10
3. height = 20
4. area = 11 * height
5. print(f"Area: {area}") | {
"line_content": "area = 11 * height",
"rule_violated": "3. Avoid Hard-Coding Values"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def calculate_area(width, height):
2. area = width * height
3. print(f"Area: {area}") | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def calculate_discount(price):
2. discount = price * 0.1
3. return price - discount | {
"line_content": "discount = price * 0.1",
"rule_violated": "3. Avoid Hard-Coding Values"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def calculate_discount(price, discount_rate):
2. discount = price * discount_rate
3. return price - discount | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def print_custom_message(message):
2. print(message) | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def get_year():
2. return 2000 | {
"line_content": "return 2000",
"rule_violated": "3. Avoid Hard-Coding Values"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def get_current_year():
2. current_year = get_year()
3. return current_year | {
"line_content": "",
"rule_violated": ""
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def calculate_user_age_and_salary(user_id, year):
2. user_data = get_user_data(user_id)
3. age = year - user_data['birth_year']
4. salary = u... | {
"line_content": "def calculate_user_age_and_salary(user_id, year):",
"rule_violated": "Keep Functions Short and Focused"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def fetch_and_process_user_data(user_id):
2. user_data = database.get_user(user_id)
3. data['location'] = get_location(user_data)
4. data['st... | {
"line_content": "def fetch_and_process_user_data(user_id):",
"rule_violated": "Keep Functions Short and Focused"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def validate_and_save_user(user_data):
2. if not validate_user(user_data):
3. return False
4. save_user(user_data)
5. send_notificati... | {
"line_content": "def validate_and_save_user(user_data):",
"rule_violated": "Keep Functions Short and Focused"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def load_config_and_initialize_database(config_path):
2. config = load_config(config_path)
3. db = connect_database(config)
4. setup_logging(... | {
"line_content": "def load_config_and_initialize_database(config_path):",
"rule_violated": "Keep Functions Short and Focused"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def calculate_total_and_apply_discount(cart):
2. total = sum(item['price'] * item['quantity'] for item in cart)
3. discount = get_discount(total)... | {
"line_content": "def calculate_total_and_apply_discount(cart):",
"rule_violated": "Keep Functions Short and Focused"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def fetch_user_data(user_id):
2. data = database.get(user_id)
3. return data | {
"line_content": "data = database.get(user_id)",
"rule_violated": "Handle Errors Gracefully"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def read_file(file_path):
2. file = open(file_path, 'r')
3. content = file.read()
4. return content | {
"line_content": "file = open(file_path, 'r')",
"rule_violated": "Handle Errors Gracefully"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def divide(a, b):
2. result = a / b
3. return result | {
"line_content": "result = a / b",
"rule_violated": "Handle Errors Gracefully"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def parse_json(data):
2. parsed_data = json.loads(data)
3. return parsed_data | {
"line_content": "parsed_data = json.loads(data)",
"rule_violated": "Handle Errors Gracefully"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def connect_to_server(url):
2. connection = establish_connection(url)
3. return connection | {
"line_content": "connection = establish_connection(url)",
"rule_violated": "Handle Errors Gracefully"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def calculate_discount(price):
2. discount = price * 0.1
3. return price - discount | {
"line_content": "discount = price * 0.1",
"rule_violated": "Avoid Hard-Coding Values"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def connect_to_database():
2. db_url = 'localhost:5432'
3. connection = connect(db_url)
4. return connection | {
"line_content": "db_url = 'localhost:5432'",
"rule_violated": "Avoid Hard-Coding Values"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def set_timeout():
2. timeout_seconds = 30
3. configure_timeout(timeout_seconds) | {
"line_content": "timeout_seconds = 30",
"rule_violated": "Avoid Hard-Coding Values"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def compute_tax(income):
2. tax_rate = 0.15
3. return income * tax_rate | {
"line_content": "tax_rate = 0.15",
"rule_violated": "Avoid Hard-Coding Values"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def get_shipping_cost(weight):
2. base_cost = 5
3. return weight * base_cost | {
"line_content": "base_cost = 5",
"rule_violated": "Avoid Hard-Coding Values"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def fetch_user_info(user_id):
2. info = database.get_user(user_id)
3. return info | {
"line_content": "info = database.get_user(user_id)",
"rule_violated": "Comment Your Code"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def get_discounted_price(price, discount):
2. return price - (price * discount / 100) | {
"line_content": "return price - (price * discount / 100)",
"rule_violated": "Comment Your Code"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def connect_to_api(api_url):
2. response = requests.get(api_url)
3. return response.json() | {
"line_content": "response = requests.get(api_url)",
"rule_violated": "Comment Your Code"
} |
Evaluate the code for adherence to the coding guidelines. | Guidelines:
1. Use Meaningful Variable Names
2. Comment Your Code
3. Avoid Hard-Coding Values
4. Keep Functions Short and Focused
5. Handle Errors Gracefully
Code:
1. def compute_interest(principal, rate, time):
2. interest = principal * rate * time / 100
3. return interest | {
"line_content": "interest = principal * rate * time / 100",
"rule_violated": "Comment Your Code"
} |
README.md exists but content is empty.
- Downloads last month
- 3