Skip to content

Ci/setup pipeline #149

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

floriangab
Copy link

This is the project’s continuous integration and code quality checks:

  • GitHub Actions
    • Added .github/workflows/ci.yaml to run pre-commit hooks, linting, type-checking and tests on every PR
  • Pre-commit hooks (.pre-commit-config.yaml)
    • TruffleHog for secret scanning (commit & push)
    • Black + isort for consistent Python formatting (commit)
    • Flake8 + mypy for deeper code analysis (push)
    • Yamllint for YAML validation (commit)
    • Hadolint for Dockerfile linting (commit)
  • Configuration files
    • New pyproject.toml with Black/isort settings (PEP-440 compliance, 88-char line length)
    • New .yamllint to enforce a 120-char limit on YAML files
  • CI setup
    • Updated requirements-dev.txt and installation scripts to include CI & linting dependencies

floriangab added 3 commits May 1, 2025 17:43
- Add Black and isort hooks for Python formatting on commit
- Add YAML linting via adrienverge/yamllint (commit stage)
- Configure flake8 and mypy to run on push
- Update installation scripts to include development dependencies
- Add GitHub Actions workflow (`.github/workflows/ci.yml`) for automated CI
- Run pre-commit hooks to auto-format and lint existing files
- Apply Black formatting and isort import sorting
- Fix trailing whitespace, EOF newlines and YAML style issues
- Ensure codebase consistency after integrating new hooks
- Update GitHub Actions CI workflow (.github/workflows/ci.yaml)
- Refine pre-commit hooks (.pre-commit-config.yaml)
- Add YAML linting config (.yamllint)
- Add Black/isort settings in pyproject.toml
- Update development dependencies (requirements-dev.txt)
- Adjust API and CLI entrypoints (api.py, cli.py)
- Tweak Docker setup (docker-compose.yml)
- Refactor LLM provider integration (sources/llm_provider.py)
@floriangab
Copy link
Author

Before to run the new CI and pre-commit setup, please be aware that our codebase currently has a number of outstanding lint issues.
You’ll likely see failures related to:

  • Line-length violations in both Python and YAML files (many lines exceed our 88- or 120-character limits)
  • Unused imports and classes flagged by flake8/mypy
  • Broken tests that need adjustments to pass under the stricter environment

Running the full CI pipeline will almost certainly cause builds to fail initially. I’ll be cleaning up long lines, removing dead code, and fixing tests in follow-up commits.

Thanks for your patience!

Repository owner deleted a comment from ziryge May 2, 2025
@itJunky
Copy link

itJunky commented May 8, 2025

ooooohjhhhh this is git saboteur

@Fosowl
Copy link
Owner

Fosowl commented May 8, 2025

@itJunky Why do you say ‘git saboteur’? I’d appreciate better feedback on the PR and the discussion constructive

@entelligence-ai-reviews

Review Summary

Skipped posting 18 drafted comments based on your review threshold. Feel free to update them here.

Draft Comments
Dockerfile.backend:48-48
Dockerfile should end with a newline character. Missing a final newline can cause issues with some tools and is considered a best practice for text files.

Scores:

  • Production Impact: 1
  • Fix Specificity: 5
  • Urgency Impact: 1
  • Total Score: 7

Reason for filtering: The issue of missing a newline at the end of a Dockerfile is a minor style concern with minimal production impact. While it follows best practices, it doesn't affect functionality in most cases.

Analysis: This comment addresses a style issue with a clear fix but has minimal production impact. Missing a newline at the end of a Dockerfile rarely causes actual problems in production environments. The fix is very specific and easy to implement, but the urgency is very low as this won't affect system functionality. With a total score of 7, which is below the threshold of 13, this comment should be removed.

cli.py:108-109
Missing newline at end of file. The file ends with a backslash followed by 'No newline at end of file' comment, which indicates a file formatting issue that could cause problems with some tools.

Scores:

  • Production Impact: 1
  • Fix Specificity: 5
  • Urgency Impact: 1
  • Total Score: 7

