Skip to content

chore: run ruff format across nodes/src/nodes/ for consistent baseline#485

Open
josephmccann wants to merge 1 commit intorocketride-org:developfrom
josephmccann:chore/ruff-formatting-baseline
Open

chore: run ruff format across nodes/src/nodes/ for consistent baseline#485
josephmccann wants to merge 1 commit intorocketride-org:developfrom
josephmccann:chore/ruff-formatting-baseline

Conversation

@josephmccann
Copy link
Copy Markdown
Contributor

@josephmccann josephmccann commented Mar 30, 2026

Fixes #432

Run ruff format across nodes/src/nodes/ Python files to establish a consistent formatting baseline.

Changes:

  • 45 files reformatted with ruff
  • No logic changes — formatting only

This is the one-time pass referenced in the issue before CI enforcement is added.

Summary by CodeRabbit

  • Style
    • Code formatting and consistency improvements throughout the codebase, including string literal standardization, consolidated multi-line expressions, and whitespace normalization. No changes to functionality or behavior.

Fixes rocketride-org#432

Run `ruff format` across nodes/src/nodes/ Python files to establish a
consistent formatting baseline.

Changes:
- 45 files reformatted with ruff
- No logic changes — formatting only

This is the one-time pass referenced in the issue before CI enforcement is added.
@github-actions github-actions bot added the module:nodes Python pipeline nodes label Mar 30, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

Applies ruff format across 50+ Python files throughout the nodes package to establish consistent code formatting. Changes include string quote normalization, trailing whitespace removal, single-line/multi-line literal reformatting, and operator spacing adjustments.

Changes

Cohort / File(s) Summary
Agent Framework Files
nodes/src/nodes/accessibility_describe/accessibility_vision.py, nodes/src/nodes/agent_crewai/crewai.py, nodes/src/nodes/agent_langchain/IInstance.py, nodes/src/nodes/agent_langchain/langchain.py, nodes/src/nodes/agent_rocketride/*
String quote normalization, multi-line string/list literal collapsing, trailing blank line removal, operator spacing in exponentiation/slicing.
Anonymization & NER Modules
nodes/src/nodes/anonymize/*, nodes/src/nodes/ner/*
Multi-line list literal to single-line reformatting, trailing whitespace normalization, blank line insertions for readability.
Database Connection Files
nodes/src/nodes/db_mysql/IGlobal.py, nodes/src/nodes/db_postgres/IGlobal.py
Dictionary key-value alignment adjustments in connection parameter formatting.
Search/Index Files
nodes/src/nodes/index_search/*
String quote style updates, single-line log/warning call collapsing, trailing blank line removal, blank line insertion after module docstrings.
Chart & Visualization
nodes/src/nodes/chart_chartjs/IInstance.py, nodes/src/nodes/chart_chartjs/chartjs_driver.py
Multi-line error/string literals condensed to single-line f-strings, list constant reformatting, schema description string simplification.
Tool Integration Files
nodes/src/nodes/tool_firecrawl/firecrawl_driver.py, nodes/src/nodes/tool_http_request/*
Slice operator spacing, multi-line comprehension/chain collapsing, error message f-string single-lining, blank line insertions.
MCP Client Module
nodes/src/nodes/mcp_client/*
Type annotation quote style (double to single), trailing blank line removal, multi-line f-string collapsing, quote normalization in constants.
LLM & Library Files
nodes/src/nodes/llm_ibm_watson/ibm_watson.py, nodes/src/nodes/llm_openai/IGlobal.py, nodes/src/nodes/library/*
Frozenset/tuple literal multi-line expansion, error message f-string reformatting, trailing whitespace cleanup, blank line normalization.
Document Processing
nodes/src/nodes/ocr/*, nodes/src/nodes/llamaparse/IInstance.py
Multi-line f-string collapsing, dictionary key quote normalization, blank line insertions around helper functions/blocks.
Utilities & Storage
nodes/src/nodes/audio_transcribe/IGlobal.py, nodes/src/nodes/autopipe/IGlobal.py, nodes/src/nodes/memory_internal/memory.py, nodes/src/nodes/vectordb_postgres/vectordb_postgres.py
List comprehension single-lining, blank line removal, slice operator spacing, SQL string query collapsing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PR #358 — Both modify nodes/src/nodes/llm_ibm_watson/ibm_watson.py; this PR reformats _VALID_LOCATIONS and error messages while the related PR touches validation logic in the same area.
  • PR #235 — Both touch nodes/src/nodes/chart_chartjs/chartjs_driver.py; this PR applies formatting while the related PR modifies constants and error messages in the driver.
  • PR #215 — Both modify nodes/src/nodes/agent_rocketride/* files (IGlobal, executor, rocketride_agent); this PR applies formatting-only changes to files introduced/modified by the related PR.

Suggested labels

module:nodes

Suggested reviewers

  • jmaionchi
  • stepmikhaylov
  • Rod-Christensen

Poem

🐰 A hop through the code, so neat and so clean,
With ruff as our guide, the finest formatting seen—
From quotes to the spacing, each detail aligned,
No logic harmed here, just beauty refined!
The baseline is set, consistent and bright,
No more style drift will dilute our next night! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR partially addresses issue #432 by executing the one-time ruff format pass across 45 Python files with no logic changes, but does not include the required pyproject.toml config, CI enforcement setup, or CONTRIBUTING.md updates. Add [tool.ruff] configuration to pyproject.toml, integrate ruff check/format --check into CI, and update CONTRIBUTING.md with formatter documentation before merging.
Docstring Coverage ⚠️ Warning Docstring coverage is 65.85% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the primary change: running ruff format across the nodes directory to establish a consistent formatting baseline.
Out of Scope Changes check ✅ Passed All file changes are in-scope: they consist exclusively of whitespace and formatting adjustments applied by ruff across the nodes/src/nodes/ directory with no functional logic modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@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: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@nodes/src/nodes/accessibility_describe/accessibility_vision.py`:
- Line 147: Change the returned string to use single-quoted string literals per
the nodes/**/*.py guideline; update the return in accessibility_vision.py (the
line that builds the message using self._model) to use single quotes for the
outer string and escape the inner single quotes around the model placeholder so
the message remains identical (i.e., keep the same text including the quotes
around the model but switch outer quotes to single and escape the inner ones).
- Line 70: Replace the double-quoted string value for the 'clock' key in the
accessibility_vision dictionary with a single-quoted string and escape the
internal single quote (i.e., change the value for the 'clock' key in
nodes/src/nodes/accessibility_describe/accessibility_vision.py), and also update
the project's tooling by adding quote-style = 'single' to the [tool.ruff]
section of pyproject.toml so Ruff enforces single-quote strings across
nodes/**/*.py.

