Skip to content

Omar #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .coderabbit.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions .coderabbit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
reviews:
enabled: true
auto_review: true
auto_summarize: true
auto_title: true
auto_title_instructions: "Generate a title based on the changes in the PR"
max_comments: 10
simple_changes: false
comment_lgtm: false
Comment on lines +1 to +9
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Configuration Schema Violation: auto_review
The CodeRabbit configuration schema expects the auto_review property to be an object, but a boolean (true) is provided here. This mismatch leads to a validation error ("Expected object, received boolean at reviews.auto_review").
For example, modify the configuration as follows:

-  auto_review: true
+  auto_review:
+    enabled: true
+    auto_incremental_review: true

Please update this section to match the schema.

📝 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
reviews:
enabled: true
auto_review: true
auto_summarize: true
auto_title: true
auto_title_instructions: "Generate a title based on the changes in the PR"
max_comments: 10
simple_changes: false
comment_lgtm: false
reviews:
enabled: true
auto_review:
enabled: true
auto_incremental_review: true
auto_summarize: true
auto_title: true
auto_title_instructions: "Generate a title based on the changes in the PR"
max_comments: 10
simple_changes: false
comment_lgtm: false

3 changes: 2 additions & 1 deletion .github/workflows/ai-pr-reviewer.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Code Review

permissions:
Expand All @@ -16,7 +17,7 @@ jobs:
- uses: coderabbitai/ai-pr-reviewer@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} # ignore error
with:
debug: true
review_simple_changes: false
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/flask-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy Flask to Heroku

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

Comment on lines +13 to +15
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

Update Actions Checkout Version

Static analysis indicates that using actions/checkout@v3 may be outdated. Please verify if a newer version (e.g., actions/checkout@v4) is available and update accordingly to benefit from the latest features and security patches.

-        uses: actions/checkout@v3
+        uses: actions/checkout@v4

🌐 Web query:

What is the latest version of the GitHub Action "actions/checkout"? Does "actions/checkout@v4" exist and is it recommended for use over "actions/checkout@v3" based on GitHub Marketplace or official documentation?

💡 Result:

The latest version of the GitHub Action actions/checkout is v4.2.2, as indicated by its release history [7]. The @v4 tag exists and is actively maintained, with updates as recent as November 2024.

Key Details:

  1. Latest Version:

    • The actions/checkout@v4 line is the current major version, with incremental updates like v4.2.2 addressing bug fixes and security improvements [7][9].
    • Earlier releases under v4 (e.g., v4.1.4) are pinned in workflows for stability, as seen in projects like OpenTofu [1].
  2. Recommendation Over v3:

    • GitHub has deprecated Node.js 16, which actions/checkout@v3 relies on. Upgrading to v4 ensures compatibility with Node.js 20 and avoids warnings or failures [9][12].
    • v4 introduces features like improved sparse checkout support and authentication handling, while maintaining backward compatibility [1][10][18].
  3. Adoption in Official Documentation:

    • The GitHub Marketplace and tutorials now default to v4 for examples, such as cloning repositories, checking out branches, and handling multiple repos [10][18].
    • Workflows like Renovate Bot and Python testing explicitly use actions/checkout@v4 [4][14].

Summary:

  • Use actions/checkout@v4 for new workflows.
  • Migrate from v3 to v4 to ensure compatibility with GitHub’s latest runner environments (Node.js 20) and leverage performance improvements.
  • Pin specific versions (e.g., v4.2.2) for critical workflows to avoid unintended changes [7][10].

Citations:


Action Required: Update GitHub Checkout Action to v4

The current workflow uses actions/checkout@v3, which is now outdated. GitHub’s official documentation and release history confirm that the latest major version is v4 (with recent patches such as v4.2.2), which offers improved features, better Node.js 20 compatibility, and enhanced security. Please update the workflow accordingly.

  • File: .github/workflows/flask-tests.yml (lines 13–15)
  • Change Required:
    -        uses: actions/checkout@v3
    +        uses: actions/checkout@v4
  • Recommendation: Consider pinning a specific v4 release (e.g., v4.2.2) for additional stability if necessary.
📝 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
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4
🧰 Tools
🪛 actionlint (1.7.4)

14-14: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install dependencies
run: |
pip install -r requirements.txt