Reason for filtering: This comment addresses a minor style issue with no significant production impact. Missing a newline at the end of a file is a formatting convention that most modern tools handle gracefully.

Analysis: The issue is purely stylistic with minimal production impact. While the fix is very clear and specific, the urgency is very low as this won't affect functionality. Total score of 7 falls below the required threshold of 13.

frontend/agentic-seek-front/public/index.html:14-15
The HTML file is missing a proper newline at the end of file (EOF), which is a common best practice for text files to ensure proper concatenation and avoid issues with some tools.

Scores:

  • Production Impact: 1
  • Fix Specificity: 5
  • Urgency Impact: 1
  • Total Score: 7

Reason for filtering: The comment about missing a newline at the end of file is a minor style issue with minimal production impact, clear but trivial fix, and very low urgency. The total score is below the threshold of 13.

Analysis: Missing newline at EOF is a style convention that won't affect functionality. The fix is extremely clear (add a newline), but this is purely cosmetic with no real production impact or urgency. Total score of 7 is well below the threshold of 13.

sources/agents/agent.py:157-157
There's a typo in the wait_message method where 'recommand' is used instead of 'recommend', which could confuse users seeing this message.

Scores:

  • Production Impact: 1
  • Fix Specificity: 5
  • Urgency Impact: 1
  • Total Score: 7

Reason for filtering: This is a simple typo correction with minimal production impact that doesn't meet the threshold score for inclusion.

Analysis: The comment addresses a simple spelling error in a user-facing message. While the fix is very specific and straightforward, the typo has minimal impact on production functionality and very low urgency. The total score of 7 falls well below the required threshold of 13 for inclusion.

sources/agents/browser_agent.py:406-413
The `select_link` method returns `str | None` but uses `link == None` comparison instead of the more Pythonic `link is None`, which could lead to unexpected behavior if a string with a custom `__eq__` method is used.

Scores:

  • Production Impact: 2
  • Fix Specificity: 5
  • Urgency Impact: 2
  • Total Score: 9

Reason for filtering: The total score is below the threshold of 13 required for inclusion

Analysis: While using 'is None' is more Pythonic than '== None', the actual production impact is low as most strings won't have custom eq methods that would cause issues. The fix is very specific and directly applicable, but the urgency is low since this is primarily a code style improvement with minimal risk of actual runtime issues.

sources/memory.py:181-181
The `summarize` method doesn't properly return the modified summary. The line `summary.replace('summary:', '')` doesn't modify the `summary` variable as `replace()` returns a new string but doesn't modify the original.

Scores:

  • Production Impact: 4
  • Fix Specificity: 5
  • Urgency Impact: 4
  • Total Score: 13

Reason for filtering: The comment identifies a legitimate bug where string.replace() doesn't modify the original string in-place, which could lead to functional issues.

Analysis: This is a correctness issue that would cause the summarize method to not work as intended. The bug is that string.replace() returns a new string rather than modifying in-place, so the summary variable isn't being updated. The fix is clear and directly applicable (assign the result back to the variable). This would likely cause functional issues in production as the summary text wouldn't be properly processed, affecting downstream functionality.

sources/memory.py:108-108
The `reset` method has a mutable default argument `memory: list = []` which can lead to unexpected behavior if the default is modified across multiple calls.

Scores:

  • Production Impact: 4
  • Fix Specificity: 5
  • Urgency Impact: 4
  • Total Score: 13

Reason for filtering: The comment identifies a legitimate bug with mutable default arguments in Python that can cause unexpected behavior

Analysis: This is a well-known Python pitfall where mutable default arguments are initialized once at function definition time, not at each call. This can cause unexpected behavior when the default list is modified across multiple calls, potentially leading to data corruption or unexpected state. The fix is specific, correct, and immediately applicable. While not causing immediate crashes, this issue can lead to subtle bugs that are hard to debug in production.

sources/memory.py:109-110
The `reset` method doesn't handle the case when `memory` is `None`. After changing the default parameter to `None`, we need to initialize it to an empty list.

Scores:

  • Production Impact: 4
  • Fix Specificity: 5
  • Urgency Impact: 4
  • Total Score: 13

