Skip to content

Conversation

@Kloudz805
Copy link

@Kloudz805 Kloudz805 commented Oct 11, 2025

"This pull request updates the translations in the Betaflight configurator with the latest changes from Crowdin"

Summary by CodeRabbit

  • New Features

    • Added support for website-based preset repositories in the configurator.
    • URLs are automatically normalized (including trailing slash) for reliable linking and online viewing.
  • Chores

    • Updated translations workflow to run an additional CrowdIn step, improving synchronization between source and translated content.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 11, 2025

Walkthrough

Introduces a new GitHub Actions step to run the CrowdIn action in the translations upload workflow and adds a new JavaScript module exporting PresetsWebsiteRepo that normalizes a URL and delegates to a superclass constructor.

Changes

Cohort / File(s) Summary
CI Workflow: Translations Upload
.github/workflows/translations-upload.yml
Adds a step named "crowdin-action" invoking crowdin/[email protected] after existing steps; prior steps remain unchanged.
Web Configurator Module
web_configurator_crossconfigurator2.js
Adds new class PresetsWebsiteRepo (default export). Constructor trims input URL, ensures trailing slash, derives urlRaw and urlViewOnline, then calls super(urlRaw, urlViewOnline, official, name).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant GH as GitHub Actions
  participant CI as Translations Workflow
  participant CR as CrowdIn Action

  Dev->>GH: Push/Dispatch
  GH->>CI: Run workflow
  CI->>CI: Existing steps (upload/download)
  CI->>CR: Run crowdin/[email protected]
  CR-->>CI: Action completes (success/error)
  CI-->>GH: Workflow result
Loading
sequenceDiagram
  autonumber
  participant App as Caller
  participant PWR as PresetsWebsiteRepo
  participant PRI as PresetsRepoIndexed (super)

  App->>PWR: new PresetsWebsiteRepo(url, official, name)
  rect rgba(200,240,255,0.3)
    note right of PWR: URL normalization
    PWR->>PWR: trim(url)
    PWR->>PWR: ensure trailing '/'
    PWR->>PWR: derive urlRaw, urlViewOnline
  end
  PWR->>PRI: super(urlRaw, urlViewOnline, official, name)
  PRI-->>PWR: initialized
  PWR-->>App: instance ready
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nibble on commits beneath moon’s glow,
A workflow hops to CrowdIn—off we go!
A URL gets its tail, a tidy slash,
Then bounds to super with a happy dash.
Carrots merged, checks all green—
Such crisp new code, so sleek, so clean. 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title “Update translations from Crowdin” implies the PR only updates translation content, but these changes also add a new workflow step and introduce a new JavaScript class. This discrepancy means the title does not accurately reflect the scope of the PR. The title also omits significant code additions that are unrelated to translation updates. Please revise the title to reflect both the added Crowdin workflow step and the new PresetsWebsiteRepo class, for example “Add Crowdin upload step and PresetsWebsiteRepo class.” If these changes serve separate purposes, consider splitting them into distinct pull requests to keep each PR focused. Maintaining accurate and concise titles helps reviewers understand the scope at a glance.
Description Check ⚠️ Warning The pull request description is a single sentence and does not follow the repository’s required template, which includes numbered considerations and structured sections to explain changes, testing, and issue references. It lacks a detailed summary of modifications, testing steps, and links to related issues or CI results. This omission prevents reviewers from understanding the context and verifying the work. Please update the pull request description to use the required template by removing the placeholder instructions and including the listed sections such as a detailed change summary, testing instructions, and issue references. Provide a clear explanation of what was changed, why, and how it was tested. Ensuring a complete description helps maintainers review the PR effectively.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@sonarqubecloud
Copy link

@github-actions
Copy link
Contributor

@haslinghuis
Copy link
Member

@Kloudz805 this is already covered. There is no need for this change request.

Copy link
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: 2

🧹 Nitpick comments (1)
web_configurator_crossconfigurator2.js (1)

4-9: Consider adding URL validation.

While the URL normalization logic (trim and ensure trailing slash) is correct, there's no validation to handle edge cases like empty strings or invalid URLs.