- name: Deploy to Heroku
run: |
heroku login
git push heroku main
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
venv
__pycache__
app/__pycache__
.github/workflow/*.yml
Bootstrap Studio/*
57 changes: 30 additions & 27 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:\\msys64\\ucrt64\\bin\\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:\\msys64\\ucrt64\\bin\\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"yaml.customTags": [
"!Scalar-example scalar",
"!Seq-example sequence",
"!Mapping-example mapping"
],
"version": "2.0.0"
}
1 change: 1 addition & 0 deletions App/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def create_app(config_class='config.DevelopmentConfig'):
configure_logging(app)
# Enable the toolbar
toolbar = DebugToolbarExtension(app)

login_manager.login_view = 'auth/Login' # Redirect to login page if not logged in
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 that the auth blueprint is properly registered

The login view path 'auth/Login' seems unusual. Flask blueprints typically use dot notation (e.g., 'auth.login'). Also, according to the AI summary, the auth blueprint registration may have been commented out in the blueprints file, which would make this redirect fail.


🏁 Script executed:

#!/bin/bash
# Check if the auth blueprint is registered and if the Login route exists
echo "Checking blueprint registration:"
cat App/blueprints/__init__.py

echo -e "\nChecking for Login route in auth blueprint:"
find App -name "*.py" -exec grep -l "def Login" {} \;
# Also check for route definitions
find App -name "*.py" -exec grep -l "@.*route.*['\"]Login['\"]" {} \;

Length of output: 714


Action Required: Correct Blueprint Registration and Route Naming

  • The auth blueprint is not being registered because its registration line is commented out in App/blueprints/__init__.py (# app.register_blueprint(auth, url_prefix='/auth')). This will cause the login redirect to fail.
  • The login endpoint is set as 'auth/Login', which is inconsistent with Flask’s typical dot notation conventions. It should likely be changed to something like 'auth.login' to correctly reference the endpoint.

Please address these issues by ensuring that:

  • The auth blueprint is properly registered in App/blueprints/__init__.py.
  • The login view is updated to use the proper endpoint naming (e.g., login_manager.login_view = 'auth.login').



Expand Down
Binary file modified App/__pycache__/__init__.cpython-313.pyc
Binary file not shown.
Binary file modified App/__pycache__/extensions.cpython-313.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion App/blueprints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ def register_blueprints(app: Flask):
"""Register all blueprints with the Flask application."""
app.register_blueprint(user_bp, url_prefix='/')
# app.register_blueprint(blog_bp, url_prefix='/blog')
app.register_blueprint(auth, url_prefix='/auth')
# app.register_blueprint(auth, url_prefix='/auth')
Binary file modified App/blueprints/__pycache__/__init__.cpython-313.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion App/blueprints/user/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@login_manager.user_loader
@user_bp.route('')
def home():
return render_template('auth/login.html')
return render_template('base/base.html')
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Incorrect use of @login_manager.user_loader decorator

The @login_manager.user_loader decorator is meant for functions that load a user by ID, not for route definitions. This appears to be a mistake that could interfere with Flask-Login's functionality.

-@login_manager.user_loader
@user_bp.route('')
def home():
    return render_template('base/base.html')
📝 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
@login_manager.user_loader
@user_bp.route('')
def home():
return render_template('auth/login.html')
return render_template('base/base.html')
@user_bp.route('')
def home():
return render_template('base/base.html')


@login_manager.user_loader
@user_bp.route("/testing")
Expand Down
Binary file modified App/blueprints/user/__pycache__/__init__.cpython-313.pyc
Binary file not shown.
5 changes: 5 additions & 0 deletions App/static/bootstrap/css/bootstrap.min.css

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions App/static/css/Footer-Multi-Column-icons.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.bs-icon {
--bs-icon-size: .75rem;
display: flex;
flex-shrink: 0;
justify-content: center;
align-items: center;
font-size: var(--bs-icon-size);
width: calc(var(--bs-icon-size) * 2);
height: calc(var(--bs-icon-size) * 2);
color: var(--bs-primary);
}

.bs-icon-xs {
--bs-icon-size: 1rem;
width: calc(var(--bs-icon-size) * 1.5);
height: calc(var(--bs-icon-size) * 1.5);
}

.bs-icon-sm {
--bs-icon-size: 1rem;
}

.bs-icon-md {
--bs-icon-size: 1.5rem;
}

.bs-icon-lg {
--bs-icon-size: 2rem;
}

.bs-icon-xl {
--bs-icon-size: 2.5rem;
}

.bs-icon.bs-icon-primary {
color: var(--bs-white);
background: var(--bs-primary);
}

.bs-icon.bs-icon-primary-light {
color: var(--bs-primary);
background: rgba(var(--bs-primary-rgb), .2);
}

.bs-icon.bs-icon-semi-white {
color: var(--bs-primary);
background: rgba(255, 255, 255, .5);
}

.bs-icon.bs-icon-rounded {
border-radius: .5rem;
}

.bs-icon.bs-icon-circle {
border-radius: 50%;
}

24 changes: 5 additions & 19 deletions App/static/css/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,12 @@
box-sizing: border-box;
}

header,
footer {
background-color: lightgray;
width: 100dvw;
height: 10dvh;
}

header {
display: flex;
align-items: center;
justify-content: space-around;
}
header a {
color: black;
text-decoration: none;
transition: color 0.3s;
}

main {
background-color: antiquewhite;
width: 100dvw;
min-height: 80dvh;
min-height: 60dvh;
}

footer {
height: 25dvh;
}/*# sourceMappingURL=login.css.map */
2 changes: 1 addition & 1 deletion App/static/css/login.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 6 additions & 17 deletions App/static/css/login.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,16 @@
padding: 0;
box-sizing: border-box;
}
header,
footer {
background-color: lightgray;
width: 100dvw;
height: 10dvh;
}
header {
display: flex;
align-items: center;
justify-content: space-around;
a {
color: black;
text-decoration: none;
transition: color 0.3s;
}
}

main {
background-color: antiquewhite;
width: 100dvw;
min-height: 80dvh;
min-height: 60dvh;
}
footer {
height: 25dvh;
}

// body {
// display: grid;
// place-content: center;
Expand Down
Binary file added App/static/img/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added App/static/img/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added App/static/img/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added App/static/img/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added App/static/img/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added App/static/img/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions App/static/img/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
25 changes: 25 additions & 0 deletions App/templates/base/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="../static/css/login.css" />
<link
rel="icon"
type="image/x-icon"
href="{{ url_for('static', filename='img/favicon.ico') }}"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
/>
<script
defer
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
></script>
<!-- -->

<link
rel="stylesheet"
href="{{ url_for('static', filename='css/Footer-Multi-Column-icons.css') }}"
/>
<link
rel="stylesheet"
href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css') }}"
/>
<title>Document</title>
</head>
<body>
Expand All @@ -16,5 +39,7 @@
</main>

{% include 'base/footer.html' %}
<!-- -->
{% block Js %} {% endblock %}
</body>
</html>
Loading
Loading