Reason for filtering: The comment identifies a legitimate bug where the reset method doesn't handle None values for memory parameter, which could lead to runtime errors.

Analysis: This is a correctness issue that could cause runtime errors when memory is None. The fix is clear, specific and directly applicable. The issue should be addressed soon to prevent potential crashes when the reset method is called with None.

sources/memory.py:28-29
The `__init__` method initializes `self.memory` twice, with the second initialization overwriting the first one, making the first assignment redundant.

Scores:

  • Production Impact: 2
  • Fix Specificity: 5
  • Urgency Impact: 2
  • Total Score: 9

Reason for filtering: The comment identifies a valid code issue with a clear fix

Analysis: The issue is a redundant initialization that doesn't affect functionality but creates unnecessary code. The fix is extremely clear and directly applicable. While it's not causing production issues, it's a legitimate code improvement. However, the total score of 9 is below the threshold of 13, so this comment would be filtered out under the current rules.

sources/schemas.py:46-76
The `executorResult` class name violates Python naming conventions. Class names should use CamelCase (PEP 8), so it should be renamed to `ExecutorResult`.

Scores:

  • Production Impact: 1
  • Fix Specificity: 5
  • Urgency Impact: 1
  • Total Score: 7

Reason for filtering: This is a style-only issue with minimal production impact. The comment addresses Python naming conventions (PEP 8) for class names, which should use CamelCase. While the fix is clear and specific, this type of style issue has no impact on functionality or production stability.

Analysis: The comment addresses a PEP 8 style violation for class naming. While the fix is extremely clear and specific (changing 'executorResult' to 'ExecutorResult'), this is purely a style issue with no functional impact on production systems. The urgency is very low as this is just a cosmetic improvement. With a total score of 7, which is below the threshold of 13, this comment should be removed.

sources/speech_to_text.py:331-332
The file ends with a backslash followed by 'No newline at end of file' comment, which is likely an artifact from a diff tool. This should be removed and replaced with a proper newline.

Scores:

  • Production Impact: 1
  • Fix Specificity: 5
  • Urgency Impact: 1
  • Total Score: 7

Reason for filtering: The issue is a minor formatting problem with no functional impact on the code. The missing newline at the end of file is a stylistic convention but doesn't affect code execution or functionality.

Analysis: This comment addresses a missing newline at the end of file, which is purely stylistic. While the fix is very specific and clear, it has minimal production impact and very low urgency. The total score of 7 falls below the required threshold of 13.

sources/tools/BashInterpreter.py:29-43
Duplicate entries for `rustc` and `rustc++` in the `lang_interpreter` list will cause redundant checks when detecting language execution attempts.

Scores:

  • Production Impact: 3
  • Fix Specificity: 5
  • Urgency Impact: 3
  • Total Score: 11

Reason for filtering: The comment identifies a legitimate issue with duplicate entries in a list that could cause redundant checks and inefficiency.

Analysis: The duplicate entries for 'rustc' and 'rustc++' in the list will cause redundant checks when detecting language execution attempts, which could lead to inefficiency but not critical failures. The fix is extremely clear and directly applicable - simply remove the duplicate entries. While this is a correctness issue, it's not likely to cause immediate system failures, just unnecessary processing. With a total score of 11, this falls below the threshold of 13 required to be included.

sources/tools/__init__.py:5-14
Duplicate entry `GoInterpreter` in `__all__` list will cause a warning at runtime and could lead to confusion for users of the module.

Scores:

  • Production Impact: 2
  • Fix Specificity: 5
  • Urgency Impact: 2
  • Total Score: 9

Reason for filtering: The total score is below the threshold of 13 required for inclusion

Analysis: Duplicate entry in all causes a warning but not a critical failure. The fix is extremely clear and specific. While this should be fixed, it's not urgent as it only causes a warning at runtime and minor confusion for module users.

sources/tools/fileFinder.py:64-74
Duplicate file extension `.so` in the `excluded_files` list will cause redundant checks during file filtering.

Scores:

  • Production Impact: 1
  • Fix Specificity: 5
  • Urgency Impact: 1
  • Total Score: 7