In `@nodes/src/nodes/anonymize/glinerRecognizer.py`:
- Line 237: Replace the nested generator expression used to build
existing_matches with a direct list comprehension to avoid Ruff C400 and extra
overhead: change the current expression that uses list((m['offset'],
m['length']) for m in ((m.get('location', {}).get('inChars') or m) for m in
text_matches)) to a comprehension like [(m['offset'], m['length']) for tm in
text_matches for m in (tm.get('location', {}).get('inChars') or tm)] so the same
elements are produced without the intermediate generator; update the assignment
to existing_matches accordingly.

In `@nodes/src/nodes/anonymize/IInstance.py`:
- Line 32: DEFAULT_PII_LABELS is defined as a mutable class-level list on
IInstance which can be accidentally mutated across instances; change it to an
immutable tuple (e.g., DEFAULT_PII_LABELS = ('person', 'name', ...)) to prevent
shared-state bugs and update any uses expecting a list (convert to list locally
if needed) and re-run Ruff formatting/linting for the nodes package.

In `@nodes/src/nodes/llamaparse/IInstance.py`:
- Line 322: Replace the use of str(e) in the f-string that constructs error_text
with the f-string conversion flag e!s to satisfy Ruff RUF010 and PEP style;
locate the error_text assignment in IInstance.py (the f-string that begins '#
LlamaParse Processing Error') and change the embedded expression from {str(e)}
to {e!s} so the exception is formatted using the conversion flag.

In `@nodes/src/nodes/llm_ibm_watson/ibm_watson.py`:
- Line 71: The long inline error message in the raise Expression triggers Ruff
TRY003; change the code to build the message string before raising: construct a
variable (e.g., msg = f'Unknown IBM Cloud location: {location!r}. Valid
locations: {", ".join(sorted(_VALID_LOCATIONS))}') and then use raise
ValueError(msg) so the message construction is not inside the raise; reference
the existing variables/location and _VALID_LOCATIONS used in the current check.

In `@nodes/src/nodes/ner/IInstance.py`:
- Around line 96-98: The code uses an unnecessary intermediate list when
deduplicating and sorting entity words; replace the expression constructing
unique_words in the loop over entities_by_type with sorted(set(words)) to avoid
the extra list allocation (update the block handling entities_by_type and the
assignment to enriched_doc.metadata[f'entities_{entity_type.lower()}']
accordingly).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e8dfd132-950a-42f5-ac04-1cbff688631d

📥 Commits

Reviewing files that changed from the base of the PR and between 4d473ca and 18b03bf.

📒 Files selected for processing (45)
  • nodes/src/nodes/accessibility_describe/accessibility_vision.py
  • nodes/src/nodes/agent_crewai/crewai.py
  • nodes/src/nodes/agent_langchain/IInstance.py
  • nodes/src/nodes/agent_langchain/langchain.py
  • nodes/src/nodes/agent_rocketride/IGlobal.py
  • nodes/src/nodes/agent_rocketride/executor.py
  • nodes/src/nodes/agent_rocketride/rocketride_agent.py
  • nodes/src/nodes/anonymize/IInstance.py
  • nodes/src/nodes/anonymize/anonymize.py
  • nodes/src/nodes/anonymize/glinerRecognizer.py
  • nodes/src/nodes/audio_transcribe/IGlobal.py
  • nodes/src/nodes/autopipe/IGlobal.py
  • nodes/src/nodes/chart_chartjs/IInstance.py
  • nodes/src/nodes/chart_chartjs/chartjs_driver.py
  • nodes/src/nodes/db_mysql/IGlobal.py
  • nodes/src/nodes/db_postgres/IGlobal.py
  • nodes/src/nodes/index_search/IEndpoint.py
  • nodes/src/nodes/index_search/IGlobal.py
  • nodes/src/nodes/index_search/IInstance.py
  • nodes/src/nodes/index_search/__init__.py
  • nodes/src/nodes/index_search/constants.py
  • nodes/src/nodes/index_search/elasticsearch_store.py
  • nodes/src/nodes/index_search/opensearch_client.py
  • nodes/src/nodes/library/msgraph/application_permissions.py
  • nodes/src/nodes/library/permissions/utils.py
  • nodes/src/nodes/llamaparse/IInstance.py
  • nodes/src/nodes/llm_ibm_watson/ibm_watson.py
  • nodes/src/nodes/llm_openai/IGlobal.py
  • nodes/src/nodes/mcp_client/IGlobal.py
  • nodes/src/nodes/mcp_client/IInstance.py
  • nodes/src/nodes/mcp_client/__init__.py
  • nodes/src/nodes/mcp_client/mcp_driver.py
  • nodes/src/nodes/mcp_client/mcp_sse_client.py
  • nodes/src/nodes/mcp_client/mcp_stdio_client.py
  • nodes/src/nodes/mcp_client/mcp_streamable_http_client.py
  • nodes/src/nodes/memory_internal/memory.py
  • nodes/src/nodes/ner/IGlobal.py
  • nodes/src/nodes/ner/IInstance.py
  • nodes/src/nodes/ocr/IGlobal.py
  • nodes/src/nodes/ocr/IInstance.py
  • nodes/src/nodes/tool_firecrawl/firecrawl_driver.py
  • nodes/src/nodes/tool_http_request/IGlobal.py
  • nodes/src/nodes/tool_http_request/http_client.py
  • nodes/src/nodes/tool_http_request/http_driver.py
  • nodes/src/nodes/vectordb_postgres/vectordb_postgres.py
💤 Files with no reviewable changes (7)
  • nodes/src/nodes/mcp_client/IInstance.py
  • nodes/src/nodes/agent_langchain/IInstance.py
  • nodes/src/nodes/mcp_client/mcp_streamable_http_client.py
  • nodes/src/nodes/mcp_client/mcp_stdio_client.py
  • nodes/src/nodes/mcp_client/mcp_driver.py
  • nodes/src/nodes/mcp_client/init.py
  • nodes/src/nodes/autopipe/IGlobal.py

# Spatial format prompt modifiers
SPATIAL_PROMPTS = {
'clock': '\n\nUse clock positions for spatial references (12 o\'clock = straight ahead).',
'clock': "\n\nUse clock positions for spatial references (12 o'clock = straight ahead).",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if pyproject.toml contains ruff quote-style configuration
rg -A5 '\[tool\.ruff\]' pyproject.toml

Repository: rocketride-org/rocketride-server

Length of output: 210


String literal uses double quotes instead of required single quotes.

Line 70 should use single quotes per the coding guideline for nodes/**/*.py. While the string contains a single quote character (o'clock), it should use single quotes with escaping rather than double quotes:

'clock': 'Use clock positions for spatial references (12 o\'clock = straight ahead).',

Additionally, the ruff configuration in pyproject.toml is missing quote-style = 'single', which would enforce this convention automatically. Add this to the [tool.ruff] section to align with project standards.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nodes/src/nodes/accessibility_describe/accessibility_vision.py` at line 70,
Replace the double-quoted string value for the 'clock' key in the
accessibility_vision dictionary with a single-quoted string and escape the
internal single quote (i.e., change the value for the 'clock' key in
nodes/src/nodes/accessibility_describe/accessibility_vision.py), and also update
the project's tooling by adding quote-style = 'single' to the [tool.ruff]
section of pyproject.toml so Ruff enforces single-quote strings across
nodes/**/*.py.

return 'Invalid input. Please check your image format and prompt.'
if any(phrase in error_lower for phrase in ['model not found', 'unavailable', 'not supported']):
return f'Model \'{self._model}\' is currently unavailable. Please try a different model.'
return f"Model '{self._model}' is currently unavailable. Please try a different model."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Quote style violates coding guideline.

This f-string was reformatted to use double quotes, but the coding guideline requires single quotes for regular string literals. While the string contains single quotes (making double quotes convenient to avoid escaping), the project standard requires consistent use of single quotes.

As per coding guidelines: nodes/**/*.py must use single quotes for regular string literals.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nodes/src/nodes/accessibility_describe/accessibility_vision.py` at line 147,
Change the returned string to use single-quoted string literals per the
nodes/**/*.py guideline; update the return in accessibility_vision.py (the line
that builds the message using self._model) to use single quotes for the outer
string and escape the inner single quotes around the model placeholder so the
message remains identical (i.e., keep the same text including the quotes around
the model but switch outer quotes to single and escape the inner ones).

(m['offset'], m['length'])
for m in ((m.get('location', {}).get('inChars') or m) for m in text_matches)
)
existing_matches = list((m['offset'], m['length']) for m in ((m.get('location', {}).get('inChars') or m) for m in text_matches))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Replace the unnecessary generator with a direct list comprehension.

Line 237 materializes list((...) for ...), which triggers Ruff C400 and adds avoidable overhead.

Proposed fix
-        existing_matches = list((m['offset'], m['length']) for m in ((m.get('location', {}).get('inChars') or m) for m in text_matches))
+        existing_matches = [
+            (m['offset'], m['length'])
+            for m in ((m.get('location', {}).get('inChars') or m) for m in text_matches)
+        ]
As per coding guidelines, `nodes/**/*.py` should use Ruff for linting/formatting.
🧰 Tools
🪛 Ruff (0.15.7)

[warning] 237-237: Unnecessary generator (rewrite as a list comprehension)

Rewrite as a list comprehension

(C400)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nodes/src/nodes/anonymize/glinerRecognizer.py` at line 237, Replace the
nested generator expression used to build existing_matches with a direct list
comprehension to avoid Ruff C400 and extra overhead: change the current
expression that uses list((m['offset'], m['length']) for m in
((m.get('location', {}).get('inChars') or m) for m in text_matches)) to a
comprehension like [(m['offset'], m['length']) for tm in text_matches for m in
(tm.get('location', {}).get('inChars') or tm)] so the same elements are produced
without the intermediate generator; update the assignment to existing_matches
accordingly.

'bank account', 'passport number', 'driver license'
]

DEFAULT_PII_LABELS = ['person', 'name', 'email', 'phone number', 'address', 'social security number', 'credit card number', 'date of birth', 'organization', 'company', 'location', 'ip address', 'bank account', 'passport number', 'driver license']
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid mutable class-level defaults for DEFAULT_PII_LABELS.

Line 32 uses a class-level list, which is shared and mutable across all instances (RUF012). Use an immutable tuple to prevent accidental mutation.

Proposed fix
-    DEFAULT_PII_LABELS = ['person', 'name', 'email', 'phone number', 'address', 'social security number', 'credit card number', 'date of birth', 'organization', 'company', 'location', 'ip address', 'bank account', 'passport number', 'driver license']
+    DEFAULT_PII_LABELS = (
+        'person', 'name', 'email', 'phone number', 'address', 'social security number',
+        'credit card number', 'date of birth', 'organization', 'company', 'location',
+        'ip address', 'bank account', 'passport number', 'driver license',
+    )
As per coding guidelines, `nodes/**/*.py` should use Ruff for linting/formatting.
📝 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
DEFAULT_PII_LABELS = ['person', 'name', 'email', 'phone number', 'address', 'social security number', 'credit card number', 'date of birth', 'organization', 'company', 'location', 'ip address', 'bank account', 'passport number', 'driver license']
DEFAULT_PII_LABELS = (
'person', 'name', 'email', 'phone number', 'address', 'social security number',
'credit card number', 'date of birth', 'organization', 'company', 'location',
'ip address', 'bank account', 'passport number', 'driver license',
)
🧰 Tools
🪛 Ruff (0.15.7)

[warning] 32-32: Mutable default value for class attribute

(RUF012)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nodes/src/nodes/anonymize/IInstance.py` at line 32, DEFAULT_PII_LABELS is
defined as a mutable class-level list on IInstance which can be accidentally
mutated across instances; change it to an immutable tuple (e.g.,
DEFAULT_PII_LABELS = ('person', 'name', ...)) to prevent shared-state bugs and
update any uses expecting a list (convert to list locally if needed) and re-run
Ruff formatting/linting for the nodes package.

f'**File Type:** {mime_type}\n**File Size:** {len(document_data)} bytes\n\n'
f'*The document could not be processed due to an error in the LlamaParse service.*'
)
error_text = f'# LlamaParse Processing Error\n\n**Error Type:** {type(e).__name__}\n**Error Message:** {str(e)}\n\n**File Type:** {mime_type}\n**File Size:** {len(document_data)} bytes\n\n*The document could not be processed due to an error in the LlamaParse service.*'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "IInstance.py" -path "*/llamaparse/*"

Repository: rocketride-org/rocketride-server

Length of output: 117


🏁 Script executed:

cat -n nodes/src/nodes/llamaparse/IInstance.py | sed -n '315,330p'

Repository: rocketride-org/rocketride-server

Length of output: 1054


🏁 Script executed:

# Check if the file uses the recommended Python version and ruff
head -20 nodes/src/nodes/llamaparse/IInstance.py

Repository: rocketride-org/rocketride-server

Length of output: 1255


Use f-string conversion flag instead of str() in f-string.

Line 322 should use {e!s} instead of {str(e)} to satisfy Ruff RUF010 and follow PEP style guidelines.

Suggested fix
-            error_text = f'# LlamaParse Processing Error\n\n**Error Type:** {type(e).__name__}\n**Error Message:** {str(e)}\n\n**File Type:** {mime_type}\n**File Size:** {len(document_data)} bytes\n\n*The document could not be processed due to an error in the LlamaParse service.*'
+            error_text = f'# LlamaParse Processing Error\n\n**Error Type:** {type(e).__name__}\n**Error Message:** {e!s}\n\n**File Type:** {mime_type}\n**File Size:** {len(document_data)} bytes\n\n*The document could not be processed due to an error in the LlamaParse service.*'
📝 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
error_text = f'# LlamaParse Processing Error\n\n**Error Type:** {type(e).__name__}\n**Error Message:** {str(e)}\n\n**File Type:** {mime_type}\n**File Size:** {len(document_data)} bytes\n\n*The document could not be processed due to an error in the LlamaParse service.*'
error_text = f'# LlamaParse Processing Error\n\n**Error Type:** {type(e).__name__}\n**Error Message:** {e!s}\n\n**File Type:** {mime_type}\n**File Size:** {len(document_data)} bytes\n\n*The document could not be processed due to an error in the LlamaParse service.*'
🧰 Tools
🪛 Ruff (0.15.7)

[warning] 322-322: Use explicit conversion flag

Replace with conversion flag

(RUF010)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nodes/src/nodes/llamaparse/IInstance.py` at line 322, Replace the use of
str(e) in the f-string that constructs error_text with the f-string conversion
flag e!s to satisfy Ruff RUF010 and PEP style; locate the error_text assignment
in IInstance.py (the f-string that begins '# LlamaParse Processing Error') and
change the embedded expression from {str(e)} to {e!s} so the exception is
formatted using the conversion flag.

f'Unknown IBM Cloud location: {location!r}. '
f'Valid locations: {", ".join(sorted(_VALID_LOCATIONS))}'
)
raise ValueError(f'Unknown IBM Cloud location: {location!r}. Valid locations: {", ".join(sorted(_VALID_LOCATIONS))}')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Ruff TRY003 warning still present on raised long inline message.

This line still triggers TRY003; please move message construction out of the raise expression to keep lint clean before CI enforcement.

♻️ Proposed fix
     if location not in _VALID_LOCATIONS:
-        raise ValueError(f'Unknown IBM Cloud location: {location!r}. Valid locations: {", ".join(sorted(_VALID_LOCATIONS))}')
+        valid_locations = ', '.join(sorted(_VALID_LOCATIONS))
+        msg = f'Unknown IBM Cloud location: {location!r}. Valid locations: {valid_locations}'
+        raise ValueError(msg)
As per coding guidelines: `nodes/**/*.py`: Python pipeline nodes: use single quotes, ruff for linting/formatting, PEP 257 docstrings, target Python 3.10+.
📝 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
raise ValueError(f'Unknown IBM Cloud location: {location!r}. Valid locations: {", ".join(sorted(_VALID_LOCATIONS))}')
if location not in _VALID_LOCATIONS:
valid_locations = ', '.join(sorted(_VALID_LOCATIONS))
msg = f'Unknown IBM Cloud location: {location!r}. Valid locations: {valid_locations}'
raise ValueError(msg)
🧰 Tools
🪛 Ruff (0.15.7)

[warning] 71-71: Avoid specifying long messages outside the exception class

(TRY003)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nodes/src/nodes/llm_ibm_watson/ibm_watson.py` at line 71, The long inline
error message in the raise Expression triggers Ruff TRY003; change the code to
build the message string before raising: construct a variable (e.g., msg =
f'Unknown IBM Cloud location: {location!r}. Valid locations: {",
".join(sorted(_VALID_LOCATIONS))}') and then use raise ValueError(msg) so the
message construction is not inside the raise; reference the existing
variables/location and _VALID_LOCATIONS used in the current check.

Comment on lines 96 to 98
for entity_type, words in entities_by_type.items():
unique_words = sorted(list(set(words)))
enriched_doc.metadata[f'entities_{entity_type.lower()}'] = unique_words
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Use sorted(set(words)) directly.

sorted(list(set(words))) has an unnecessary intermediate list() allocation.

Suggested cleanup
-                    unique_words = sorted(list(set(words)))
+                    unique_words = sorted(set(words))
🧰 Tools
🪛 Ruff (0.15.7)

[warning] 97-97: Unnecessary list() call within sorted()

Remove the inner list() call

(C414)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nodes/src/nodes/ner/IInstance.py` around lines 96 - 98, The code uses an
unnecessary intermediate list when deduplicating and sorting entity words;
replace the expression constructing unique_words in the loop over
entities_by_type with sorted(set(words)) to avoid the extra list allocation
(update the block handling entities_by_type and the assignment to
enriched_doc.metadata[f'entities_{entity_type.lower()}'] accordingly).

@nihalnihalani
Copy link
Copy Markdown
Contributor

Senior Review: chore — Run ruff format across nodes

What works well

Blockers (must fix before merge)

  1. Merge conflicts across 45 files. The PR is currently in a CONFLICTING state. Given that this touches 45 files with formatting-only changes, rebasing will likely require resolving many conflicts. This is best done by re-running ruff format on a fresh branch from the latest develop, rather than trying to manually resolve each conflict.

Should fix

  1. Verify ruff config alignment. Confirm that the ruff format run used the project's agreed-upon configuration (from pyproject.toml or ruff.toml). If there's no committed ruff config yet, this PR should either include one or document what settings were used, so future runs produce identical results.

  2. Timing is important. A 45-file formatting PR will cause cascading merge conflicts for every other open PR touching Python nodes. Consider:

Recommendation

The most practical path forward: rebase onto latest develop, re-run ruff format, and coordinate timing with the maintainers to minimize conflict churn for other contributors.

@nihalnihalani
Copy link
Copy Markdown
Contributor

🚀 Merge Request

Good formatting baseline.

Before merge:

  • Resolve merge conflicts (45 files, 8 days stale)
  • Verify alignment with team's ruff config
  • Coordinate timing with maintainers to minimize cascading conflicts

Suggest rebasing on a fresh branch and merging during a quiet window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:nodes Python pipeline nodes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run ruff on all Python files and enforce formatting in CI

2 participants