Skip to content

Conversation

@DogukanUrker
Copy link
Owner

@DogukanUrker DogukanUrker commented Jul 11, 2025

Fixes #187

Last Run

Summary by CodeRabbit

  • Refactor

    • Standardized all variable, function, route, template, and form field names to use snake_case instead of camelCase for improved consistency and readability.
    • Updated database column and table names to snake_case throughout the application.
    • Reorganized and renamed error handler and context processor utilities for clarity.
    • Improved logging configuration options and updated logging parameter names.
  • New Features

    • Added support for logging to a JSON file with configurable options.
    • Introduced new and updated utility functions and error handlers using snake_case naming.
  • Bug Fixes

    • Corrected form field and template variable references to match backend expectations, reducing potential input or rendering errors.
  • Chores

    • Updated and reordered dependencies with explicit version constraints.
    • Enhanced .gitignore rules for log files and directories.
  • Documentation

    • Updated docstrings and comments to reflect new naming conventions and clarify functionality.
  • Revert

    • Removed deprecated camelCase-named modules, routes, and utility files, replacing them with updated snake_case versions.

@DogukanUrker DogukanUrker self-assigned this Jul 11, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 11, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update performs a comprehensive refactor across the codebase, systematically renaming all camelCase and PascalCase identifiers—including variables, functions, classes, blueprints, form fields, database columns, and template variables—to snake_case. It also updates all related references, SQL queries, and URL paths for consistency. No core logic or control flow is changed.

Changes