Reason for filtering: The issue is a minor duplication in a list of file extensions that would only cause redundant checks during filtering, with minimal production impact.

Analysis: The duplicate '.so' entry in the excluded_files list would only cause redundant checks during file filtering, which is inefficient but would not cause any functional issues or crashes in production. The fix is extremely clear and specific (just remove the duplicate entry). However, this is a very low urgency issue as the redundant check would have minimal performance impact and wouldn't cause any system failures. With a total score of 7, this falls well below the threshold of 13 required for inclusion.

sources/tools/safety.py:87-89
Missing newline at end of file. The file ends with a backslash followed by 'No newline at end of file' comment, which indicates a file formatting issue that could cause problems with some tools.

Scores:

  • Production Impact: 1
  • Fix Specificity: 5
  • Urgency Impact: 1
  • Total Score: 7

Reason for filtering: The total score is below the threshold of 13 required to keep the comment

Analysis: This is a minor style issue about missing a newline at the end of a file. While the fix is very clear and specific (adding a newline), it has minimal production impact and very low urgency. Most modern tools handle this gracefully, and it won't cause functional problems in the code execution.

sources/tools/webSearch.py:32-39
The `webSearch` class has a trailing comma in the `paywall_keywords` list which could cause issues in some Python versions. While Python 3 allows trailing commas in lists, it's inconsistent with the rest of the codebase style.

Scores:

  • Production Impact: 1
  • Fix Specificity: 5
  • Urgency Impact: 1
  • Total Score: 7

Reason for filtering: The issue is a minor style concern about a trailing comma in a Python list, which has no functional impact in Python 3. The total score is below the required threshold of 13.

Analysis: This is a purely stylistic issue with trailing commas in Python lists. Python 3 fully supports trailing commas, so there's no functional impact. The fix is very clear and specific, but the urgency and production impact are minimal as this won't cause any runtime issues.

sources/tools/webSearch.py:87-91
The `params` dictionary in the `search` method has a trailing comma which is inconsistent with the codebase style and could cause issues in some Python versions.

Scores:

  • Production Impact: 1
  • Fix Specificity: 5
  • Urgency Impact: 1
  • Total Score: 7

Reason for filtering: The comment addresses a trailing comma in a Python dictionary which is valid syntax in all modern Python versions and is a minor style issue with no production impact.

Analysis: Trailing commas in dictionaries are valid in Python 2.7+ and actually considered good practice in many style guides as they make diffs cleaner when adding new items. This is purely a style preference with no functional impact. The fix is very specific but addresses a non-issue that doesn't affect production or require urgent attention.

sources/tools/webSearch.py:93-93
The condition `if not "OK" in status:` uses a non-idiomatic pattern for string checking. It should be `if "OK" not in status:` for better readability and to follow Python conventions.

Scores:

  • Production Impact: 1
  • Fix Specificity: 5
  • Urgency Impact: 1
  • Total Score: 7

Reason for filtering: This comment addresses a minor style issue with no functional impact. The suggested change from 'if not "OK" in status:' to 'if "OK" not in status:' is purely stylistic and doesn't affect program behavior.

Analysis: This is a purely stylistic change with no impact on functionality. While the fix is very clear and specific (5), it has minimal production impact (1) and very low urgency (1). The total score of 7 is well below the threshold of 13, so this comment should be removed.

@entelligence-ai-reviews

Walkthrough

This PR focuses on codebase quality, maintainability, and developer tooling. It introduces a comprehensive CI pipeline, standardizes code formatting and linting via pre-commit and related tools, and applies extensive code style refactoring across Python, JavaScript, and documentation files. Minor logic improvements and bug fixes are included in agent and browser modules, while most changes are non-functional, targeting whitespace, import order, and formatting. New configuration files for development and CI are added, and installation scripts are updated to support dev dependencies, enhancing the developer experience and code consistency.

Changes