Consider adding basic validation:

 constructor(url, official, name) {
+    if (!url || typeof url !== 'string') {
+        throw new Error('Invalid URL: must be a non-empty string');
+    }
+
     let correctUrl = url.trim();
+    
+    if (!correctUrl) {
+        throw new Error('Invalid URL: URL is empty after trimming');
+    }

     if (!correctUrl.endsWith("/")) {
         correctUrl += "/";
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8c10a46 and 289bffd.

📒 Files selected for processing (2)
  • .github/workflows/translations-upload.yml (1 hunks)
  • web_configurator_crossconfigurator2.js (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
web_configurator_crossconfigurator2.js (1)
src/tabs/presets/PresetsRepoIndexed/PresetsRepoIndexed.js (1)
  • PresetsRepoIndexed (3-140)
🪛 actionlint (1.7.7)
.github/workflows/translations-upload.yml

35-35: could not parse as YAML: yaml: line 35: mapping values are not allowed in this context

(syntax-check)

🪛 ESLint
web_configurator_crossconfigurator2.js

[error] 7-7: Expected indentation of 8 spaces but found 20.

(indent)


[error] 9-9: Expected indentation of 8 spaces but found 20.

(indent)


[error] 11-11: Expected indentation of 8 spaces but found 20.

(indent)


[error] 12-12: Expected indentation of 8 spaces but found 20.

(indent)


[error] 14-14: Expected indentation of 8 spaces but found 20.

(indent)


[error] 15-15: Expected indentation of 4 spaces but found 12.

(indent)


[error] 16-16: Expected indentation of 0 spaces but found 1.

(indent)

🪛 YAMLlint (1.37.1)
.github/workflows/translations-upload.yml

[error] 35-35: syntax error: mapping values are not allowed here

(syntax)

Comment on lines +35 to +36
- name: crowdin-action
uses: crowdin/[email protected]
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Critical: YAML syntax error prevents workflow execution.

The indentation is incorrect, causing a YAML parsing error. The new step is nested too deeply (14 spaces) when it should be at the job step level (4 spaces).

Additionally, this appears to duplicate the existing crowdin/github-action step at line 22, but with a different version (v1.15.2 vs 1.5.1).

Apply this diff to fix the syntax error:

-              - name: crowdin-action
-                uses: crowdin/[email protected]
+    - name: crowdin-action
+      uses: crowdin/[email protected]

However, please clarify:

  1. Is this step intended to replace the existing step at line 22, or run as a separate step?
  2. If separate, what configuration should this step use (missing with: block)?
  3. Should the version be upgraded for both steps?

🏁 Script executed:

#!/bin/bash
echo "Showing lines 1-60 of the workflow file:"
sed -n '1,60p' .github/workflows/translations-upload.yml | nl -ba
echo
echo "Occurrences of crowdin/github-action:"
rg -n "crowdin/github-action" .github/workflows/translations-upload.yml

Length of output: 218


Correct YAML indentation and clarify duplicate step

The crowdin-action step at lines 35–36 is over-indented (should be at 4 spaces, not 14). Apply:

-              - name: crowdin-action
-                uses: crowdin/[email protected]
+    - name: crowdin-action
+      uses: crowdin/[email protected]

Please clarify:
• Replace the existing step at line 22 or run both?
• If separate, what with: configuration is needed?
• Should both steps use the same version?

📝 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: crowdin-action
uses: crowdin/[email protected]
- name: crowdin-action
uses: crowdin/[email protected]
🧰 Tools
🪛 actionlint (1.7.7)

35-35: could not parse as YAML: yaml: line 35: mapping values are not allowed in this context

(syntax-check)

🪛 YAMLlint (1.37.1)

[error] 35-35: syntax error: mapping values are not allowed here

(syntax)

🤖 Prompt for AI Agents
In .github/workflows/translations-upload.yml around lines 35–36, the
crowdin-action step is over-indented and appears duplicated; fix the indentation
to align with other steps (4 spaces), then remove or consolidate the duplicate
instead of keeping both: either replace the existing step at line 22 with this
corrected one or merge their responsibilities into a single step. If you must
keep two distinct steps, give each a unique name and provide a full with:
configuration (at minimum Crowdin token/auth, project_id, and files/globs or
upload pattern) for each step so they do different work, and ensure both
reference the same action version (or explicitly state why versions differ).
Ensure the step names, indentation, and with: keys match the repository’s other
workflow conventions.

Comment on lines +1 to +16
import PresetsRepoIndexed from "./PresetsRepoIndexed";

export default class PresetsWebsiteRepo extends PresetsRepoIndexed {
constructor(url, official, name) {
let correctUrl = url.trim();

if (!correctUrl.endsWith("/")) {
correctUrl += "/";
}

const urlRaw = correctUrl;
const urlViewOnline = correctUrl;

super(urlRaw, urlViewOnline, official, name);
}
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Critical: Inconsistent indentation and questionable file placement.

This file has multiple issues:

  1. Indentation: Mixed tabs and spaces with excessive indentation throughout (ESLint flags 7 violations). This will fail linting checks.

  2. File location: The file is at the repository root, but similar files (e.g., PresetsRepoIndexed.js) are in src/tabs/presets/. This is inconsistent with the project structure.

  3. File naming: The name web_configurator_crossconfigurator2.js is unusual - the "2" suffix suggests a duplicate or test file, and "crossconfigurator" appears redundant.

  4. PR scope: This file has no relation to translation updates (the stated PR objective).

Apply this diff to fix indentation:

 import PresetsRepoIndexed from "./PresetsRepoIndexed";
 
-export default class PresetsWebsiteRepo extends PresetsRepoIndexed { 
-	       constructor(url, official, name) {
-		            let correctUrl = url.trim();
-
-                    if (!correctUrl.endsWith("/")) { 
-                    	    correctUrl += "/";
-                    }
-                    
-                    const urlRaw = correctUrl;
-                    const urlViewOnline = correctUrl;
-                    
-                    super(urlRaw, urlViewOnline, official, name);
-            }
- }
+export default class PresetsWebsiteRepo extends PresetsRepoIndexed {
+    constructor(url, official, name) {
+        let correctUrl = url.trim();
+
+        if (!correctUrl.endsWith("/")) {
+            correctUrl += "/";
+        }
+
+        const urlRaw = correctUrl;
+        const urlViewOnline = correctUrl;
+
+        super(urlRaw, urlViewOnline, official, name);
+    }
+}

Please clarify:

  1. Is this file intended for this PR, or was it included accidentally?
  2. What is the correct location and name for this file?
  3. Should the import path be updated once the file is moved?

🏁 Script executed:

#!/bin/bash
set -e
# Find PresetsRepoIndexed definition and its file path
rg -nP "class\s+PresetsRepoIndexed" -C2 --glob "*.js"
# Locate the file web_configurator_crossconfigurator2.js
fd web_configurator_crossconfigurator2.js

Length of output: 512


Relocate, rename and fix import/indentation for PresetsWebsiteRepo

  • Move web_configurator_crossconfigurator2.js into src/tabs/presets/PresetsWebsiteRepo/PresetsWebsiteRepo.js (removing the _crossconfigurator2 suffix).
  • Update the import to point at the actual class location.
  • Apply consistent 4-space indentation (spaces only) as per ESLint.
  • Confirm whether this file is intended for this PR (it’s unrelated to translation updates).
-import PresetsRepoIndexed from "./PresetsRepoIndexed";
+import PresetsRepoIndexed from "../PresetsRepoIndexed/PresetsRepoIndexed";
 
-export default class PresetsWebsiteRepo extends PresetsRepoIndexed { 
-    constructor(url, official, name) {
-        let correctUrl = url.trim();
-
-        if (!correctUrl.endsWith("/")) {
-            correctUrl += "/";
-        }
-
-        const urlRaw = correctUrl;
-        const urlViewOnline = correctUrl;
-
-        super(urlRaw, urlViewOnline, official, name);
-    }
-}
+export default class PresetsWebsiteRepo extends PresetsRepoIndexed {
+    constructor(url, official, name) {
+        let correctUrl = url.trim();
+
+        if (!correctUrl.endsWith("/")) {
+            correctUrl += "/";
+        }
+
+        const urlRaw = correctUrl;
+        const urlViewOnline = correctUrl;
+
+        super(urlRaw, urlViewOnline, official, name);
+    }
+}
📝 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
import PresetsRepoIndexed from "./PresetsRepoIndexed";
export default class PresetsWebsiteRepo extends PresetsRepoIndexed {
constructor(url, official, name) {
let correctUrl = url.trim();
if (!correctUrl.endsWith("/")) {
correctUrl += "/";
}
const urlRaw = correctUrl;
const urlViewOnline = correctUrl;
super(urlRaw, urlViewOnline, official, name);
}
}
import PresetsRepoIndexed from "../PresetsRepoIndexed/PresetsRepoIndexed";
export default class PresetsWebsiteRepo extends PresetsRepoIndexed {
constructor(url, official, name) {
let correctUrl = url.trim();
if (!correctUrl.endsWith("/")) {
correctUrl += "/";
}
const urlRaw = correctUrl;
const urlViewOnline = correctUrl;
super(urlRaw, urlViewOnline, official, name);
}
}
🧰 Tools
🪛 ESLint

[error] 7-7: Expected indentation of 8 spaces but found 20.

(indent)


[error] 9-9: Expected indentation of 8 spaces but found 20.

(indent)


[error] 11-11: Expected indentation of 8 spaces but found 20.

(indent)


[error] 12-12: Expected indentation of 8 spaces but found 20.

(indent)


[error] 14-14: Expected indentation of 8 spaces but found 20.

(indent)


[error] 15-15: Expected indentation of 4 spaces but found 12.

(indent)


[error] 16-16: Expected indentation of 0 spaces but found 1.

(indent)

🤖 Prompt for AI Agents
In web_configurator_crossconfigurator2.js (lines 1-16): move and rename the file
to src/tabs/presets/PresetsWebsiteRepo/PresetsWebsiteRepo.js, update the top
import to the correct relative path for PresetsRepoIndexed from the new
location, change the file and default export to PresetsWebsiteRepo (remove the
_crossconfigurator2 suffix), reformat the entire file to use 4-space indentation
(spaces only) and fix inconsistent indentation inside the constructor, and
update any modules that import this file to use the new path/name; finally
confirm with the PR author whether this file belongs in this translation-related
PR and remove it from the PR if it’s unrelated.

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.

2 participants