diff --git a/examples/real_world_bugs.py b/examples/real_world_bugs.py index affc9c3..0c423e3 100644 --- a/examples/real_world_bugs.py +++ b/examples/real_world_bugs.py @@ -19,6 +19,7 @@ # HARMONIZER SCORE: ~0.85 (!! DISHARMONY) # OTHER TOOLS: All pass ✓ + def validate_email(email: str) -> bool: """ BUG: Function claims to validate, but actually sends emails! @@ -39,15 +40,18 @@ def validate_email(email: str) -> bool: return True return False + def send_welcome_email(email): """Placeholder - in real code, this would send email""" print(f"Sending email to {email}") + # FIX: Separate validation from action def validate_email_fixed(email: str) -> bool: """Just validates, doesn't send""" return "@" in email and "." in email + def process_new_user(email: str) -> bool: """Orchestrates validation AND sending""" if validate_email_fixed(email): @@ -62,6 +66,7 @@ def process_new_user(email: str) -> bool: # HARMONIZER SCORE: ~0.95 (!! CRITICAL DISHARMONY) # OTHER TOOLS: All pass ✓ + def get_user_by_id(user_id: int): """ BUG: Function claims to GET, but actually DELETES! @@ -83,13 +88,17 @@ def get_user_by_id(user_id: int): db.execute(f"DELETE FROM users WHERE id = {user_id}") return user_id + def get_database_connection(): """Placeholder""" + class FakeDB: def execute(self, query): print(f"Executing: {query}") + return FakeDB() + # FIX: Name matches behavior def delete_user_by_id(user_id: int): """Honestly named - clearly destructive""" @@ -97,6 +106,7 @@ def delete_user_by_id(user_id: int): db.execute(f"DELETE FROM users WHERE id = {user_id}") return user_id + def get_user_by_id_fixed(user_id: int): """Actually gets without modifying""" db = get_database_connection() @@ -111,6 +121,7 @@ def get_user_by_id_fixed(user_id: int): # HARMONIZER SCORE: ~0.75 (!! DISHARMONY) # OTHER TOOLS: Might pass + def check_file_exists(filepath: str) -> bool: """ BUG: Function claims to check, but creates if missing! @@ -129,22 +140,26 @@ def check_file_exists(filepath: str) -> bool: if not os.path.exists(filepath): # VIOLATION: Check functions shouldn't create! - with open(filepath, 'w') as f: + with open(filepath, "w") as f: f.write("") return False return True + # FIX: Separate check from creation def check_file_exists_fixed(filepath: str) -> bool: """Pure check - no side effects""" import os + return os.path.exists(filepath) + def ensure_file_exists(filepath: str) -> bool: """Honest name - creates if missing""" import os + if not os.path.exists(filepath): - with open(filepath, 'w') as f: + with open(filepath, "w") as f: f.write("") return False return True @@ -156,6 +171,7 @@ def ensure_file_exists(filepath: str) -> bool: # HARMONIZER SCORE: ~0.70 (!! DISHARMONY) # OTHER TOOLS: Tests might pass if they expect side effects + def calculate_total_price(items: list) -> float: """ BUG: Function claims to calculate, but also saves to database! @@ -171,26 +187,29 @@ def calculate_total_price(items: list) -> float: - Hard to test - Violates single responsibility """ - total = sum(item['price'] for item in items) + total = sum(item["price"] for item in items) # VIOLATION: Calculate functions shouldn't persist! - save_to_database('total_price', total) + save_to_database("total_price", total) return total + def save_to_database(key, value): """Placeholder""" print(f"Saving {key} = {value} to database") + # FIX: Separate calculation from persistence def calculate_total_price_fixed(items: list) -> float: """Pure calculation - no side effects""" - return sum(item['price'] for item in items) + return sum(item["price"] for item in items) + def calculate_and_save_total_price(items: list) -> float: """Honest name - calculates AND saves""" total = calculate_total_price_fixed(items) - save_to_database('total_price', total) + save_to_database("total_price", total) return total @@ -200,6 +219,7 @@ def calculate_and_save_total_price(items: list) -> float: # HARMONIZER SCORE: ~0.80 (!! DISHARMONY) # OTHER TOOLS: Hard to catch without semantic analysis + def read_configuration(config_file: str) -> dict: """ BUG: Function claims to read, but updates last_accessed timestamp! @@ -217,7 +237,7 @@ def read_configuration(config_file: str) -> dict: """ import json - with open(config_file, 'r') as f: + with open(config_file, "r") as f: config = json.load(f) # VIOLATION: Read functions shouldn't modify! @@ -225,18 +245,23 @@ def read_configuration(config_file: str) -> dict: return config + def update_last_accessed_timestamp(filepath): """Placeholder""" import time + print(f"Updating timestamp for {filepath} to {time.time()}") + # FIX: Either truly read-only OR honest name def read_configuration_fixed(config_file: str) -> dict: """Pure read - no side effects""" import json - with open(config_file, 'r') as f: + + with open(config_file, "r") as f: return json.load(f) + def read_and_track_configuration(config_file: str) -> dict: """Honest name - reads AND tracks access""" config = read_configuration_fixed(config_file) @@ -250,6 +275,7 @@ def read_and_track_configuration(config_file: str) -> dict: # HARMONIZER SCORE: ~0.90 (!! CRITICAL DISHARMONY) # OTHER TOOLS: Might not catch unless tests verify original list unchanged + def filter_invalid_users(users: list) -> list: """ BUG: Function claims to filter (read), but deletes from database! @@ -270,32 +296,35 @@ def filter_invalid_users(users: list) -> list: valid_users = [] for user in users: - if user['email'] and user['name']: + if user["email"] and user["name"]: valid_users.append(user) else: # VIOLATION: Filter shouldn't delete from DB! - delete_user_from_database(user['id']) + delete_user_from_database(user["id"]) return valid_users + def delete_user_from_database(user_id): """Placeholder""" print(f"DELETING user {user_id} from database!") + # FIX: Separate filtering from deletion def filter_invalid_users_fixed(users: list) -> list: """Pure filter - no side effects""" - return [u for u in users if u['email'] and u['name']] + return [u for u in users if u["email"] and u["name"]] + def remove_invalid_users(users: list) -> list: """Honest name - filters AND deletes from database""" valid_users = [] for user in users: - if user['email'] and user['name']: + if user["email"] and user["name"]: valid_users.append(user) else: - delete_user_from_database(user['id']) + delete_user_from_database(user["id"]) return valid_users @@ -306,6 +335,7 @@ def remove_invalid_users(users: list) -> list: # HARMONIZER SCORE: ~0.65 (!! DISHARMONY) # OTHER TOOLS: Tests might catch if they expect no exceptions + def log_error_message(message: str): """ BUG: Function claims to log, but raises exception! @@ -326,11 +356,13 @@ def log_error_message(message: str): if "critical" in message.lower(): raise RuntimeError(f"Critical error: {message}") + # FIX: Either log OR raise, not both under "log" name def log_error_message_fixed(message: str): """Just logs - never raises""" print(f"ERROR: {message}") + def handle_error_message(message: str): """Honest name - logs AND may raise""" print(f"ERROR: {message}") diff --git a/examples/refactoring_journey.py b/examples/refactoring_journey.py index 1b9b3dc..c1226dd 100644 --- a/examples/refactoring_journey.py +++ b/examples/refactoring_journey.py @@ -16,14 +16,15 @@ # JOURNEY #1: User Management Refactoring # ============================================================================= -print("\n" + "="*70) +print("\n" + "=" * 70) print("JOURNEY #1: From 'process' to clear intent") -print("="*70) +print("=" * 70) # ----------------------------------------------------------------------------- # BEFORE - Disharmony Score: ~0.75 # ----------------------------------------------------------------------------- + def process_user(user_data): """ PROBLEM: 'process' is vague @@ -43,10 +44,11 @@ def process_user(user_data): save_to_database(user) # Sends welcome email - send_welcome_email(user['email']) + send_welcome_email(user["email"]) return user + # ----------------------------------------------------------------------------- # REFACTORING STEPS # ----------------------------------------------------------------------------- @@ -64,6 +66,7 @@ def process_user(user_data): # AFTER - Disharmony Score: ~0.15 (Excellent!) # ----------------------------------------------------------------------------- + def register_new_user(user_data): """ SOLUTION: Name describes exact behavior @@ -80,7 +83,7 @@ def register_new_user(user_data): """ user = create_user_record(user_data) save_to_database(user) - send_welcome_email(user['email']) + send_welcome_email(user["email"]) return user @@ -88,14 +91,15 @@ def register_new_user(user_data): # JOURNEY #2: Data Retrieval Refactoring # ============================================================================= -print("\n" + "="*70) +print("\n" + "=" * 70) print("JOURNEY #2: From misleading to honest") -print("="*70) +print("=" * 70) # ----------------------------------------------------------------------------- # BEFORE - Disharmony Score: ~0.90 (Critical!) # ----------------------------------------------------------------------------- + def get_user_settings(user_id): """ PROBLEM: Says 'get' but actually modifies! @@ -123,6 +127,7 @@ def get_user_settings(user_id): return settings + # ----------------------------------------------------------------------------- # REFACTORING STEPS # ----------------------------------------------------------------------------- @@ -135,6 +140,7 @@ def get_user_settings(user_id): # AFTER - Disharmony Score: ~0.10 (Excellent!) # ----------------------------------------------------------------------------- + def get_user_settings(user_id): """ SOLUTION: Pure read operation @@ -146,6 +152,7 @@ def get_user_settings(user_id): """ return query_settings_from_db(user_id) + def track_settings_access(user_id): """ SOLUTION: Separate tracking function @@ -158,6 +165,7 @@ def track_settings_access(user_id): update_last_login(user_id) increment_analytics_counter(user_id) + def get_and_track_settings(user_id): """ SOLUTION: Orchestrator with honest name @@ -176,14 +184,15 @@ def get_and_track_settings(user_id): # JOURNEY #3: Validation Logic Refactoring # ============================================================================= -print("\n" + "="*70) +print("\n" + "=" * 70) print("JOURNEY #3: From overgrown to focused") -print("="*70) +print("=" * 70) # ----------------------------------------------------------------------------- # BEFORE - Disharmony Score: ~0.70 # ----------------------------------------------------------------------------- + def validate_input(data): """ PROBLEM: Function grew beyond its name @@ -217,6 +226,7 @@ def validate_input(data): return True + # ----------------------------------------------------------------------------- # REFACTORING STEPS # ----------------------------------------------------------------------------- @@ -229,6 +239,7 @@ def validate_input(data): # AFTER - Disharmony Scores: All ~0.05-0.20 (Excellent!) # ----------------------------------------------------------------------------- + def validate_input(data): """ SOLUTION: Pure validation @@ -245,6 +256,7 @@ def validate_input(data): return False return True + def sanitize_input(data): """ SOLUTION: Pure sanitization @@ -256,6 +268,7 @@ def sanitize_input(data): """ return sanitize_sql_injection(data) + def format_input(data): """ SOLUTION: Pure formatting @@ -267,6 +280,7 @@ def format_input(data): """ return format_to_lowercase(data) + def process_user_input(data): """ SOLUTION: Orchestrator with honest name @@ -290,14 +304,15 @@ def process_user_input(data): # JOURNEY #4: Resource Management Refactoring # ============================================================================= -print("\n" + "="*70) +print("\n" + "=" * 70) print("JOURNEY #4: From surprising to expected") -print("="*70) +print("=" * 70) # ----------------------------------------------------------------------------- # BEFORE - Disharmony Score: ~0.80 # ----------------------------------------------------------------------------- + def check_cache_available(cache_key): """ PROBLEM: Hidden side effect @@ -325,6 +340,7 @@ def check_cache_available(cache_key): return False + # ----------------------------------------------------------------------------- # REFACTORING STEPS # ----------------------------------------------------------------------------- @@ -337,6 +353,7 @@ def check_cache_available(cache_key): # AFTER - Disharmony Scores: ~0.05-0.15 (Excellent!) # ----------------------------------------------------------------------------- + def check_cache_available(cache_key): """ SOLUTION: Pure check @@ -348,6 +365,7 @@ def check_cache_available(cache_key): """ return cache_key in cache_store + def initialize_cache_if_missing(cache_key): """ SOLUTION: Explicit initialization @@ -362,6 +380,7 @@ def initialize_cache_if_missing(cache_key): create_default_values(cache_key) return True + def ensure_cache_ready(cache_key): """ SOLUTION: Alternative with clear intent @@ -380,14 +399,15 @@ def ensure_cache_ready(cache_key): # JOURNEY #5: API Endpoint Refactoring # ============================================================================= -print("\n" + "="*70) +print("\n" + "=" * 70) print("JOURNEY #5: From overloaded to specialized") -print("="*70) +print("=" * 70) # ----------------------------------------------------------------------------- # BEFORE - Disharmony Score: ~0.85 # ----------------------------------------------------------------------------- + def handle_request(request_data): """ PROBLEM: One function doing everything @@ -421,6 +441,7 @@ def handle_request(request_data): return response + # ----------------------------------------------------------------------------- # REFACTORING STEPS # ----------------------------------------------------------------------------- @@ -433,26 +454,32 @@ def handle_request(request_data): # AFTER - Disharmony Scores: All ~0.05-0.20 (Excellent!) # ----------------------------------------------------------------------------- + def parse_request(request_data): """Stage 1: Parsing""" return parse_json(request_data) + def validate_request(data): """Stage 2: Validation""" return is_valid(data) + def execute_request(data): """Stage 3: Business logic""" return execute_business_logic(data) + def format_response(result): """Stage 4: Response formatting""" return format_json_response(result) + def log_request_processed(request_data): """Side effect: Logging""" log_request(request_data) + def process_api_request(request_data): """ SOLUTION: Clear orchestration @@ -484,58 +511,78 @@ def process_api_request(request_data): # Placeholder Functions (for examples to run) # ============================================================================= + def create_user_record(data): return {"id": 1, "email": data.get("email", "test@example.com")} + def save_to_database(user): print(f"Saving user {user['id']} to database") + def send_welcome_email(email): print(f"Sending welcome email to {email}") + def query_settings_from_db(user_id): return {"theme": "dark", "language": "en"} + def update_last_login(user_id): print(f"Updating last login for user {user_id}") + def increment_analytics_counter(user_id): print(f"Incrementing analytics for user {user_id}") + def log_validation_error(message): print(f"VALIDATION ERROR: {message}") + def sanitize_sql_injection(data): return data.replace("'", "''") + def format_to_lowercase(data): return data.lower() + cache_store = {} + def initialize_cache(key): cache_store[key] = {} + def create_default_values(key): cache_store[key] = {"default": True} + def parse_json(data): import json + return json.loads(data) if isinstance(data, str) else data + def is_valid(data): return bool(data) + def execute_business_logic(data): return {"status": "success", "data": data} + def format_json_response(result): import json + return json.dumps(result) + def error_response(message): return {"error": message} + def log_request(data): print(f"Logging request: {data}") @@ -618,9 +665,9 @@ def log_request(data): # ============================================================================= if __name__ == "__main__": - print("\n" + "="*70) + print("\n" + "=" * 70) print("REFACTORING JOURNEY DEMO") - print("="*70) + print("=" * 70) print("\nThis file shows before/after refactoring examples.") print("\nRun: harmonizer examples/refactoring_journey.py") print("\nNotice:") @@ -628,4 +675,4 @@ def log_request(data): print(" - 'AFTER' functions have lower scores") print(" - Score improvement shows semantic alignment") print("\nKey insight: Good refactoring reduces semantic distance!") - print("="*70 + "\n") + print("=" * 70 + "\n") diff --git a/examples/severity_levels.py b/examples/severity_levels.py index df349b5..b8d4267 100644 --- a/examples/severity_levels.py +++ b/examples/severity_levels.py @@ -20,9 +20,10 @@ # Name matches implementation beautifully. # No action needed - keep this quality! -print("\n" + "="*70) +print("\n" + "=" * 70) print("EXCELLENT HARMONY (0.0 - 0.3)") -print("="*70) +print("=" * 70) + def create_user_account(username, email): """ @@ -39,6 +40,7 @@ def create_user_account(username, email): initialize_user_preferences(user_data) return user_data + def calculate_total_amount(items): """ Expected score: ~0.08 @@ -49,7 +51,8 @@ def calculate_total_amount(items): - Pure calculation, no side effects - Self-documenting code ✓ """ - return sum(item['price'] for item in items) + return sum(item["price"] for item in items) + def validate_email_format(email): """ @@ -61,7 +64,8 @@ def validate_email_format(email): - Returns boolean - No modifications ✓ """ - return '@' in email and '.' in email.split('@')[1] + return "@" in email and "." in email.split("@")[1] + def delete_temporary_files(directory): """ @@ -74,10 +78,12 @@ def delete_temporary_files(directory): - No surprises ✓ """ import os + for file in os.listdir(directory): - if file.endswith('.tmp'): + if file.endswith(".tmp"): remove_file(os.path.join(directory, file)) + def query_user_by_id(user_id): """ Expected score: ~0.15 @@ -88,7 +94,7 @@ def query_user_by_id(user_id): - Read-only operation - Returns data ✓ """ - return fetch_from_database('users', user_id) + return fetch_from_database("users", user_id) # ============================================================================= @@ -98,9 +104,10 @@ def query_user_by_id(user_id): # Consider refactoring if you have time. # Monitor to prevent drift. -print("\n" + "="*70) +print("\n" + "=" * 70) print("LOW CONCERN (0.3 - 0.5)") -print("="*70) +print("=" * 70) + def process_payment(payment_data): """ @@ -117,6 +124,7 @@ def process_payment(payment_data): record_transaction(payment_data) return True + def get_or_create_session(user_id): """ Expected score: ~0.40 @@ -132,6 +140,7 @@ def get_or_create_session(user_id): session = create_new_session(user_id) return session + def update_user_profile(user_id, data): """ Expected score: ~0.38 @@ -147,6 +156,7 @@ def update_user_profile(user_id, data): merged = merge_profile_data(current, data) save_profile(user_id, merged) + def handle_error_gracefully(error): """ Expected score: ~0.42 @@ -161,6 +171,7 @@ def handle_error_gracefully(error): formatted = format_error_message(error) return formatted + def check_and_initialize_config(config_path): """ Expected score: ~0.45 @@ -183,9 +194,10 @@ def check_and_initialize_config(config_path): # Should refactor when you can. # Potential for confusion and bugs. -print("\n" + "="*70) +print("\n" + "=" * 70) print("MEDIUM CONCERN (0.5 - 0.8)") -print("="*70) +print("=" * 70) + def validate_user_credentials(username, password): """ @@ -203,6 +215,7 @@ def validate_user_credentials(username, password): update_last_login(username) return is_valid + def get_user_preferences(user_id): """ Expected score: ~0.60 @@ -220,6 +233,7 @@ def get_user_preferences(user_id): save_preferences(user_id, prefs) return prefs + def calculate_and_cache_result(input_data): """ Expected score: ~0.58 @@ -235,6 +249,7 @@ def calculate_and_cache_result(input_data): store_in_cache(input_data, result) return result + def process_order(order_data): """ Expected score: ~0.65 @@ -251,6 +266,7 @@ def process_order(order_data): send_confirmation_email(order_data) return True + def load_configuration_file(filepath): """ Expected score: ~0.62 @@ -275,9 +291,10 @@ def load_configuration_file(filepath): # Refactor immediately. # High risk of bugs and confusion. -print("\n" + "="*70) +print("\n" + "=" * 70) print("HIGH CONCERN (0.8 - 1.0)") -print("="*70) +print("=" * 70) + def read_log_file(logfile_path): """ @@ -290,7 +307,7 @@ def read_log_file(logfile_path): - Reality: File gets cleared! - FIX: Rename to 'read_and_clear_log' OR remove clearing """ - with open(logfile_path, 'r') as f: + with open(logfile_path, "r") as f: contents = f.read() # VIOLATION: Read shouldn't clear! @@ -298,6 +315,7 @@ def read_log_file(logfile_path): return contents + def check_inventory_level(product_id): """ Expected score: ~0.85 @@ -316,6 +334,7 @@ def check_inventory_level(product_id): return level + def log_transaction(transaction_data): """ Expected score: ~0.88 @@ -330,9 +349,10 @@ def log_transaction(transaction_data): write_to_log(transaction_data) # VIOLATION: Log shouldn't raise! - if transaction_data['amount'] > 10000: + if transaction_data["amount"] > 10000: raise ValueError("Transaction too large!") + def filter_active_users(users_list): """ Expected score: ~0.90 @@ -346,14 +366,15 @@ def filter_active_users(users_list): """ active = [] for user in users_list: - if user['is_active']: + if user["is_active"]: active.append(user) else: # VIOLATION: Filter shouldn't delete from DB! - delete_from_database(user['id']) + delete_from_database(user["id"]) return active + def get_cache_value(cache_key): """ Expected score: ~0.87 @@ -382,9 +403,10 @@ def get_cache_value(cache_key): # **IMMEDIATE ACTION REQUIRED** # Very high risk - could cause data loss or security issues. -print("\n" + "="*70) +print("\n" + "=" * 70) print("CRITICAL CONCERN (1.0+)") -print("="*70) +print("=" * 70) + def validate_password(password): """ @@ -404,6 +426,7 @@ def validate_password(password): return False return True + def get_user_data(user_id): """ Expected score: ~1.02 @@ -422,6 +445,7 @@ def get_user_data(user_id): return user + def save_preferences(user_id, preferences): """ Expected score: ~0.98 @@ -439,6 +463,7 @@ def save_preferences(user_id, preferences): # Privacy issue: saving preferences shouldn't notify others send_email_to_all_admins(f"User {user_id} changed preferences") + def query_database(sql_query): """ Expected score: ~1.10 @@ -456,6 +481,7 @@ def query_database(sql_query): return fetch_results() + def check_permission(user_id, resource): """ Expected score: ~1.15 @@ -480,150 +506,199 @@ def check_permission(user_id, resource): # Placeholder Functions # ============================================================================= + def build_user_object(username, email): return {"username": username, "email": email} + def save_to_database(data): print(f"Saving to database: {data}") + def initialize_user_preferences(user): print(f"Initializing preferences for {user['username']}") + def remove_file(filepath): print(f"Removing file: {filepath}") + def fetch_from_database(table, id): return {"id": id, "data": "sample"} + def validate_payment_data(data): return True + def charge_credit_card(data): print("Charging credit card") + def record_transaction(data): print("Recording transaction") + def get_existing_session(user_id): return None + def create_new_session(user_id): return {"user_id": user_id, "session_id": "abc123"} + def validate_profile_data(data): return True + def get_user_profile(user_id): return {"name": "User"} + def merge_profile_data(current, new): return {**current, **new} + def save_profile(user_id, data): print(f"Saving profile for user {user_id}") + def log_error_to_file(error): print(f"Logging error: {error}") + def format_error_message(error): return str(error) + def config_exists(path): return False + def initialize_default_config(path): print(f"Initializing config at {path}") + def load_config(path): return {"setting": "value"} + def check_credentials(username, password): return True + def update_last_login(username): print(f"Updating last login for {username}") + def fetch_preferences(user_id): return None + def create_default_preferences(user_id): return {"theme": "light"} + def save_preferences(user_id, prefs): print(f"Saving preferences for user {user_id}") + def perform_calculation(data): return 42 + def store_in_cache(key, value): print(f"Caching {key} = {value}") + def validate_order(data): print("Validating order") + def charge_payment(data): print("Charging payment") + def ship_items(data): print("Shipping items") + def send_confirmation_email(data): print("Sending confirmation email") + def parse_config_file(path): return {} + def apply_default_values(config): return config + def save_config_file(path, config): print(f"Saving config to {path}") + def clear_log_file(path): print(f"CLEARING log file: {path}") + def get_inventory_count(product_id): return 5 + def trigger_reorder(product_id): print(f"TRIGGERING REORDER for product {product_id}") + def write_to_log(data): print(f"Logging: {data}") + def delete_from_database(id): print(f"DELETING from database: ID {id}") + cache = {} + def fetch_from_external_api(key): print(f"FETCHING from external API: {key}") return "api_value" + def delete_user_account_for_weak_password(): print("CATASTROPHIC: DELETING USER ACCOUNT!") + def fetch_user(user_id): return {"id": user_id, "name": "User"} + def delete_user_from_database(user_id): print(f"CATASTROPHIC: DELETING USER {user_id}!") + def store_preferences(user_id, prefs): print(f"Storing preferences for {user_id}") + def send_email_to_all_admins(message): print(f"SENDING EMAIL TO ADMINS: {message}") + def execute_raw_sql(query): print(f"EXECUTING RAW SQL: {query}") + def fetch_results(): return [] + def verify_user_access(user_id, resource): return False + def grant_admin_privileges(user_id): print(f"SECURITY VIOLATION: GRANTING ADMIN TO {user_id}!") @@ -691,9 +766,9 @@ def grant_admin_privileges(user_id): # ============================================================================= if __name__ == "__main__": - print("\n" + "="*70) + print("\n" + "=" * 70) print("SEVERITY LEVELS DEMONSTRATION") - print("="*70) + print("=" * 70) print("\nThis file contains functions at every severity level:") print("\n 📗 EXCELLENT (0.0-0.3): Perfect alignment") print(" 📘 LOW (0.3-0.5): Minor issues") @@ -702,4 +777,4 @@ def grant_admin_privileges(user_id): print(" 🔥 CRITICAL (1.0+): EMERGENCIES") print("\nRun: harmonizer examples/severity_levels.py") print("\nUse this as a reference for prioritizing refactoring!") - print("="*70 + "\n") + print("=" * 70 + "\n")