File(s) Summary
.github/workflows/ci.yaml Added new GitHub Actions CI workflow for pre-commit and pytest jobs.
.pre-commit-config.yaml
pyproject.toml
requirements-dev.txt
Added/updated pre-commit config, isort/black settings, and dev requirements for code quality and formatting.
.yamllint Added yamllint configuration for YAML linting.
scripts/linux_install.sh
scripts/macos_install.sh
scripts/windows_install.bat
Updated install scripts to include dev dependencies from requirements-dev.txt.
api.py
cli.py
llm_server/app.py
sources/agents/agent.py
sources/agents/browser_agent.py
sources/agents/casual_agent.py
sources/agents/code_agent.py
sources/agents/file_agent.py
sources/agents/planner_agent.py
sources/browser.py
sources/interaction.py
sources/language.py
sources/llm_provider.py
sources/logger.py
sources/memory.py
sources/router.py
sources/schemas.py
sources/speech_to_text.py
sources/text_to_speech.py
sources/tools/BashInterpreter.py
sources/tools/C_Interpreter.py
sources/tools/GoInterpreter.py
sources/tools/JavaInterpreter.py
sources/tools/PyInterpreter.py
sources/tools/init.py
sources/tools/fileFinder.py
sources/tools/flightSearch.py
sources/tools/mcpFinder.py
sources/tools/safety.py
sources/tools/searxSearch.py
sources/tools/tools.py
sources/tools/webSearch.py
sources/utility.py
Refactored for code style: reordered imports, standardized string quoting, improved formatting, minor logic/bug fixes in some agent and browser modules.
Dockerfile.backend
frontend/Dockerfile.frontend
llm_server/Dockerfile
Added newline at EOF for formatting compliance.
config.ini
llm_router/config.json
llm_router/examples.json
llm_server/requirements.txt
searxng/docker-compose.yml
searxng/searxng/settings.yml
searxng/searxng/uwsgi.ini
searxng/settings.yml
searxng/setup_searxng.sh
start_services.cmd
start_services.sh
Added newline at EOF or removed 'No newline' marker for formatting.
README.md
README_CHS.md
README_CHT.md
README_FR.md
README_JP.md
docs/CONTRIBUTING.md
Minor formatting/whitespace corrections in documentation.
docker-compose.yml Improved comments and formatting for backend service documentation.
prompts/base/browser_agent.txt
prompts/base/casual_agent.txt
prompts/base/coder_agent.txt
prompts/base/file_agent.txt
prompts/base/planner_agent.txt
prompts/jarvis/browser_agent.txt
prompts/jarvis/casual_agent.txt
prompts/jarvis/coder_agent.txt
prompts/jarvis/file_agent.txt
prompts/jarvis/planner_agent.txt
Minor formatting: removed trailing spaces, ensured newline at EOF, improved prompt text consistency.
frontend/agentic-seek-front/public/index.html
frontend/agentic-seek-front/src/App.css
frontend/agentic-seek-front/src/index.js
frontend/agentic-seek-front/src/logo.svg
sources/web_scripts/find_inputs.js
sources/web_scripts/inject_safety_script.js
Added newline at EOF for formatting.
frontend/agentic-seek-front/src/colors.js Removed trailing whitespace in color definitions.
setup.py Reordered imports, added trailing comma in dependencies for style.
sources/agents/init.py
sources/tools/init.py
Reorganized imports, reformatted all lists for clarity.
llm_router/dl_safetensors.sh
llm_server/install.sh
Formatting: ensured newline at EOF, removed trailing whitespace.
tests/test_browser_agent_parsing.py
tests/test_memory.py
tests/test_provider.py
tests/test_searx_search.py
Code style improvements: reordered imports, standardized string quoting, improved formatting in tests.

Sequence Diagram

This diagram shows the interactions between components:

