Ensure consistent formatting patterns and styles throughout the codebase, both when writing new code and refactoring existing code. When making style improvements or refactoring, preserve the original behavior while applying consistent formatting standards.
Ensure consistent formatting patterns and styles throughout the codebase, both when writing new code and refactoring existing code. When making style improvements or refactoring, preserve the original behavior while applying consistent formatting standards.
Key principles:
Example of inconsistent formatting to avoid:
# Inconsistent f-string spacing and multi-line formatting
print(f"{i}: ", failure_message["benchmark"]) # Note the space after colon
# vs elsewhere in code:
print(f"{i}. ", other_message) # Note the period and different spacing
# Inconsistent multi-line string formatting
print('''single line approach''')
# vs
print(
'''
multi-line
approach
'''
)
Example of consistent formatting:
# Consistent f-string spacing
print(f"{i}: {failure_message['benchmark']}")
print(f"{j}: {other_message}")
# Consistent multi-line formatting approach
print("""
====================================================
================ FAILURES SUMMARY ================
====================================================
""")
When refactoring substantial portions of code, break changes into separate commits to clearly distinguish between behavioral changes and pure style improvements, making it easier to verify that the original functionality is preserved.
Enter the URL of a public GitHub repository