Files/Groups Change Summary
app/app.py, app/routes/.py, app/utils/.py, app/utils/context_processor/* All variables, functions, classes, blueprints, form fields, and imports renamed from camelCase/PascalCase to snake_case. All references, SQL queries, and session keys updated accordingly.
app/utils/delete.py Delete class removed; methods converted to standalone snake_case functions.
app/utils/get_analytics_page_data.py, app/utils/get_post_url_id_from_post.py, app/utils/terminal_ascii.py New modules added with snake_case naming and functions.
app/utils/getAnalyticsPageData.py, app/utils/getPostUrlIdFromPost.py, app/utils/terminalASCII.py Old modules with camelCase naming removed.
app/utils/contextProcessor/, app/utils/errorHandlers/ Old context processor and error handler modules removed (camelCase).
app/utils/context_processor/, app/utils/error_handlers/ New context processor and error handler modules added (snake_case).
app/utils/forms/*.py All form field attributes renamed from camelCase to snake_case.
app/templates/.html, app/templates/components/.html All template variable, macro, function, and URL references updated to snake_case.
app/settings.py Added LOG_TO_JSON and LOG_JSON_ROOT settings; APP_NAME capitalization fixed.
app/pyproject.toml Dependency versions updated and reordered.
.gitignore Ignore pattern for logs changed from *.log to log/; formatting adjusted.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Browser
    participant FlaskApp
    participant Database

    User->>Browser: Interacts (form submit, navigation)
    Browser->>FlaskApp: Sends HTTP request (snake_case route/params)
    FlaskApp->>Database: Queries/updates (snake_case columns)
    Database-->>FlaskApp: Returns data
    FlaskApp->>Browser: Renders template (snake_case variables/macros)
    Browser-->>User: Displays response
Loading

Assessment against linked issues

Objective Addressed Explanation
Rename all code identifiers, variables, functions, classes, blueprints, form fields, database columns, template variables, and references from camelCase/PascalCase to snake_case (#187)
Update all SQL queries, session keys, and URL paths to use snake_case (#187)
Remove/replace old modules and context processors with snake_case versions (#187)
Ensure templates and macros use snake_case for all variables and references (#187)

Poem

🐇
Refactor hop, a codebase sweep,
From camel humps, to snake_case deep.
Blueprints, forms, and routes align,
Database columns, all in line.
Templates, too, now clearly named,
The code’s new look—consistency claimed!
🐍✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch camelCase-to-snake_case

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@DogukanUrker DogukanUrker changed the title Camel case to snake case EPIC: camelCase --> snake_case Jul 11, 2025
@DogukanUrker
Copy link
Owner Author

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Jul 13, 2025

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 18

🔭 Outside diff range comments (6)
app/utils/forms/PasswordResetForm.py (1)

42-48: Add an EqualTo validator so password_confirm actually confirms

Without matching validation the confirm field is unchecked, letting divergent passwords through.

-    password_confirm = PasswordField(
-        "password_confirm",
-        [
-            validators.Length(min=8),
-            validators.InputRequired(),
-        ],
-    )
+    password_confirm = PasswordField(
+        "Confirm Password",
+        [
+            validators.Length(min=8),
+            validators.InputRequired(),
+            validators.EqualTo("password", message="Passwords must match"),
+        ],
+    )
app/utils/get_post_url_id_from_post.py (1)

1-35: Incorrect arguments passed to get_post_url_id_from_post in context processor

The wrapper in app/utils/context_processor/return_post_url_id.py is calling the helper with (title, content) instead of the expected single post_id: int. Update the function signature and call site:

• File: app/utils/context_processor/return_post_url_id.py

- def url_id(title, content):
-     return get_post_url_id_from_post(title, content)
+ def url_id(post_id: int):
+     return get_post_url_id_from_post(post_id)

Ensure any templates or code that invoke url_id now pass the post’s ID rather than its title and content.

app/routes/privacy_policy.py (1)

20-22: Template references still use camelCase naming.

The log message and template name still reference "privacyPolicy.html" while the route function has been renamed to snake_case. This creates an inconsistency.

-    Log.info("Rendering privacyPolicy.html")
+    Log.info("Rendering privacy_policy.html")

-    return render_template("privacyPolicy.html")
+    return render_template("privacy_policy.html")
app/routes/admin_panel_comments.py (1)

28-31: Template reference still uses camelCase naming.

The log message and template name still reference "adminPanelComments.html" while the route function has been renamed to snake_case, creating an inconsistency.

-        Log.info(f"Rendering adminPanelComments.html: params: comments={comments}")
+        Log.info(f"Rendering admin_panel_comments.html: params: comments={comments}")

         return render_template(
-            "adminPanelComments.html",
+            "admin_panel_comments.html",
             comments=comments,
             page=page,
             total_pages=total_pages,
app/routes/search_bar.py (1)

16-17: Rename template to snake_case and update references

The template file remains in camelCase while the route and filename use snake_case.

• Rename app/templates/searchBar.htmlapp/templates/search_bar.html
• Update usages in app/routes/search_bar.py (around lines 16–17):

-   Log.info("Rendering searchBar.html")
-   return render_template("searchBar.html")
+   Log.info("Rendering search_bar.html")
+   return render_template("search_bar.html")
app/routes/admin_panel_users.py (1)

57-57: Inconsistent template naming: migrate to snake_case

The template file is currently named adminPanelUsers.html, which conflicts with the snake_case convention of this route. Rename the template and update all references for consistency.

• Rename file

  • app/templates/adminPanelUsers.htmlapp/templates/admin_panel_users.html

• Update references in app/routes/admin_panel_users.py

  • Line 57:
    - Log.info(f"Rendering adminPanelUsers.html: params: users={users}")
    + Log.info(f"Rendering admin_panel_users.html: params: users={users}")
  • Line 60 (template rendering):
    - return render_template("adminPanelUsers.html", users=users)
    + return render_template("admin_panel_users.html", users=users)
🧹 Nitpick comments (15)
app/templates/components/changeTheme.html (1)

15-259: Long-hand theme list = high maintenance – generate it with a loop

The 40 × <li><a href="{{ url_for('set_theme.set_theme', theme='…') }}"> blocks are repetitive and error-prone. Build the list in Python (or inside the template) and iterate:

{% set themes = [
    'light', 'dark', 'cupcake', 'bumblebee', 'emerald', 'corporate',
    'synthwave', 'retro', 'cyberpunk', 'valentine', 'halloween', 'garden',
    'forest', 'aqua', 'lofi', 'pastel', 'fantasy', 'wireframe', 'black',
    'luxury', 'dracula', 'cmyk', 'autumn', 'business', 'acid', 'lemonade',
    'night', 'coffee', 'winter', 'dim', 'nord', 'sunset', 'caramellatte',
    'abyss', 'silk'
] %}
{% for t in themes %}
<li><a href="{{ url_for('set_theme.set_theme', theme=t) }}" role="menuitem">{{ t|capitalize }}</a></li>
{% endfor %}

Benefits: single source of truth, easier to add/remove themes, no risk of partially-updated links during future refactors.

app/utils/forms/ChangeProfilePictureForm.py (1)

18-18: Consider updating the label for consistency.

The label "ProfilePictureSeed" could be updated to "Profile Picture Seed" or "profile_picture_seed" for consistency with the snake_case naming convention.

-        "ProfilePictureSeed",
+        "Profile Picture Seed",
app/utils/translations.py (1)

18-20: Consider improving variable naming for clarity.

The variable name file is reused for both the file path string (line 18) and the file object (line 20). While technically valid, this reduces code readability.

Consider using more descriptive names:

-    file = f"./translations/{language}.json"
-    if exists(file):
-        with open(file, "r", encoding="utf-8") as file:
+    file_path = f"./translations/{language}.json"
+    if exists(file_path):
+        with open(file_path, "r", encoding="utf-8") as file:
app/utils/calculate_read_time.py (1)

14-16: Prefer math.ceil over round to avoid under-estimating reading time

round(word_count / 200) can round down for values ≥ 0.5 (e.g., 250 words → 1 min), under-estimating. ceil gives the more common “at least N minutes” UX.

-from re import sub
+from re import sub
+from math import ceil
@@
-    reading_time = max(1, round(word_count / 200))
+    reading_time = max(1, ceil(word_count / 200))
app/templates/components/sortMenu.html (1)

1-1: Rename macro to sort_menu for full snake_case consistency

The PR goal is camelCase → snake_case, yet the macro remains sortMenu. Renaming avoids mixing styles and eases template auto-completion.

-{% macro sortMenu(sort_name,source,translations) %}
+{% macro sort_menu(sort_name, source, translations) %}

Remember to update all macro calls (sortMenu(sort_menu() across templates.

app/utils/get_post_url_id_from_post.py (1)

23-30: Improve error handling specificity.

The generic Exception catch might hide specific database errors that could be useful for debugging.

Consider catching more specific exceptions:

    cursor.execute("""select url_id from posts where id = ?""", (post_id,))
    try:
        url_id = cursor.fetchone()[0]
        Log.info(f"Returning post's id {post_id} and post's url_id: {url_id}")
-    except Exception:
+    except (TypeError, IndexError):
        url_id = None
        Log.error(f"Failed to retrieve post's url_id for post id : {post_id}")
+    except sqlite3.Error as e:
+        url_id = None
+        Log.error(f"Database error while retrieving url_id for post id {post_id}: {e}")
app/utils/change_user_role.py (1)

12-12: Consider avoiding parameter mutation.

The function modifies its input parameter user_name = user_name.lower(), which can be confusing and unexpected.

Consider using a local variable instead:

-    user_name = user_name.lower()
+    username_lower = user_name.lower()

Then update all subsequent references to use username_lower instead of user_name.

app/routes/return_post_analytics_data.py (1)

11-13: Consider shortening the blueprint name.

The blueprint name return_post_analytics_data_blueprint is quite long. Consider using a shorter, more conventional name like analytics_api_blueprint or post_analytics_blueprint.

-return_post_analytics_data_blueprint = Blueprint(
-    "return_post_traffic_graph_data", __name__
-)
+analytics_api_blueprint = Blueprint("analytics_api", __name__)
app/utils/get_analytics_page_data.py (7)

19-19: Fix typo in docstring.

There's a typo in the docstring: "retrived" should be "retrieved".

-        `post_id` (int): The post's primary key/id whose traffic data to be retrived.
+        `post_id` (int): The post's primary key/id whose traffic data to be retrieved.

68-70: Consider more specific exception handling.

The broad exception handling could mask specific database connection or query issues. Consider catching specific exceptions for better debugging and error reporting.

-    except Exception:
-        Log.error(f"Failed to retrieve traffic data for post analytics: {post_id}")
+    except sqlite3.Error as e:
+        Log.error(f"Database error retrieving traffic data for post {post_id}: {e}")
+    except Exception as e:
+        Log.error(f"Unexpected error retrieving traffic data for post {post_id}: {e}")

77-77: Fix typo in docstring.

Same typo as in the previous function: "retrived" should be "retrieved".

-        `post_id` (int): The post's primary key/id whose visitors operating system counts data to be retrived.
+        `post_id` (int): The post's primary key/id whose visitors operating system counts data to be retrieved.

103-105: Apply consistent exception handling improvements.

Similar to the previous function, consider more specific exception handling for better error diagnostics.

-    except Exception:
-        Log.error(f"Failed to retrieve os data for post analytics: {post_id}")
+    except sqlite3.Error as e:
+        Log.error(f"Database error retrieving OS data for post {post_id}: {e}")
+    except Exception as e:
+        Log.error(f"Unexpected error retrieving OS data for post {post_id}: {e}")

124-124: Consider making the limit configurable.

The hardcoded LIMIT 25 could be made configurable for better flexibility. Consider adding it as a parameter or using a constant.

-def get_analytics_page_country_graph_data(post_id: int, view_all=False) -> dict:
+def get_analytics_page_country_graph_data(post_id: int, view_all=False, limit: int = 25) -> dict:

And update the SQL query:

-        sql_query = """select country as country_name, count(*) as country_count from posts_analytics where post_id = ? GROUP BY country ORDER BY country_count DESC limit 25"""
+        sql_query = """select country as country_name, count(*) as country_count from posts_analytics where post_id = ? GROUP BY country ORDER BY country_count DESC limit ?"""
+        query_params = (post_id, limit)

144-149: Apply consistent exception handling improvements.

Use the same specific exception handling pattern for consistency across all functions.

-    except Exception:
-        Log.error(f"Failed to retrieve country data for post analytics: {post_id}")
+    except sqlite3.Error as e:
+        Log.error(f"Database error retrieving country data for post {post_id}: {e}")
+    except Exception as e:
+        Log.error(f"Unexpected error retrieving country data for post {post_id}: {e}")

47-66: Consider extracting common database connection logic.

All three functions use the same database connection pattern. Consider creating a helper function or context manager to reduce code duplication and improve maintainability.

Example helper function:

def execute_analytics_query(sql_query: str, parameters: tuple):
    """Execute a query against the analytics database with proper logging and error handling."""
    try:
        Log.database(f"Connecting to '{Settings.DB_ANALYTICS_ROOT}' database")
        
        connection = sqlite3.connect(Settings.DB_ANALYTICS_ROOT)
        connection.set_trace_callback(Log.database)
        cursor = connection.cursor()
        
        cursor.execute(sql_query, parameters)
        result = cursor.fetchall()
        
        connection.close()
        return result
    except sqlite3.Error as e:
        Log.error(f"Database error executing analytics query: {e}")
        raise
    except Exception as e:
        Log.error(f"Unexpected error executing analytics query: {e}")
        raise

This would simplify each function and centralize the database connection logic.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 974af5b and 1522f84.

⛔ Files ignored due to path filters (4)
  • app/db/analytics.db is excluded by !**/*.db
  • app/db/comments.db is excluded by !**/*.db
  • app/db/posts.db is excluded by !**/*.db
  • app/db/users.db is excluded by !**/*.db
📒 Files selected for processing (103)
  • .gitignore (1 hunks)
  • app/app.py (4 hunks)
  • app/pyproject.toml (1 hunks)
  • app/routes/about.py (1 hunks)
  • app/routes/account_settings.py (2 hunks)
  • app/routes/admin_panel.py (1 hunks)
  • app/routes/admin_panel_comments.py (1 hunks)
  • app/routes/admin_panel_posts.py (1 hunks)
  • app/routes/admin_panel_users.py (1 hunks)
  • app/routes/category.py (3 hunks)
  • app/routes/changeLanguage.py (0 hunks)
  • app/routes/changeProfilePicture.py (0 hunks)
  • app/routes/changeUserName.py (0 hunks)
  • app/routes/change_language.py (1 hunks)
  • app/routes/change_password.py (3 hunks)
  • app/routes/change_profile_picture.py (1 hunks)
  • app/routes/change_user_name.py (1 hunks)
  • app/routes/create_post.py (4 hunks)
  • app/routes/dashboard.py (3 hunks)
  • app/routes/edit_post.py (3 hunks)
  • app/routes/index.py (3 hunks)
  • app/routes/login.py (4 hunks)
  • app/routes/logout.py (1 hunks)
  • app/routes/password_reset.py (5 hunks)
  • app/routes/post.py (7 hunks)
  • app/routes/posts_analytics.py (2 hunks)
  • app/routes/privacy_policy.py (1 hunks)
  • app/routes/return_post_analytics_data.py (7 hunks)
  • app/routes/return_post_banner.py (2 hunks)
  • app/routes/search.py (4 hunks)
  • app/routes/search_bar.py (1 hunks)
  • app/routes/set_language.py (2 hunks)
  • app/routes/set_theme.py (1 hunks)
  • app/routes/signup.py (8 hunks)
  • app/routes/user.py (2 hunks)
  • app/routes/verify_user.py (6 hunks)
  • app/settings.py (3 hunks)
  • app/templates/about.html (1 hunks)
  • app/templates/accountSettings.html (1 hunks)
  • app/templates/adminPanelUsers.html (2 hunks)
  • app/templates/category.html (1 hunks)
  • app/templates/changeLanguage.html (1 hunks)
  • app/templates/changePassword.html (1 hunks)
  • app/templates/changeProfilePicture.html (1 hunks)
  • app/templates/changeUserName.html (1 hunks)
  • app/templates/components/changeTheme.html (1 hunks)
  • app/templates/components/navbar.html (2 hunks)
  • app/templates/components/postCardMacro.html (3 hunks)
  • app/templates/components/sortMenu.html (4 hunks)
  • app/templates/createPost.html (4 hunks)
  • app/templates/dashboard.html (5 hunks)
  • app/templates/editPost.html (4 hunks)
  • app/templates/index.html (1 hunks)
  • app/templates/login.html (2 hunks)
  • app/templates/passwordReset.html (1 hunks)
  • app/templates/post.html (8 hunks)
  • app/templates/postsAnalytics.html (3 hunks)
  • app/templates/search.html (1 hunks)
  • app/templates/searchBar.html (1 hunks)
  • app/templates/signup.html (5 hunks)
  • app/templates/user.html (4 hunks)
  • app/utils/add_points.py (2 hunks)
  • app/utils/after_request.py (1 hunks)
  • app/utils/before_request/browser_language.py (2 hunks)
  • app/utils/calculate_read_time.py (1 hunks)
  • app/utils/change_user_role.py (1 hunks)
  • app/utils/contextProcessor/returnPostUrlID.py (0 hunks)
  • app/utils/contextProcessor/returnPostUrlSlug.py (0 hunks)
  • app/utils/contextProcessor/returnUserProfilePicture.py (0 hunks)
  • app/utils/context_processor/is_login.py (1 hunks)
  • app/utils/context_processor/is_registration.py (1 hunks)
  • app/utils/context_processor/return_post_url_id.py (1 hunks)
  • app/utils/context_processor/return_post_url_slug.py (1 hunks)
  • app/utils/context_processor/return_user_profile_picture.py (1 hunks)
  • app/utils/context_processor/translations.py (2 hunks)
  • app/utils/db_checker.py (10 hunks)
  • app/utils/delete.py (2 hunks)
  • app/utils/errorHandlers/csrfErrorHandler.py (0 hunks)
  • app/utils/errorHandlers/notFoundErrorHandler.py (0 hunks)
  • app/utils/errorHandlers/unauthorizedErrorHandler.py (0 hunks)
  • app/utils/error_handlers/csrf_error_handler.py (1 hunks)
  • app/utils/error_handlers/not_found_error_handler.py (1 hunks)
  • app/utils/error_handlers/unauthorized_error_handler.py (1 hunks)
  • app/utils/flash_message.py (1 hunks)
  • app/utils/forms/ChangePasswordForm.py (2 hunks)
  • app/utils/forms/ChangeProfilePictureForm.py (1 hunks)
  • app/utils/forms/ChangeUserNameForm.py (1 hunks)
  • app/utils/forms/CreatePostForm.py (1 hunks)
  • app/utils/forms/LoginForm.py (1 hunks)
  • app/utils/forms/PasswordResetForm.py (2 hunks)
  • app/utils/forms/SignUpForm.py (2 hunks)
  • app/utils/generate_url_id_from_post.py (2 hunks)
  • app/utils/getAnalyticsPageData.py (0 hunks)
  • app/utils/getPostUrlIdFromPost.py (0 hunks)
  • app/utils/get_analytics_page_data.py (1 hunks)
  • app/utils/get_data_from_user_ip.py (5 hunks)
  • app/utils/get_post_url_id_from_post.py (1 hunks)
  • app/utils/get_profile_picture.py (2 hunks)
  • app/utils/log.py (1 hunks)
  • app/utils/terminalASCII.py (0 hunks)
  • app/utils/terminal_ascii.py (1 hunks)
  • app/utils/time.py (1 hunks)
  • app/utils/translations.py (2 hunks)
💤 Files with no reviewable changes (12)
  • app/utils/errorHandlers/notFoundErrorHandler.py
  • app/routes/changeLanguage.py
  • app/utils/errorHandlers/unauthorizedErrorHandler.py
  • app/utils/contextProcessor/returnPostUrlSlug.py
  • app/utils/terminalASCII.py
  • app/utils/contextProcessor/returnUserProfilePicture.py
  • app/utils/getPostUrlIdFromPost.py
  • app/routes/changeProfilePicture.py
  • app/utils/contextProcessor/returnPostUrlID.py
  • app/utils/errorHandlers/csrfErrorHandler.py
  • app/routes/changeUserName.py
  • app/utils/getAnalyticsPageData.py
🧰 Additional context used
🧬 Code Graph Analysis (26)
app/utils/context_processor/is_login.py (1)
app/settings.py (1)
  • Settings (8-148)
app/utils/context_processor/return_post_url_slug.py (1)
app/utils/generate_url_id_from_post.py (1)
  • get_slug_from_post_title (50-56)
app/utils/context_processor/is_registration.py (1)
app/settings.py (1)
  • Settings (8-148)
app/utils/context_processor/translations.py (1)
app/utils/translations.py (1)
  • load_translations (7-25)
app/utils/flash_message.py (1)
app/routes/category.py (1)
  • category (22-97)
app/routes/about.py (1)
app/settings.py (1)
  • Settings (8-148)
app/routes/admin_panel_comments.py (2)
app/settings.py (1)
  • Settings (8-148)
app/utils/paginate.py (1)
  • paginate_query (8-40)
app/utils/change_user_role.py (1)
app/settings.py (1)
  • Settings (8-148)
app/routes/change_user_name.py (3)
app/settings.py (1)
  • Settings (8-148)
app/utils/flash_message.py (1)
  • flash_message (7-27)
app/utils/forms/ChangeUserNameForm.py (1)
  • ChangeUserNameForm (12-20)
app/routes/change_profile_picture.py (3)
app/settings.py (1)
  • Settings (8-148)
app/utils/flash_message.py (1)
  • flash_message (7-27)
app/utils/forms/ChangeProfilePictureForm.py (1)
  • ChangeProfilePictureForm (12-20)
app/utils/add_points.py (1)
app/routes/user.py (1)
  • user (15-93)
app/utils/delete.py (2)
app/utils/flash_message.py (1)
  • flash_message (7-27)
app/settings.py (1)
  • Settings (8-148)
app/routes/create_post.py (5)
app/utils/add_points.py (1)
  • add_points (7-20)
app/utils/flash_message.py (1)
  • flash_message (7-27)
app/utils/forms/CreatePostForm.py (1)
  • CreatePostForm (15-68)
app/utils/generate_url_id_from_post.py (1)
  • generate_url_id (59-67)
app/utils/time.py (1)
  • current_time_stamp (36-42)
app/routes/change_password.py (3)
app/utils/flash_message.py (1)
  • flash_message (7-27)
app/utils/forms/ChangePasswordForm.py (1)
  • ChangePasswordForm (12-39)
app/settings.py (1)
  • Settings (8-148)
app/utils/get_post_url_id_from_post.py (2)
app/settings.py (1)
  • Settings (8-148)
app/utils/context_processor/return_post_url_id.py (1)
  • url_id (5-6)
app/utils/before_request/browser_language.py (1)
app/settings.py (1)
  • Settings (8-148)
app/routes/user.py (1)
app/settings.py (1)
  • Settings (8-148)
app/routes/dashboard.py (4)
app/utils/delete.py (1)
  • delete_post (34-96)
app/utils/flash_message.py (1)
  • flash_message (7-27)
app/utils/paginate.py (1)
  • paginate_query (8-40)
app/settings.py (1)
  • Settings (8-148)
app/routes/admin_panel_posts.py (2)
app/settings.py (1)
  • Settings (8-148)
app/utils/paginate.py (1)
  • paginate_query (8-40)
app/utils/generate_url_id_from_post.py (2)
app/utils/context_processor/return_post_url_id.py (1)
  • url_id (5-6)
app/settings.py (1)
  • Settings (8-148)
app/routes/verify_user.py (3)
app/utils/flash_message.py (1)
  • flash_message (7-27)
app/utils/forms/VerifyUserForm.py (1)
  • VerifyUserForm (12-20)
app/settings.py (1)
  • Settings (8-148)
app/utils/db_checker.py (2)
app/utils/time.py (1)
  • current_time_stamp (36-42)
app/settings.py (1)
  • Settings (8-148)
app/routes/return_post_analytics_data.py (2)
app/utils/get_analytics_page_data.py (2)
  • get_analytics_page_country_graph_data (108-149)
  • get_analytics_page_traffic_graph_data (8-70)
app/settings.py (1)
  • Settings (8-148)
app/routes/admin_panel.py (1)
app/settings.py (1)
  • Settings (8-148)
app/utils/get_analytics_page_data.py (1)
app/settings.py (1)
  • Settings (8-148)
app/utils/context_processor/return_user_profile_picture.py (1)
app/utils/get_profile_picture.py (1)
  • get_profile_picture (7-36)
🔇 Additional comments (200)
.gitignore (1)

164-164: LGTM! Improved logging directory management.

The change from ignoring individual *.log files to ignoring the entire log/ directory aligns well with the new logging configuration structure shown in app/settings.py.

app/utils/terminal_ascii.py (1)

1-19: LGTM! Well-implemented ASCII art utility.

The function correctly uses ANSI escape codes for terminal coloring and provides a clean interface for displaying the application banner.

app/settings.py (3)

26-29: LGTM! Proper documentation for new logging features.

The docstring additions for JSON logging configuration are consistent with the existing documentation style and clearly describe the new functionality.


55-55: LGTM! Improved application name capitalization.

The change from "flaskBlog" to "FlaskBlog" provides better visual consistency for the application name.


113-116: LGTM! Well-structured JSON logging configuration.

The JSON logging settings follow the same pattern as the existing file logging configuration, ensuring consistency in the settings structure.

app/templates/changeUserName.html (1)

7-7: Verified: All references updated and consistent.

The rename from newUserName to new_user_name has been applied uniformly across the codebase:

  • app/templates/changeUserName.html
  • app/routes/change_user_name.py
  • app/utils/forms/ChangeUserNameForm.py

✅ Approving this change.

app/utils/after_request.py (1)

5-5: after_request_logger rename verified and usage confirmed

  • No remaining occurrences of the old afterRequestLogger name.
  • Confirmed import and invocation in app/app.py:
    • from utils.after_request import after_request_logger
    • response = after_request_logger(response)

All references are updated correctly—no further changes needed.

app/utils/forms/LoginForm.py (1)

18-21: Rename to user_name is fully consistent across the login system

  • No remaining userName references found in Python or HTML.
  • All form fields use form.user_name in routes and templates.
  • All session assignments and checks reference session["user_name"].

No further changes required—ready to merge.

app/utils/forms/ChangeUserNameForm.py (1)

17-20: LGTM! Consistent with template changes.

The field rename from newUserName to new_user_name correctly follows snake_case convention and matches the template changes in changeUserName.html.

app/templates/about.html (1)

12-12: Approve snake_case conversion and context variables

All checks confirm that the about route now passes app_name and app_version to the template, and there are no remaining appName or appVersion references anywhere.

• app/routes/about.py – returns render_template("about.html", app_name=Settings.APP_NAME, app_version=Settings.APP_VERSION)
• app/templates/about.html – consistently uses {{ app_name }} and {{ app_version }}

app/templates/changeProfilePicture.html (1)

16-16: Field rename looks correct

form.new_profile_picture_seed matches the snake_case migration and backend form class. No issues spotted.

app/templates/login.html (1)

17-18: Form field update is consistent

form.user_name is now snake_case and matches the backend. Looks good.

Also applies to: 45-46

app/templates/signup.html (1)

23-24: Field renames are correct

user_name and password_confirm align with the migrated form and backend. No further action needed.

Also applies to: 35-36, 68-70, 80-81

app/utils/error_handlers/csrf_error_handler.py (1)

4-14: LGTM! Clean implementation of CSRF error handler.

The function correctly handles CSRF errors by rendering the appropriate template with a 400 status code. The docstring is well-formatted and informative.

Note: The AI summary mentions that the previous implementation included error logging. Consider whether logging should be retained for debugging and monitoring purposes.

app/templates/search.html (1)

36-36: Naming conventions verified; backend function and macro parameter exist

  • get_profile_picture(user_name) is defined in app/utils/get_profile_picture.py
  • postCard(post, author_profile_picture) macro is declared in app/templates/components/postCardMacro.html

No further changes required—naming update is consistent and safe.

app/templates/changePassword.html (1)

11-11: password_confirm field confirmed in ChangePasswordForm

  • Verified in app/utils/forms/ChangePasswordForm.py that
    password_confirm = PasswordField("password_confirm", …)
  • The change_password route reads request.form["password_confirm"], matching the template.

All naming is consistent—approving the change.

app/templates/adminPanelUsers.html (1)

90-90: Backend form field names verified

The backend route handlers in app/routes/admin_panel_users.py correctly reference request.form["user_name"] for both user deletion and role-change operations. The snake_case refactoring for the hidden input fields is fully supported—no further changes required.

app/utils/context_processor/is_login.py (2)

4-4: LGTM: Function name follows Python naming conventions.

The function name change from isLogin to is_login correctly follows PEP 8 snake_case conventions for function names.


12-12: Templates updated to use is_login consistently
All references to the old isLogin key have been removed, and the new is_login key is used in your templates:

• app/templates/components/navbar.html:

  • {% if is_login %} in the {% elif hideSignUp %} branch
  • {% if is_login %} in the {% else %} branch

No occurrences of isLogin remain.

app/utils/error_handlers/unauthorized_error_handler.py (2)

5-16: LGTM: Clean error handler implementation.

The error handler follows Flask best practices with proper logging and template rendering. The function signature and return format are correct for Flask error handlers.


1-16: Unauthorized error handler registration verified

The unauthorized_error_handler is correctly registered in app/app.py for 401 errors:

  • @app.errorhandler(401) invokes unauthorized_error_handler(e)

No further action required.

app/utils/forms/ChangeProfilePictureForm.py (2)

17-20: LGTM: Field name follows naming conventions.

The field name change to new_profile_picture_seed correctly follows snake_case conventions.


17-17: All newProfilePictureSeed references have been updated to new_profile_picture_seed

Search confirms no remaining camelCase references and shows consistent use of the new snake_case field in forms, templates, and routes.

app/utils/error_handlers/not_found_error_handler.py (2)

5-16: LGTM: Consistent error handler implementation.

The 404 error handler follows the same clean pattern as other error handlers with proper logging and template rendering.


16-16: 404 Handler and Template Verified

The app/templates/notFound.html file is present and your @app.errorhandler(404) decorator correctly calls not_found_error_handler. No further changes needed.

app/templates/category.html (3)

15-15: LGTM: Template variable naming follows conventions.

The update from sortName to sort_name correctly follows snake_case naming conventions.


23-23: LGTM: Consistent variable and function naming.

Both authorProfilePicture to author_profile_picture and getProfilePicture to get_profile_picture updates follow snake_case conventions.


15-15: Verify Jinja macro definitions & context processor registration

  • File: app/templates/category.html, lines 15 and 23: calls to
    • sortMenu(sort_name, source, translations)
    • postCard(..., author_profile_picture, …)
  • Confirm that the sortMenu macro signature defines a sort_name parameter.
  • Confirm that the postCard macro signature defines an author_profile_picture parameter.
  • Confirm that get_profile_picture is exposed in the context processor (e.g. in app/utils/context_processor/return_user_profile_picture.py).
app/utils/context_processor/return_post_url_slug.py (1)

1-8: LGTM! Clean context processor implementation.

The context processor correctly follows the new snake_case naming convention and provides a clean interface for templates to generate URL slugs from post titles.

app/utils/add_points.py (2)

7-7: Function name correctly updated to snake_case.

The rename from addPoints to add_points aligns with the codebase-wide naming convention standardization.


16-16: Critical SQL query fix - column name corrected.

The update from userName to user_name in the WHERE clause is essential and matches the actual database schema as confirmed by the user route queries.

app/utils/context_processor/is_registration.py (1)

4-12: Consistent snake_case conversion for context processor.

Both the function name and return dictionary key have been properly updated to follow snake_case convention while maintaining the same functionality.

app/utils/context_processor/return_user_profile_picture.py (1)

1-12: Well-structured context processor for profile pictures.

The implementation correctly follows the context processor pattern and snake_case naming convention, providing templates access to the profile picture utility function.

app/pyproject.toml (1)

9-18: Dependency versions verified on PyPI – no issues detected

All of the updated minimum versions you bumped in app/pyproject.toml are valid releases on PyPI:

  • tamga ≥ 1.4.0
  • markdown2 ≥ 2.5.3
  • bleach ≥ 6.2.0
  • html2text ≥ 2025.4.15 (uses a date-based versioning scheme)

No further action is needed.

app/utils/forms/ChangePasswordForm.py (1)

17-18: LGTM! Consistent snake_case conversion.

The form field renamings from oldPassword to old_password and passwordConfirm to password_confirm are properly implemented with matching field name strings. This ensures form rendering and validation continue to work correctly.

Also applies to: 33-34

app/utils/forms/SignUpForm.py (1)

19-21: LGTM! Proper form field naming convention.

The field renamings from userName to user_name and passwordConfirm to password_confirm correctly maintain the distinction between internal field names (snake_case) and user-facing labels. The field name strings properly match the attribute names.

Also applies to: 37-38

app/utils/translations.py (1)

7-7: LGTM! Function renamed to snake_case convention.

The function renaming from loadTranslations to load_translations correctly follows Python naming conventions.

app/utils/context_processor/translations.py (1)

5-5: LGTM! Consistent snake_case conversion.

The import, function name, and function call renamings are all properly aligned with the snake_case convention and consistent with the changes in app/utils/translations.py.

Also applies to: 9-9, 20-20

app/utils/flash_message.py (2)

7-7: LGTM! Consistent function and parameter renaming.

The function renaming from flashMessage to flash_message and the default parameter value change from "wrongCall" to "wrong_call" maintain consistency with the snake_case convention.


21-23: LGTM! Variable renaming follows convention.

The variable renaming from translationFile to translation_file is consistent with the snake_case refactor pattern used throughout the codebase.

app/templates/index.html (2)

34-35: Call the renamed macro (sort_menu) after template refactor

If you apply the earlier macro-rename suggestion, this call needs the same change:

-    sortMenu(sort_name,source,translations) }}
+    sort_menu(sort_name, source, translations) }}

42-43: Confirm get_profile_picture is still exported

The helper was renamed elsewhere; ensure a matching context-processor function (get_profile_picture) is registered, or this call will 500 at runtime.

app/templates/createPost.html (4)

12-18: LGTM: Form field naming updated consistently.

The form field references have been properly updated from camelCase to snake_case (post_title, post_tags, post_abstract), maintaining consistency with the backend form definitions.


27-27: LGTM: Banner field naming updated.

The post_banner field reference correctly follows the new snake_case convention.


37-38: LGTM: Category select element attributes updated.

Both id and name attributes of the category select element have been consistently updated to post_category.


100-100: LGTM: Content field naming updated.

The post_content field reference maintains consistency with the snake_case naming convention.

app/templates/postsAnalytics.html (3)

25-25: LGTM: Profile picture function call updated.

The function call has been correctly updated from getProfilePicture to get_profile_picture, maintaining consistency with the snake_case naming convention.


243-243: LGTM: JavaScript variable naming updated.

The JavaScript variable post_id correctly follows the new snake_case convention, ensuring consistency between frontend and backend naming.


287-287: LGTM: JavaScript file reference updated.

The script reference has been properly updated to posts_analytics.js, maintaining consistency with the file naming convention changes.

app/utils/get_post_url_id_from_post.py (2)

7-15: LGTM: Function signature and documentation are well-defined.

The function has proper type hints, clear documentation, and a descriptive name following snake_case convention.


18-22: LGTM: Database connection setup follows best practices.

The database connection uses proper configuration from settings and includes trace callback for logging.

app/routes/about.py (4)

9-9: LGTM: Blueprint variable renamed consistently.

The blueprint variable has been properly updated to about_blueprint following snake_case convention.


12-12: LGTM: Route decorator updated.

The route decorator correctly references the renamed blueprint variable.


17-18: LGTM: Docstring parameters updated.

The docstring parameter names have been updated to snake_case (app_name) for consistency.


24-25: LGTM: Template context variables updated.

Both the log message and template context variables (app_name, app_version) have been consistently updated to snake_case.

Also applies to: 28-28

app/utils/change_user_role.py (3)

8-12: LGTM: Function signature updated consistently.

The function name has been properly updated to snake_case convention with clear documentation.


17-20: LGTM: SQL query uses parameterized statements.

The query properly uses parameterized statements to prevent SQL injection, and the column name has been updated to snake_case.


26-29: LGTM: Update query follows naming conventions.

The update query correctly uses snake_case variable names and parameterized statements for security.

app/utils/get_profile_picture.py (1)

7-36: Confirm database schema alignment with snake_case naming

  • Ran rg -A5 -B5 'create table.*users' . but did not locate the users table definition in the repo.
  • Please verify that your database (or migration scripts) defines the users table with user_name and profile_picture columns.
  • All calls to get_profile_picture have been updated; no getProfilePicture references remain.
app/utils/get_data_from_user_ip.py (1)

64-142: Excellent systematic snake_case conversion.

The function renaming and parameter updates are consistently applied throughout the entire function. Variable names like user_agent, user_ip_addr follow the snake_case convention while preserving all original logic and error handling.

app/utils/log.py (1)

14-20: Enhanced logging configuration with snake_case conventions.

The Tamga logger initialization has been updated to use snake_case parameter names and adds new JSON output capabilities. The parameters correctly map to the Settings configuration.

The addition of json_output and json_path parameters enhances logging capabilities while maintaining backward compatibility.

app/routes/admin_panel_comments.py (3)

12-17: Blueprint and route naming correctly updated to snake_case.

The blueprint variable renaming and route function conversion follow the snake_case convention consistently.


18-19: All session key references verified and updated to snake_case

Search across the app/ directory confirmed:

  • No occurrences of the old "userName" key
  • Consistent usage of "user_name" in:
    • app/utils/db_checker.py
    • app/utils/delete.py
    • app/utils/change_user_role.py

No further changes needed.


25-25: ✅ Snake_case Consistency Verified

The ORDER BY clause in app/routes/admin_panel_comments.py now uses time_stamp, matching the comments table schema defined in app/utils/db_checker.py:

  • app/routes/admin_panel_comments.py (line 25):
    "select * from comments order by time_stamp desc",
  • app/utils/db_checker.py:
    Defines "time_stamp" integer in create table if not exists comments(...)

No further changes needed.

app/utils/before_request/browser_language.py (2)

6-6: LGTM: Function name successfully converted to snake_case.

The function renaming from browserLanguage to browser_language follows the established naming convention for this refactoring effort.


17-26: LGTM: Variable naming consistently updated.

The internal variable browser_language has been consistently renamed and the logic flow remains intact. The variable reuse for both the raw header value and parsed language code is appropriate given the local scope.

app/templates/components/navbar.html (4)

26-26: LGTM: URL path correctly updated to snake_case.

The search bar URL path has been consistently updated from /searchbar to /search_bar.


39-39: LGTM: Create post URL correctly updated.

The URL path has been properly updated from /createpost to /create_post to match snake_case convention.


53-77: LGTM: Template variables consistently updated to snake_case.

The conditional variables is_registration and is_login have been properly updated from their camelCase equivalents, maintaining the template's conditional logic.


29-37: Session key and profile picture function consistency confirmed

All occurrences of the old session["userName"] key and getProfilePicture calls have been removed. The codebase uniformly uses session["user_name"] and get_profile_picture across templates and route handlers. No further changes needed.

app/routes/set_theme.py (2)

5-5: LGTM: Blueprint variable correctly renamed to snake_case.

The blueprint variable and name have been consistently updated from setThemeBlueprint to set_theme_blueprint.


8-9: Blueprint registration in app.py confirmed

  • set_theme_blueprint is imported and registered at line 278 in app/app.py.
  • No remaining setTheme camelCase references were found.
app/routes/admin_panel.py (3)

7-7: LGTM: Blueprint variable correctly renamed.

The admin panel blueprint has been properly updated to follow snake_case naming convention.


11-11: LGTM: Function name consistently updated.

The route handler function name has been properly converted from adminPanel to admin_panel.


12-25: Confirmed: user_name column is defined in the users table schema

The app/utils/db_checker.py schema includes a "user_name" TEXT UNIQUE column, and there are no remaining references to the old userName identifier. This change is safe—no further action required.

app/routes/logout.py (2)

7-10: LGTM: Imports and blueprint correctly updated to snake_case.

The blueprint variable and flash message import have been properly updated to follow the new naming convention.


23-33: LGTM: Session handling updated with improved language preservation.

The session key has been updated to user_name and the logic now properly preserves the user's language setting before clearing the session. The simplified approach of always redirecting to the homepage is appropriate for a logout function.

app/templates/user.html (4)

50-50: LGTM! Consistent session key conversion to snake_case.

The session key references have been correctly updated from "userName" to "user_name" throughout the template, maintaining consistency with the overall refactoring effort.

Also applies to: 72-72, 81-81


55-55: LGTM! URL paths correctly updated to snake_case.

The URL paths have been properly converted from /accountsettings to /account_settings, aligning with the snake_case naming convention for routes.

Also applies to: 58-58


93-93: LGTM! Template variables consistently renamed to snake_case.

The template variables show_posts and show_comments follow the snake_case convention correctly.

Also applies to: 105-105


102-102: LGTM! Function call and macro parameter properly converted to snake_case.

Both the function call get_profile_picture and the macro parameter author_profile_picture have been correctly updated to snake_case naming.

app/routes/search_bar.py (2)

4-4: LGTM! Blueprint properly converted to snake_case.

The blueprint variable and name have been correctly updated to follow snake_case conventions.


7-8: LGTM! Route and function names correctly converted to snake_case.

Both the route path and function name follow the snake_case convention consistently.

app/routes/change_user_name.py (3)

15-15: LGTM! Blueprint correctly follows snake_case convention.

The blueprint variable and name are properly formatted using snake_case.


18-19: LGTM! Route and function names follow snake_case convention.

Both the route path and function name are correctly converted to snake_case.


31-31: LGTM! Consistent use of snake_case session and form field names.

The session key "user_name" and form field "new_user_name" follow the snake_case convention consistently.

Also applies to: 35-35, 89-89

app/templates/editPost.html (3)

12-17: LGTM! Form field names correctly converted to snake_case.

The form fields post_title, post_tags, and post_abstract have been properly updated to follow snake_case conventions.


26-26: LGTM! URL endpoint properly updated to snake_case.

The URL endpoint has been correctly updated from returnPostBanner.returnPostBanner with postID to return_post_banner.return_post_banner with post_id, maintaining consistency with the snake_case refactoring.


30-30: LGTM! Remaining form fields consistently converted to snake_case.

The form fields post_banner, post_category, and post_content all follow the snake_case naming convention correctly.

Also applies to: 40-41, 103-103

app/routes/admin_panel_users.py (4)

11-12: LGTM! Import statements correctly updated to snake_case.

The imported functions change_user_role and delete_user follow the snake_case convention properly.


16-16: LGTM! Blueprint and routes properly converted to snake_case.

The blueprint variable, name, and route paths have been correctly updated to follow snake_case conventions.

Also applies to: 19-21


22-22: LGTM! Session key references consistently updated to snake_case.

All session key references have been properly converted from "userName" to "user_name" throughout the file.

Also applies to: 23-23, 31-31, 38-38, 45-45


36-36: LGTM! Form field references correctly updated to snake_case.

The form field names user_delete_button, user_name, and user_role_change_button follow the snake_case convention consistently.

Also applies to: 41-41, 43-43, 48-48

app/utils/forms/CreatePostForm.py (1)

20-42: LGTM! Form field naming convention updated correctly.

All form field names have been systematically converted from camelCase to snake_case while preserving all validators, labels, and choices. The changes are consistent and align with the PR objectives.

app/templates/components/postCardMacro.html (3)

1-1: Macro parameter updated correctly.

The parameter name change from authorProfilePicture to author_profile_picture is consistent with the snake_case naming convention.


17-17: Approved: Consistent snake_case naming and template context verified

The get_slug_from_post_title helper is registered in app/app.py and available to your templates, and the url_id parameter is correctly named. No further changes needed.


7-7: Endpoint verification: return_post_banner.return_post_banner exists

The return_post_banner blueprint and its return_post_banner(post_id) route are defined as expected, so your url_for('return_post_banner.return_post_banner', post_id=post[0]) call is valid.

• Defined in app/routes/return_post_banner.py:
return_post_banner_blueprint = Blueprint("return_post_banner", __name__)
@return_post_banner_blueprint.route("/post_image/<int:post_id>")
def return_post_banner(post_id):

app/routes/change_language.py (1)

3-3: Blueprint naming follows snake_case convention correctly.

The blueprint name change_language_blueprint is consistent with the snake_case naming standard.

app/routes/admin_panel_posts.py (5)

12-12: Blueprint naming updated correctly.

The blueprint variable name has been properly updated from camelCase to snake_case.


15-17: Route paths and function name updated consistently.

The route paths have been updated to snake_case, and providing both /admin/posts and /admin_panel/posts paths offers good flexibility. The function name follows the snake_case convention correctly.


18-19: Session key reference updated correctly.

The session key has been properly updated from "userName" to "user_name" to match the snake_case convention.


25-25: SQL column reference updated to snake_case.

The ORDER BY clause now uses time_stamp instead of timeStamp, which aligns with the database schema changes across the application.


29-35: Template rendering parameters updated consistently.

The template parameter has been properly updated from showPosts to show_posts to maintain consistency with the snake_case naming convention.

app/utils/time.py (4)

9-13: Function name updated correctly.

The function name has been properly converted from currentTimeZone to current_time_zone following snake_case convention.


16-20: Function name updated correctly.

The function name has been properly converted from currentDate to current_date following snake_case convention.


23-33: Function and parameter names updated consistently.

The function name current_time and parameter names micro_seconds have been properly updated to snake_case. The docstring correctly reflects the updated parameter name.


36-42: Function and variable names updated consistently.

The function name current_time_stamp and local variable time_stamp have been properly updated to snake_case convention while maintaining the same functionality.

app/templates/dashboard.html (5)

6-6: LGTM: Consistent variable naming conversion.

The template variable show_posts follows the snake_case convention consistently.


16-16: LGTM: URL endpoint and parameter naming updated correctly.

Both the blueprint name return_post_banner.return_post_banner and parameter post_id follow snake_case conventions.


32-36: LGTM: Edit post URL updated consistently.

The URL path /edit_post/ correctly follows snake_case naming.


39-42: LGTM: Form field names converted to snake_case.

Both post_id and post_delete_button field names follow the new naming convention.


177-177: LGTM: Session key updated to snake_case.

The session key user_name is consistent with the refactoring.

app/routes/set_language.py (4)

3-3: LGTM: Import statement updated to snake_case.

The import flash_message follows the new naming convention.


6-6: LGTM: Blueprint name follows snake_case convention.

The blueprint name set_language_blueprint is consistent with the refactoring.


9-10: LGTM: Route path and function name updated correctly.

Both the route path /set_language/<language> and function name set_language follow snake_case conventions.


22-27: LGTM: Function call updated to snake_case.

The flash_message function call follows the new naming convention.

app/routes/account_settings.py (4)

5-5: LGTM: Import updated to standalone function.

The import delete_user correctly reflects the refactoring from class method to standalone function.


8-8: LGTM: Blueprint name follows snake_case convention.

The blueprint name account_settings_blueprint is consistent with the refactoring.


11-12: LGTM: Route path and function name updated correctly.

Both the route path /account_settings and function name account_settings follow snake_case conventions.


26-26: LGTM: Function call updated to standalone function.

The delete_user function call correctly matches the new standalone function signature.

app/templates/post.html (4)

10-10: LGTM: URL endpoints consistently updated to snake_case.

All instances of return_post_banner.return_post_banner with post_id parameter follow the new naming convention.

Also applies to: 23-23, 36-36


52-52: LGTM: Session key references updated to snake_case.

All session key references use user_name consistently throughout the template.

Also applies to: 113-113, 151-151, 186-186


103-103: LGTM: Function calls updated to snake_case.

The get_profile_picture function calls follow the new naming convention.

Also applies to: 145-145


92-92: LGTM: Variable names updated to snake_case.

The time_stamp variable follows the new naming convention.

Also applies to: 109-109

app/utils/delete.py (3)

9-13: LGTM: Function documentation updated consistently.

The function signatures in the documentation correctly reflect the snake_case parameter names.


30-30: LGTM: Import statement updated to snake_case.

The flash_message import follows the new naming convention.


99-139: LGTM: delete_user function refactored correctly.

The function correctly handles database operations and follows snake_case naming conventions. The database connection is properly managed within the function scope.

app/routes/change_profile_picture.py (4)

15-15: LGTM: Blueprint definition follows snake_case convention.

The blueprint naming is consistent with the project's snake_case refactoring.


18-21: LGTM: Route definition is consistent.

The route path and function name properly follow snake_case naming conventions.


79-79: LGTM: Redirect URL follows snake_case convention.

The redirect path correctly uses snake_case naming.


33-47: Session key consistency verified
All references to the session key "user_name" are used uniformly across the application. No further changes needed.

app/routes/posts_analytics.py (4)

15-15: LGTM: Blueprint naming follows convention.

The blueprint has been correctly renamed to snake_case.


18-19: LGTM: Route and function naming is consistent.

Both the route parameter url_id and function name analytics_post properly follow snake_case conventions.


29-38: LGTM: Session key and database operations updated correctly.

The session key "user_name" and SQL column url_id are consistent with the snake_case refactoring.


52-66: LGTM: Utility function calls and variables properly renamed.

All utility function calls (get_analytics_page_traffic_graph_data, get_analytics_page_os_graph_data) and local variables (todays_visitor_data, todays_visitor, os_graph_data) follow snake_case conventions.

app/routes/create_post.py (3)

18-22: LGTM: Blueprint and route definition properly refactored.

The blueprint name create_post_blueprint, route path /create_post, and function name create_post all follow snake_case conventions correctly.


36-46: LGTM: Session key and form fields consistently updated.

All form field names (post_title, post_tags, post_abstract, etc.) and the session key "user_name" properly follow snake_case naming.


69-91: LGTM: Database column names consistently updated.

The SQL INSERT statement correctly uses snake_case column names (user_name, time_stamp, last_edit_time_stamp, url_id) which should be consistent with the database schema.

app/app.py (6)

13-97: LGTM: Comprehensive blueprint import refactoring.

All blueprint imports have been systematically updated to snake_case naming conventions. The refactoring is consistent and thorough.


99-129: LGTM: Utility imports properly updated.

All utility function imports have been correctly renamed to snake_case, including error handlers, context processors, and other utilities.


131-134: LGTM: Variable naming follows convention.

The variables start_time and terminal_ascii() function call properly use snake_case naming.


234-246: LGTM: Error handler functions updated consistently.

All error handler function names (not_found, unauthorized, csrf_error) and their implementations follow snake_case conventions.


262-291: LGTM: Blueprint registrations updated systematically.

All blueprint registrations use the correctly renamed snake_case blueprint variables.


301-309: LGTM: Runtime calculation variables properly named.

Variables end_time, run_time, and function calls follow snake_case conventions consistently.

app/routes/user.py (5)

11-11: LGTM: Blueprint naming follows convention.

The blueprint has been correctly renamed to user_blueprint following snake_case conventions.


14-24: LGTM: Route and function parameters properly updated.

The route parameter user_name and function parameter are consistent with snake_case naming conventions.


29-42: LGTM: Database queries updated to snake_case.

The SQL queries correctly reference the user_name column using snake_case naming.


48-57: LGTM: Database column references consistent.

The SQL query uses time_stamp column name which follows the snake_case convention for database schema.


51-90: LGTM: Local variables properly renamed.

All local variables (views_data, show_posts, show_comments) follow snake_case naming conventions consistently.

app/routes/return_post_banner.py (1)

8-37: Excellent snake_case conversion implementation!

The refactoring from camelCase to snake_case is consistently applied throughout:

  • Blueprint naming: returnPostBannerBlueprintreturn_post_banner_blueprint
  • Route path: /postImage/<int:postID>/post_image/<int:post_id>
  • Function and parameter names properly updated
  • All internal references (SQL query, logging) consistently use the new naming
app/utils/generate_url_id_from_post.py (1)

8-67: Comprehensive and consistent snake_case refactoring!

All functions and variables have been systematically updated:

  • Functions: checkIfurlIDExistsInPostDbcheck_if_url_id_exists_in_post_db
  • Variables: urlID, postTitle, cleanedTitleurl_id, post_title, cleaned_title
  • SQL column reference updated to url_id
  • Inter-function calls properly updated

The refactoring maintains all existing logic while achieving consistent naming conventions.

app/routes/change_password.py (1)

12-117: Well-executed snake_case conversion with one template naming consideration.

The refactoring is comprehensive and consistent:

  • Blueprint, route, and function names properly updated
  • Session keys: "userName""user_name"
  • Form fields: oldPassword, passwordConfirmold_password, password_confirm
  • SQL queries updated to use snake_case column names
  • Flash message calls consistently updated

Note: The template reference "changePassword.html" (line 103) still uses camelCase while the route is now snake_case. Verify this is intentional if template files aren't being renamed in this PR.

app/routes/login.py (1)

12-117: Thorough and consistent snake_case implementation!

The refactoring comprehensively updates all naming conventions:

  • Blueprint: loginBlueprintlogin_blueprint
  • Session keys: "userName", "userRole""user_name", "user_role"
  • Variables and form fields consistently updated
  • SQL queries use snake_case column names
  • Template parameters: hideLogin, siteKeyhide_login, site_key
  • Import statements properly updated

All changes maintain existing functionality while achieving consistent naming conventions.

app/utils/db_checker.py (1)

19-278: Comprehensive snake_case refactor of database schemas – migration plan required

The refactoring uniformly renames all database identifiers to snake_case:

  • Functions: dbFolder, usersTable, etc. → db_folder, users_table, …
  • Table names: postsAnalyticsposts_analytics
  • Column names: userID, profilePicture, timeStampuser_id, profile_picture, time_stamp
  • Import: currentTimeStampcurrent_time_stamp

Such changes will break existing installations unless a migration path is provided.

Please confirm that you have included or documented a database migration strategy—e.g. SQL/ORM scripts or step-by-step docs—to rename existing tables and columns and preserve user data before deploying these schema updates.

app/routes/index.py (5)

26-26: Blueprint naming convention correctly updated.

The blueprint variable has been properly renamed from indexBlueprint to index_blueprint following snake_case conventions.


29-30: Route decorators updated correctly.

The route decorators have been properly updated to use the new snake_case blueprint name.


49-56: Sorting options consistently updated to snake_case.

All sorting parameter options have been correctly converted from camelCase to snake_case (e.g., "timeStamp""time_stamp", "lastEditTimeStamp""last_edit_time_stamp").


85-93: Variable naming consistently updated.

The translation file handling variables have been properly renamed to snake_case (translationFiletranslation_file, sortNamesort_name).


67-68: Database schema uses snake_case column names
Verified that all timestamp columns (time_stamp, last_edit_time_stamp) are defined with snake_case in app/utils/db_checker.py, matching your SQL queries. No further action required.

app/routes/search.py (3)

8-8: Blueprint naming convention correctly applied.

The search blueprint has been properly renamed from searchBlueprint to search_blueprint.


28-40: SQL queries updated for consistent column naming.

The user search queries have been correctly updated to use user_name instead of userName, maintaining consistency with the snake_case naming convention.


47-87: Post search queries consistently updated.

All post search queries have been updated to use snake_case column names (time_stamp instead of timeStamp) and variable names have been properly converted to snake_case throughout.

app/routes/verify_user.py (4)

15-15: Import updated to use snake_case function name.

The import has been correctly updated to use flash_message instead of flashMessage, maintaining consistency with the utility module refactoring.


19-25: Route definition correctly updated to snake_case.

The blueprint name, route path, and parameter names have been properly converted to snake_case conventions (verify_user_blueprint, /verify_user/codesent=<code_sent>).


47-48: SQL query column names updated consistently.

The database queries have been properly updated to use user_name and is_verified in snake_case format.


37-38: ✅ Session key consistency confirmed

All Python code references to the session key have been converted to "user_name". No occurrences of the old camelCase "userName" remain in route modules. Assuming templates do not directly reference the session, no further updates are needed.

app/routes/category.py (4)

17-17: Blueprint naming convention correctly applied.

The category blueprint has been properly renamed from categoryBlueprint to category_blueprint.


22-22: Route function parameter updated correctly.

The default parameter value has been correctly changed from "timeStamp" to "time_stamp" to maintain consistency with the snake_case naming convention.


56-57: Sorting options consistently updated.

All sorting option arrays have been properly converted to use snake_case keys (by_options, sort_options) and values ("time_stamp", "last_edit_time_stamp").


75-85: Variable mapping and translation handling updated correctly.

The variable name mapping logic and translation file handling have been consistently updated to use snake_case variable names while preserving the original functionality.

app/routes/dashboard.py (5)

13-14: Import statements correctly updated.

The imports have been properly updated to use snake_case function names (delete_post, flash_message) consistent with the utility module refactoring.


18-18: Blueprint naming convention correctly applied.

The dashboard blueprint has been properly renamed from dashboardBlueprint to dashboard_blueprint.


21-24: Route function and session key usage updated correctly.

The route function parameter and session key references have been consistently updated to use user_name instead of userName.


36-37: SQL query column names updated consistently.

The database query has been properly updated to use time_stamp instead of timeStamp for ordering posts.


52-59: UI control variables consistently renamed.

The boolean control variables have been properly renamed from showPosts/showComments to show_posts/show_comments following snake_case conventions.

app/routes/post.py (6)

22-22: LGTM: Blueprint naming updated correctly.

The blueprint has been properly renamed from postBlueprint to post_blueprint following snake_case conventions.


25-27: LGTM: Route definitions and parameters updated consistently.

The route paths and function parameters have been correctly updated to use url_id instead of urlID, maintaining consistency throughout the routing logic.


12-21: LGTM: Import statements updated to snake_case.

All utility function imports have been properly updated to use snake_case naming conventions (e.g., add_points, flash_message, current_time_stamp), ensuring consistency with the refactored utility modules.


36-43: Verify the post existence check logic.

The current logic uses if str(url_id) in posts: where posts is a tuple from fetchone(). While this works, it's an unusual pattern since the WHERE clause already ensures the url_id matches.

Consider a more explicit check for better readability:

-if str(url_id) in posts:
+if posts:  # Since WHERE clause already filters by url_id

Or alternatively:

-if str(url_id) in posts:
+if posts and posts[0] == url_id:

66-74: LGTM: Form handling updated with consistent naming.

The form field names have been properly updated to snake_case (post_delete_button, comment_delete_button) and the logic remains intact.


87-95: LGTM: Database operations updated with snake_case columns.

The SQL insert statement correctly uses snake_case column names (user_name, time_stamp) and session key access is consistent with the new naming convention.

app/routes/return_post_analytics_data.py (3)

39-41: LGTM: Query parameter handling updated consistently.

The parameter names have been properly updated to snake_case (post_id, since_posted) and the type conversion logic remains correct.


50-50: LGTM: Session key usage consistent.

Session key access has been correctly updated to use "user_name" consistently across all route handlers.

Also applies to: 108-108


160-162: LGTM: JSON request handling updated.

The JSON field names have been properly updated to snake_case (visitorIDvisitor_id, spendTimespend_time) maintaining API consistency.

app/routes/password_reset.py (4)

20-20: LGTM: Blueprint naming updated correctly.

The blueprint has been properly renamed to password_reset_blueprint following snake_case conventions.


26-29: LGTM: Route path and function updated consistently.

The route path has been changed to /password_reset/codesent=<code_sent> and the function parameter updated accordingly, maintaining consistency with the new naming convention.


51-62: LGTM: Form handling and database queries updated.

All form field names (user_name, password_confirm) and database column references have been properly updated to snake_case while maintaining the correct logic flow.


128-133: LGTM: Email content updated with new variable names.

The email message content has been correctly updated to use the new snake_case variable names (user_name, password_reset_code) in both plain text and HTML formats.

app/routes/edit_post.py (5)

16-16: LGTM: Blueprint naming updated correctly.

The blueprint has been properly renamed to edit_post_blueprint following snake_case conventions.


19-20: LGTM: Route and function updated consistently.

The route path has been changed to /edit_post/<url_id> and the function parameter updated accordingly, maintaining consistency throughout the module.


60-64: LGTM: Form field attributes updated to snake_case.

All form field attributes have been properly updated from camelCase to snake_case (post_title, post_tags, post_content, etc.) while maintaining the correct form data assignment.


67-72: LGTM: Form data extraction updated consistently.

The form field names in the request handling have been correctly updated to snake_case, ensuring consistency with the form field definitions and template.


114-116: LGTM: Database update with snake_case column name.

The database update query correctly uses the snake_case column name last_edit_time_stamp with the updated utility function current_time_stamp().

app/routes/signup.py (6)

23-23: LGTM: Blueprint naming updated correctly.

The blueprint has been properly renamed to sign_up_blueprint following snake_case conventions.


47-50: LGTM: Form field variables updated consistently.

All form field variable names have been properly updated to snake_case (user_name, password_confirm) while maintaining the correct extraction logic.


69-77: LGTM: reCAPTCHA integration updated correctly.

The reCAPTCHA verification variables and response handling have been properly updated to snake_case (secret_response, verify_response) while maintaining the security validation logic.


92-105: LGTM: Database insert updated with snake_case columns.

The user registration query correctly uses snake_case column names (user_name, profile_picture, time_stamp, is_verified) and the profile picture URL generation uses the updated variable name.


111-114: LGTM: Session management updated consistently.

Session key assignment and utility function calls have been properly updated to use snake_case (session["user_name"], add_points) while maintaining the user login flow.


165-165: LGTM: Redirect URL updated to snake_case.

The redirect URL has been correctly updated to use the new snake_case route path /verify_user/codesent=false, ensuring consistency with the refactored routing structure.

app/utils/get_analytics_page_data.py (1)

1-6: Clean import structure following conventions.

The imports are well-organized with standard library imports first, followed by local imports. All imports are necessary for the functionality.

Comment on lines 8 to 40
<a href="/set_language/en" class="m-2 hover:text-rose-500 duration-150">
🇬🇧 English
</a>
<a href="/setLanguage/tr" class="m-2 hover:text-rose-500 duration-150">
<a href="/set_language/tr" class="m-2 hover:text-rose-500 duration-150">
🇹🇷 Türkçe
</a>
<a href="/setLanguage/de" class="m-2 hover:text-rose-500 duration-150">
<a href="/set_language/de" class="m-2 hover:text-rose-500 duration-150">
🇩🇪 Deutsch
</a>
<a href="/setLanguage/es" class="m-2 hover:text-rose-500 duration-150">
<a href="/set_language/es" class="m-2 hover:text-rose-500 duration-150">
🇪🇸 Español
</a>
<a href="setLanguage/pl" class="m-2 hover:text-rose-500 duration-150">
<a href="/set_language/pl" class="m-2 hover:text-rose-500 duration-150">
🇵🇱 Polski
</a>
<a href="/setLanguage/fr" class="m-2 hover:text-rose-500 duration-150">
<a href="/set_language/fr" class="m-2 hover:text-rose-500 duration-150">
🇫🇷 Français
</a>
<a href="/setLanguage/pt" class="m-2 hover:text-rose-500 duration-150">
<a href="/set_language/pt" class="m-2 hover:text-rose-500 duration-150">
🇵🇹 Português
</a>
<a href="/setLanguage/uk" class="m-2 hover:text-rose-500 duration-150">
<a href="/set_language/uk" class="m-2 hover:text-rose-500 duration-150">
🇺🇦 Українська
</a>
<a href="/setLanguage/ru" class="m-2 hover:text-rose-500 duration-150">
<a href="/set_language/ru" class="m-2 hover:text-rose-500 duration-150">
🇷🇺 Русский
</a>
<a href="/setLanguage/ja" class="m-2 hover:text-rose-500 duration-150">
<a href="/set_language/ja" class="m-2 hover:text-rose-500 duration-150">
🇯🇵 日本人
</a>
<a href="/setLanguage/zh" class="m-2 hover:text-rose-500 duration-150">
<a href="/set_language/zh" class="m-2 hover:text-rose-500 duration-150">
🇨🇳 中国人
</a>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify backend route compatibility for the URL pattern changes.

All language selection URLs have been correctly updated from /setLanguage/{lang} to /set_language/{lang} following the snake_case convention. The changes are systematic and consistent across all supported languages.

Verify that the corresponding backend routes have been updated to handle the new URL pattern:


🏁 Script executed:

#!/bin/bash
# Description: Verify that set_language routes exist and setLanguage routes are removed

echo "Searching for new snake_case route definitions..."
rg -A 3 "set_language" --type py

echo -e "\nSearching for any remaining camelCase setLanguage references..."
rg "setLanguage" --type py

Length of output: 1200


Action Required: Update Remaining CamelCase Reference

The new /set_language/<language> routes are registered correctly, but there’s still one leftover CamelCase reference that will break URL generation or analytics tagging:

• In app/routes/set_language.py (around the page="setLanguage" parameter)
– Change page="setLanguage" to page="set_language" to match the new route pattern.

🤖 Prompt for AI Agents
In app/routes/set_language.py around the lines where the parameter
page="setLanguage" is used, update the value to page="set_language" to match the
new route naming convention. This change ensures consistency with the new
lowercase underscore route pattern and prevents issues with URL generation or
analytics tagging.

</div>

<script src="{{ url_for('static', filename='js/searchBar.js') }}"></script>
<script src="{{ url_for('static', filename='js/search_bar.js') }}"></script>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify JavaScript file exists with the new snake_case filename.

The script reference has been correctly updated from searchBar.js to search_bar.js following the naming convention changes.

Verify that the JavaScript file has been renamed accordingly:


🏁 Script executed:

#!/bin/bash
# Description: Verify the search bar JavaScript file exists with the new name

echo "Checking for the new snake_case JavaScript file..."
fd "search_bar.js" --type f

echo -e "\nChecking for any remaining camelCase JavaScript files..."
fd "searchBar.js" --type f

echo -e "\nListing all JavaScript files in the static/js directory..."
fd "\.js$" --type f | grep "static.*js"

Length of output: 715


Ensure search_bar.js exists by renaming the file

The template now references static/js/search_bar.js, but only app/static/js/searchBar.js exists. This mismatch will break the script load at runtime.

• Rename the JS file on disk:
app/static/js/searchBar.jsapp/static/js/search_bar.js
• Remove or consolidate any leftover camelCase filenames in app/static/js/

Example diff for the filesystem rename:

- app/static/js/searchBar.js
+ app/static/js/search_bar.js

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In app/templates/searchBar.html at line 19, the script tag references
static/js/search_bar.js but the actual file is named searchBar.js with
camelCase. Rename the file app/static/js/searchBar.js to
app/static/js/search_bar.js to match the template reference. Also, check the
app/static/js/ directory for any other camelCase filenames and rename them to
use underscores for consistency.

Comment on lines 7 to 16
{% if mailSent %} {{
form.userName(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.username)
form.user_name(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.username)
}} {{
form.code(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.codePlaceholder)
}} {{
form.password(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.newPassword)
}} {{
form.passwordConfirm(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.confirmPassword)
form.password_confirm(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.confirmPassword)
}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

mailSent is still camelCase – switch to mail_sent for consistency

Everything else in this PR moves to snake_case, but the template flag remains camelCase. This will create drift between template and view logic.

-{% if mailSent %} {{
+{% if mail_sent %} {{-        form.password_confirm(...)
+        form.password_confirm(...)
 {% endif %}

Remember to rename the variable in the view/route that renders this template as well.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{% if mailSent %} {{
form.userName(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.username)
form.user_name(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.username)
}} {{
form.code(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.codePlaceholder)
}} {{
form.password(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.newPassword)
}} {{
form.passwordConfirm(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.confirmPassword)
form.password_confirm(class_="input input-bordered w-full my-2", autocomplete="off",placeholder=translations.passwordReset.confirmPassword)
}}
{% if mail_sent %} {{
form.user_name(class_="input input-bordered w-full my-2", autocomplete="off", placeholder=translations.passwordReset.username)
}} {{
form.code(class_="input input-bordered w-full my-2", autocomplete="off", placeholder=translations.passwordReset.codePlaceholder)
}} {{
form.password(class_="input input-bordered w-full my-2", autocomplete="off", placeholder=translations.passwordReset.newPassword)
}} {{
form.password_confirm(class_="input input-bordered w-full my-2", autocomplete="off", placeholder=translations.passwordReset.confirmPassword)
}}
{% endif %}
🤖 Prompt for AI Agents
In app/templates/passwordReset.html between lines 7 and 15, the variable
mailSent is used in camelCase, which is inconsistent with the rest of the
codebase that uses snake_case. Rename mailSent to mail_sent in this template and
also update the corresponding variable name in the view or route that renders
this template to maintain consistency across the codebase.

Comment on lines +23 to 26
href="/password_reset/codesent=false"
>{{translations.login.forgot}}</a
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Hard-coded password-reset URL still carries old path/param

The route was renamed to password_reset/password_reset and the path parameter to code_sent, but the template hard-codes /password_reset/codesent=false.

Use url_for to avoid this drift and pick up future refactors automatically:

- href="/password_reset/codesent=false"
+ href="{{ url_for('password_reset.password_reset', code_sent=False) }}"

Apply to both occurrences.

Also applies to: 51-52

🤖 Prompt for AI Agents
In app/templates/login.html at lines 23-24 and 51-52, the password reset URL is
hard-coded as /password_reset/codesent=false, which is outdated. Replace these
hard-coded href values with calls to url_for using the updated route name
'password_reset/password_reset' and pass the parameter code_sent=false. This
change will ensure the URLs automatically reflect future route or parameter
renames.

Comment on lines 49 to 52
href="/privacy_policy"
class="font-medium text-rose-500 hover:text-rose-600 duration-150"
>{{translations.signup.policy}}</a
>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Replace hard-coded privacy-policy path with url_for

Hard-coding /privacy_policy bypasses blueprint renames and URL-building helpers.

- href="/privacy_policy"
+ href="{{ url_for('privacy_policy.privacy_policy') }}"

Apply to both occurrences to future-proof the link.

Also applies to: 87-88

🤖 Prompt for AI Agents
In app/templates/signup.html at lines 49 to 52 and also lines 87 to 88, replace
the hard-coded href="/privacy_policy" with a dynamic URL generated using the
url_for function to ensure the link respects blueprint renames and URL-building
helpers. Update both occurrences by using url_for('privacy_policy') or the
appropriate endpoint name inside the href attribute to future-proof the link.

Comment on lines 142 to 171
def delete_comment(comment_id):
"""
This function deletes a comment from the database.
Parameters:
comment_id (str): The ID of the comment to be deleted.
Returns:
None
"""
connection = sqlite3.connect(Settings.DB_COMMENTS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select user_name from comments where id = ? """,
[(comment_id)],
)
cursor.execute(
"""delete from comments where id = ? """,
[(comment_id)],
)
cursor.execute("update sqlite_sequence set seq = seq-1")
connection.commit()
flash_message(
page="delete",
message="comment",
category="error",
language=session["language"],
)
Log.success(f'Comment: "{comment_id}" deleted')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix missing database connection close in delete_comment function.

The database connection is opened but never explicitly closed.

     cursor.execute(
         """delete from comments where id = ? """,
         [(comment_id)],
     )
     cursor.execute("update sqlite_sequence set seq = seq-1")
     connection.commit()
+    connection.close()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def delete_comment(comment_id):
"""
This function deletes a comment from the database.
Parameters:
comment_id (str): The ID of the comment to be deleted.
Returns:
None
"""
connection = sqlite3.connect(Settings.DB_COMMENTS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select user_name from comments where id = ? """,
[(comment_id)],
)
cursor.execute(
"""delete from comments where id = ? """,
[(comment_id)],
)
cursor.execute("update sqlite_sequence set seq = seq-1")
connection.commit()
flash_message(
page="delete",
message="comment",
category="error",
language=session["language"],
)
Log.success(f'Comment: "{comment_id}" deleted')
def delete_comment(comment_id):
"""
This function deletes a comment from the database.
Parameters:
comment_id (str): The ID of the comment to be deleted.
Returns:
None
"""
connection = sqlite3.connect(Settings.DB_COMMENTS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select user_name from comments where id = ? """,
[(comment_id)],
)
cursor.execute(
"""delete from comments where id = ? """,
[(comment_id)],
)
cursor.execute("update sqlite_sequence set seq = seq-1")
connection.commit()
connection.close()
flash_message(
page="delete",
message="comment",
category="error",
language=session["language"],
)
Log.success(f'Comment: "{comment_id}" deleted')
🤖 Prompt for AI Agents
In app/utils/delete.py between lines 142 and 171, the delete_comment function
opens a database connection but does not close it, which can lead to resource
leaks. Add a connection.close() call at the end of the function after committing
the transaction to properly close the database connection.

Comment on lines 34 to 96
def delete_post(post_id):
"""
This function deletes a post and all associated comments from the database.
Parameters:
post_id (str): The ID of the post to be deleted.
Returns:
None
"""
Log.database(f"Connecting to '{Settings.DB_POSTS_ROOT}' database")
connection = sqlite3.connect(Settings.DB_POSTS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select user_name from posts where id = ? """,
[(post_id)],
)
cursor.execute(
"""delete from posts where id = ? """,
[(post_id)],
)
cursor.execute("update sqlite_sequence set seq = seq-1")
connection.commit()
connection.close()
connection = sqlite3.connect(Settings.DB_COMMENTS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select count(*) from comments where post_id = ? """,
[(post_id)],
)
comment_count = list(cursor)[0][0]
cursor.execute(
"""delete from comments where post_id = ? """,
[(post_id)],
)
cursor.execute(
"""update sqlite_sequence set seq = seq - ? """,
[(comment_count)],
)
connection.commit()

connection = sqlite3.connect(Settings.DB_ANALYTICS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select post_id from posts_analytics where post_id = ? """,
[(post_id)],
)
cursor.execute(
"""delete from posts_analytics where post_id = ? """,
[(post_id)],
)
connection.commit()

flash_message(
page="delete",
message="post",
category="error",
language=session["language"],
)
Log.success(f'Post: "{post_id}" deleted')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix database connection management in delete_post function.

The function opens multiple database connections but doesn't properly close the second and third connections.

     cursor.execute(
         """update sqlite_sequence set seq = seq - ? """,
         [(comment_count)],
     )
     connection.commit()
+    connection.close()

     connection = sqlite3.connect(Settings.DB_ANALYTICS_ROOT)
     connection.set_trace_callback(Log.database)
     cursor = connection.cursor()
     cursor.execute(
         """select post_id from posts_analytics where post_id = ? """,
         [(post_id)],
     )
     cursor.execute(
         """delete from posts_analytics where post_id = ? """,
         [(post_id)],
     )
     connection.commit()
+    connection.close()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def delete_post(post_id):
"""
This function deletes a post and all associated comments from the database.
Parameters:
post_id (str): The ID of the post to be deleted.
Returns:
None
"""
Log.database(f"Connecting to '{Settings.DB_POSTS_ROOT}' database")
connection = sqlite3.connect(Settings.DB_POSTS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select user_name from posts where id = ? """,
[(post_id)],
)
cursor.execute(
"""delete from posts where id = ? """,
[(post_id)],
)
cursor.execute("update sqlite_sequence set seq = seq-1")
connection.commit()
connection.close()
connection = sqlite3.connect(Settings.DB_COMMENTS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select count(*) from comments where post_id = ? """,
[(post_id)],
)
comment_count = list(cursor)[0][0]
cursor.execute(
"""delete from comments where post_id = ? """,
[(post_id)],
)
cursor.execute(
"""update sqlite_sequence set seq = seq - ? """,
[(comment_count)],
)
connection.commit()
connection = sqlite3.connect(Settings.DB_ANALYTICS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select post_id from posts_analytics where post_id = ? """,
[(post_id)],
)
cursor.execute(
"""delete from posts_analytics where post_id = ? """,
[(post_id)],
)
connection.commit()
flash_message(
page="delete",
message="post",
category="error",
language=session["language"],
)
Log.success(f'Post: "{post_id}" deleted')
def delete_post(post_id):
"""
This function deletes a post and all associated comments from the database.
Parameters:
post_id (str): The ID of the post to be deleted.
Returns:
None
"""
Log.database(f"Connecting to '{Settings.DB_POSTS_ROOT}' database")
connection = sqlite3.connect(Settings.DB_POSTS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select user_name from posts where id = ? """,
[(post_id)],
)
cursor.execute(
"""delete from posts where id = ? """,
[(post_id)],
)
cursor.execute("update sqlite_sequence set seq = seq-1")
connection.commit()
connection.close()
connection = sqlite3.connect(Settings.DB_COMMENTS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select count(*) from comments where post_id = ? """,
[(post_id)],
)
comment_count = list(cursor)[0][0]
cursor.execute(
"""delete from comments where post_id = ? """,
[(post_id)],
)
cursor.execute(
"""update sqlite_sequence set seq = seq - ? """,
[(comment_count)],
)
connection.commit()
connection.close()
connection = sqlite3.connect(Settings.DB_ANALYTICS_ROOT)
connection.set_trace_callback(Log.database)
cursor = connection.cursor()
cursor.execute(
"""select post_id from posts_analytics where post_id = ? """,
[(post_id)],
)
cursor.execute(
"""delete from posts_analytics where post_id = ? """,
[(post_id)],
)
connection.commit()
connection.close()
flash_message(
page="delete",
message="post",
category="error",
language=session["language"],
)
Log.success(f'Post: "{post_id}" deleted')
🤖 Prompt for AI Agents
In app/utils/delete.py between lines 34 and 96, the delete_post function opens
three separate database connections but only closes the first one. To fix this,
ensure that after committing changes to the second and third databases, you
explicitly close those connections as well to properly release resources and
avoid potential database locks or leaks.

Comment on lines 64 to 67
return render_template(
"changeProfilePicture.html",
form=form,
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Template name inconsistency with snake_case refactoring.

The template name "changeProfilePicture.html" still uses camelCase, which is inconsistent with the overall snake_case refactoring effort.

Consider updating to:

-        return render_template(
-            "changeProfilePicture.html",
-            form=form,
-        )
+        return render_template(
+            "change_profile_picture.html",
+            form=form,
+        )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return render_template(
"changeProfilePicture.html",
form=form,
)
return render_template(
"change_profile_picture.html",
form=form,
)
🤖 Prompt for AI Agents
In app/routes/change_profile_picture.py around lines 64 to 67, the template name
"changeProfilePicture.html" uses camelCase, which is inconsistent with the
snake_case naming convention used elsewhere. Rename the template reference to
"change_profile_picture.html" to maintain consistency with the snake_case
refactoring.

language=session["language"],
)
return redirect("/login/redirect=&createpost")
return redirect("/login/redirect=&create_post")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix the redirect URL syntax.

The redirect URL contains an extra "&" character that appears to be a syntax error.

-        return redirect("/login/redirect=&create_post")
+        return redirect("/login/redirect=create_post")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return redirect("/login/redirect=&create_post")
return redirect("/login/redirect=create_post")
🤖 Prompt for AI Agents
In app/routes/create_post.py at line 120, the redirect URL contains an incorrect
extra "&" character. Remove the "&" so the URL reads
"/login/redirect=create_post" to fix the syntax error in the redirect path.

Comment on lines 8 to 14
def get_analytics_page_traffic_graph_data(
post_id: int,
since_posted=False,
weeks: float = 0,
days: float = 0,
hours: float = 0,
) -> list[list[int]]:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add input validation for post_id parameter.

Consider adding validation to ensure post_id is a positive integer to prevent potential issues with database queries.

 def get_analytics_page_traffic_graph_data(
     post_id: int,
     since_posted=False,
     weeks: float = 0,
     days: float = 0,
     hours: float = 0,
 ) -> list[list[int]]:
+    if not isinstance(post_id, int) or post_id <= 0:
+        raise ValueError("post_id must be a positive integer")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def get_analytics_page_traffic_graph_data(
post_id: int,
since_posted=False,
weeks: float = 0,
days: float = 0,
hours: float = 0,
) -> list[list[int]]:
def get_analytics_page_traffic_graph_data(
post_id: int,
since_posted=False,
weeks: float = 0,
days: float = 0,
hours: float = 0,
) -> list[list[int]]:
if not isinstance(post_id, int) or post_id <= 0:
raise ValueError("post_id must be a positive integer")
# existing implementation follows
🤖 Prompt for AI Agents
In app/utils/get_analytics_page_data.py around lines 8 to 14, the function
get_analytics_page_traffic_graph_data lacks validation for the post_id
parameter. Add a check at the start of the function to ensure post_id is a
positive integer, and raise a ValueError if it is not. This will prevent invalid
post_id values from causing issues in downstream database queries.

Renamed files, blueprints, and functions from camelCase to snake_case for consistency with Python conventions. Updated all relevant imports, route registrations, and context processors. Refactored database field names and logic to use snake_case. Improved modularity and maintainability by splitting and updating utility/context processor functions. Updated dependencies in pyproject.toml and added logging to JSON. Removed deprecated files and added new ones to match the new naming scheme.
Multiple route and template files were updated, and the log.json file now contains detailed application and database activity logs. The posts and users database files were also modified, likely reflecting changes to data or schema.
Applied consistent line breaks for long argument lists and decorators across multiple route and utility files for improved readability. Removed unused imports from password_reset.py, verify_user.py, set_language.py, and csrf_error_handler.py. No functional changes were made.
Corrected column names from 'post_id' to 'id' in SQL queries for comments and analytics in post.py and return_post_analytics_data.py to match the database schema. Also updated .gitignore to ignore the 'log/' directory instead of '*.log'. Updated database files to reflect these schema changes.
A blank line was added after the /.idea entry in .gitignore for improved readability and separation between sections.
Changed the SQL query in the user route to select 'user_name' instead of 'userName' to match the actual column name in the users table.
Standardized route paths and blueprint names to use snake_case for consistency across the codebase. Updated template variable names from camelCase to snake_case. Renamed translation loading functions to follow Python naming conventions.
Replaces all instances of 'user_name' with 'username' in Python code, HTML templates, and form fields for consistency and clarity. Updates all relevant session keys, database queries, form handling, and template variables. Also renames the change_user_name route and blueprint to change_username. This change improves code readability and standardizes user identification throughout the application.
@DogukanUrker DogukanUrker force-pushed the camelCase-to-snake_case branch from f14df1a to ae62373 Compare July 24, 2025 18:09
Deleted passwordReset.html and verifyUser.html from app/templates. These templates are no longer needed, possibly due to refactoring or removal of related features.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

camelCase --> snake_case

2 participants