sequenceDiagram
    title API Key Configuration and Usage Flow
    
    actor User
    participant App as "Application"
    participant Config as "Configuration Service"
    participant SearxNG as "SearxNG Search Service"
    participant OpenAI as "OpenAI API"
    participant DeepSeek as "DeepSeek API"
    
    User->>App: Make request
    
    App->>Config: Load configuration
    activate Config
    Config-->>App: Return API endpoints and keys
    deactivate Config
    
    Note over App,Config: Configuration now includes:<br/>- SEARXNG_BASE_URL<br/>- OPENAI_API_KEY<br/>- DEEPSEEK_API_KEY (moved in PR)
    
    alt Search request
        App->>SearxNG: Query(SEARXNG_BASE_URL)
        SearxNG-->>App: Search results
    else OpenAI request
        App->>OpenAI: API call with OPENAI_API_KEY
        OpenAI-->>App: AI response
    else DeepSeek request
        App->>DeepSeek: API call with DEEPSEEK_API_KEY
        DeepSeek-->>App: AI response
    end
    
    App-->>User: Return response
Loading

▶️AI Code Reviews for VS Code, Cursor, Windsurf
Install the extension

Note for Windsurf Please change the default marketplace provider to the following in the windsurf settings:

Marketplace Extension Gallery Service URL: https://marketplace.visualstudio.com/_apis/public/gallery

Marketplace Gallery Item URL: https://marketplace.visualstudio.com/items

Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts below

Emoji Descriptions:

  • ⚠️ Potential Issue - May require further investigation.
  • 🔒 Security Vulnerability - Fix to ensure system safety.
  • 💻 Code Improvement - Suggestions to enhance code quality.
  • 🔨 Refactor Suggestion - Recommendations for restructuring code.
  • ℹ️ Others - General comments and information.

Interact with the Bot:

  • Send a message or request using the format:
    @entelligenceai + *your message*
Example: @entelligenceai Can you suggest improvements for this code?
  • Help the Bot learn by providing feedback on its responses.
    @entelligenceai + *feedback*
Example: @entelligenceai Do not comment on `save_auth` function !

Also you can trigger various commands with the bot by doing
@entelligenceai command

The current supported commands are

  1. config - shows the current config
  2. retrigger_review - retriggers the review

More commands to be added soon.

Comment on lines +29 to +50
tests:
runs-on: ubuntu-latest
needs: pre-commit
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'

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

- name: Run tests
run: |
pytest --maxfail=1 --disable-warnings -q

Choose a reason for hiding this comment

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

Correctness: The tests job is missing proper YAML indentation, causing it to be parsed as a top-level key rather than a job under the jobs section.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
tests:
runs-on: ubuntu-latest
needs: pre-commit
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest
- name: Run tests
run: |
pytest --maxfail=1 --disable-warnings -q
tests:
runs-on: ubuntu-latest
needs: pre-commit
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest
- name: Run tests
run: |
pytest --maxfail=1 --disable-warnings -q

Comment on lines +29 to +50
tests:
runs-on: ubuntu-latest
needs: pre-commit
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'

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

- name: Run tests
run: |
pytest --maxfail=1 --disable-warnings -q

Choose a reason for hiding this comment

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

Correctness: The tests job needs to be properly indented under the jobs section to be recognized as a GitHub Actions job.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
tests:
runs-on: ubuntu-latest
needs: pre-commit
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest
- name: Run tests
run: |
pytest --maxfail=1 --disable-warnings -q
tests:
runs-on: ubuntu-latest
needs: pre-commit
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest
- name: Run tests
run: |
pytest --maxfail=1 --disable-warnings -q

Comment on lines +12 to +28
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'

- name: Install pre-commit dependencies
run: pip install -r requirements-dev.txt

- name: Run all hooks
uses: pre-commit/[email protected]
with:
extra_args: --all-files

Choose a reason for hiding this comment

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

Correctness: The pre-commit job steps need proper indentation to conform to GitHub Actions YAML syntax requirements.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install pre-commit dependencies
run: pip install -r requirements-dev.txt
- name: Run all hooks
uses: pre-commit/[email protected]
with:
extra_args: --all-files
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install pre-commit dependencies
run: pip install -r requirements-dev.txt
- name: Run all hooks
uses: pre-commit/[email protected]
with:
extra_args: --all-files

Comment on lines +2 to +9
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace # remove trailing whitespace
stages: [pre-commit]
- id: end-of-file-fixer # ensure a newline at end of file
stages: [pre-commit]

Choose a reason for hiding this comment

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

Security: The TruffleHog secret scanning hook has been completely removed, which eliminates an important security check that was previously running on both commit and push stages.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
# General quick fixes before every commit
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace # remove trailing whitespace
stages: [pre-commit]
- id: end-of-file-fixer # ensure a newline at end of file
stages: [pre-commit]
# Secret scanning to prevent accidental credential leaks
- repo: https://github.com/trufflesecurity/trufflehog
rev: v3.63.2
hooks:
- id: trufflehog # detect secrets in your data
stages: [commit, push]
args: [--only-verified]

Comment on lines 190 to 191
return JSONResponse(status_code=200, content=query_resp_history[-1])
return JSONResponse(status_code=404, content={"error": "No answer available"})

Choose a reason for hiding this comment

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

Correctness: The get_latest_answer function has two return statements in sequence, making the second one unreachable. The second return statement should be inside the else branch of the preceding if condition.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
return JSONResponse(status_code=200, content=query_resp_history[-1])
return JSONResponse(status_code=404, content={"error": "No answer available"})
return JSONResponse(status_code=200, content=query_resp_history[-1])
else:
return JSONResponse(status_code=404, content={"error": "No answer available"})

Comment on lines +15 to 16
with open(self.cache_file, "r") as f:
self.cache = set(json.load(f))

Choose a reason for hiding this comment

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

Correctness: The cache is initialized as a set from a JSON list, but later saved back as a set which is not JSON serializable. This will cause a TypeError: Object of type set is not JSON serializable when _save() is called.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
with open(self.cache_file, "r") as f:
self.cache = set(json.load(f))
with open(self.cache_file, "r") as f:
self.cache = json.load(f)

Comment on lines 362 to +365
except AuthenticationError:
raise AuthenticationError("Authentication failed. Please check your token.") from e
raise AuthenticationError(
"Authentication failed. Please check your token."
) from e

Choose a reason for hiding this comment

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

Correctness: Missing e variable in except AuthenticationError: block which causes a NameError when this exception is raised. The exception handler references e but it's not captured in the except clause.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
except AuthenticationError:
raise AuthenticationError("Authentication failed. Please check your token.") from e
raise AuthenticationError(
"Authentication failed. Please check your token."
) from e
except AuthenticationError as e:
raise AuthenticationError(
"Authentication failed. Please check your token."
) from e

result = {
"filename": os.path.basename(file_path),
"path": file_path,
"type": file_type,
"read": content,
"permissions": permissions
"permissions": permissions,

Choose a reason for hiding this comment

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

Correctness: The permissions variable is used in the result dictionary but is not defined anywhere in the get_file_info method.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
"permissions": permissions,
"permissions": stat.filemode(stats.st_mode),

Comment on lines 24 to 28
def execute(self, blocks: str, safety: bool = True) -> str:
if self.api_key is None:
return "Error: No AviationStack API key provided."

for block in blocks:

Choose a reason for hiding this comment

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

Correctness: The execute method is iterating over blocks as if it's a list of strings, but the parameter is defined as a string. This will cause a TypeError at runtime when trying to iterate over a string character by character.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
def execute(self, blocks: str, safety: bool = True) -> str:
if self.api_key is None:
return "Error: No AviationStack API key provided."
for block in blocks:
def execute(self, blocks: list[str], safety: bool = True) -> str:
if self.api_key is None:
return "Error: No AviationStack API key provided."
for block in blocks:

Comment on lines 46 to +47
def set_allow_language_exec_bash(value: bool) -> None:
self.allow_language_exec_bash = value

self.allow_language_exec_bash = value

Choose a reason for hiding this comment

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

Correctness: The set_allow_language_exec_bash method is missing the self parameter, which will cause a runtime error when called. The method needs self as its first parameter since it's an instance method.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
def set_allow_language_exec_bash(value: bool) -> None:
self.allow_language_exec_bash = value
self.allow_language_exec_bash = value
def set_allow_language_exec_bash(self, value: bool) -> None:
self.allow_language_exec_bash = value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants