Skip to content

Conversation

@justsomelegs
Copy link
Contributor

@justsomelegs justsomelegs commented Mar 27, 2025

Introduce a new scraper class ArcaneScraper and a corresponding transformer transformArcanes to handle scraping and transforming arcane data from the Warframe wiki.

What did you fix?

Add the ability for Arcanes to have types corresponding to the Item it slots onto by introducing a wiki scraper for them.


Reproduction steps


Evidence/screenshot/link to line

Considerations

  • Does this contain a new dependency? NO
  • Does this introduce opinionated data formatting or manual data entry? NO
  • Does this pr include updated data files in a separate commit that can be reverted for a clean code-only pr? NO
  • Have I run the linter? YES
  • Is is a bug fix, feature request, or enhancement? Feature/Enhancement

Summary by CodeRabbit

  • New Features
    • Introduced comprehensive arcane data integration that enriches item details with updated information and improved classification.
    • Enhanced data fetching to include arcane-specific properties for a more complete and reliable display of items.
    • Added a new scraper specifically for Arcane data to streamline data collection.
    • Implemented new methods to handle and transform arcane data effectively.
    • Expanded the range of tradable item types to include various Arcane categories.
    • Updated the Arcane interface to allow for a wider variety of arcane item types.

@justsomelegs justsomelegs requested a review from a team as a code owner March 27, 2025 17:26
@coderabbitai
Copy link

coderabbitai bot commented Mar 27, 2025

Walkthrough

The pull request updates the Parser, Scraper, and related classes to enhance the handling of arcane-specific data. The addType method in the Parser class is modified to accept an additional data parameter, which allows for improved type classification based on external sources. A new method, addArcaneWikiaData, is introduced for populating arcane-related properties. The Scraper class now includes an ArcaneScraper for scraping arcane data, and a new asynchronous function for transforming this data is added.

Changes

File(s) Change Summary
build/parser.mjs Updated the addType method signature to include a data parameter and modified its logic to prioritize type assignment based on data.wikia.arcanes. Added the addArcaneWikiaData method to populate arcane-related properties. The filter and quickFilter methods now pass data to addType.
build/scraper.mjs Integrated a new ArcaneScraper into the Scraper class. Updated the fetchWikiaData method to include an arcanes property in the returned object and adjusted the progress bar steps to account for the additional scraping operation.
build/wikia/WikiaDataScraper.mjs, build/wikia/scrapers/ArcaneScraper.mjs, build/wikia/transformers/transformArcanes.mjs Improved readability with additional blank lines in WikiaDataScraper. Introduced a new ArcaneScraper class that extends WikiaDataScraper and added the asynchronous transformArcanes function for processing arcane data.
build/tradable.mjs Expanded the tradableTypes array to include new arcane types without altering existing functionality.
index.d.ts Updated the Arcane interface to allow multiple string literal types for the type property, enhancing flexibility in item categorization.

Possibly related PRs

  • feat: migrate all fandom links to the official wiki #700: The changes in the main PR are related to the modifications in the Parser class, specifically the addType method, which is also part of the Parser class in the retrieved PR, indicating a direct connection in functionality.
  • fix: masterable check for modular parts and Pets #663: The changes in the main PR modify the addType method in the Parser class, while the retrieved PR alters the applyMasterable method in the same class, indicating that both PRs are related through modifications to the Parser class but focus on different methods.

Suggested labels

Scope: Scraper, Scope: Data, released

Suggested reviewers

  • Soundofdarkness

Poem

I'm a code-hopping rabbit on a breeze,
Leaping through Parser and Scraper with ease.
Arcane data now twinkles in every byte,
In lines of logic shining bright.
Hop along with me through functions and lore,
Celebrating these changes forevermore!
🐇💻

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@justsomelegs justsomelegs requested a review from TobiTenno March 29, 2025 00:13
@TobiTenno TobiTenno enabled auto-merge (squash) March 29, 2025 01:51
@TobiTenno TobiTenno disabled auto-merge March 29, 2025 01:51
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🧹 Nitpick comments (1)
build/parser.mjs (1)

451-469: Implementation of arcane type determination.

The addType method now checks for arcanes in the wikia data and sets the appropriate type. The implementation is logical and follows the existing code patterns.

Consider using an early return pattern for better readability:

  addType(item, data) {
    if (item.parent) return;
    const arcane = data.wikia.arcanes.find((entry) => entry.name === item.name);
    if (arcane) {
      item.type = `${arcane.type} Arcane`;
      return;
    }
    
-   else {
-     // eslint-disable-next-line no-restricted-syntax
-     for (const type of types) {
-       const contains = type.regex
-         ? new RegExp(type.id, 'ig').test(item.uniqueName)
-         : item.uniqueName.includes(type.id);
-       if (contains) {
-         if (type.append) item.type = `${item.type}${type.name}`;
-         else item.type = type.name;
-         // if (item.type !== type.name) console.error(`${item.name} didn't update types`)
-         break;
-       }
-     }
-   }
+   // eslint-disable-next-line no-restricted-syntax
+   for (const type of types) {
+     const contains = type.regex
+       ? new RegExp(type.id, 'ig').test(item.uniqueName)
+       : item.uniqueName.includes(type.id);
+     if (contains) {
+       if (type.append) item.type = `${item.type}${type.name}`;
+       else item.type = type.name;
+       // if (item.type !== type.name) console.error(`${item.name} didn't update types`)
+       break;
+     }
+   }

    // No type assigned? Add 'Misc'.
    if (!item.type) {
      // ...
🛑 Comments failed to post (1)
build/tradable.mjs (1)

35-35: ⚠️ Potential issue

Fix array formatting to pass linting.

The CI pipeline is failing due to a formatting issue with this line. Each array element should be on its own line according to the project's style guide.

Apply this fix to resolve the linting error:

-const tradableTypes = ['Captura', 'Cut Gem', 'Fish', 'Focus Lens', 'Relic', 'Upgrades', ...tradableArcanes, ...tradableMods];
+const tradableTypes = [
+  'Captura',
+  'Cut Gem',
+  'Fish',
+  'Focus Lens',
+  'Relic',
+  'Upgrades',
+  ...tradableArcanes,
+  ...tradableMods,
+];
📝 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.

const tradableTypes = [
  'Captura',
  'Cut Gem',
  'Fish',
  'Focus Lens',
  'Relic',
  'Upgrades',
  ...tradableArcanes,
  ...tradableMods,
];
🧰 Tools
🪛 ESLint

[error] 35-35: Replace 'Captura',·'Cut·Gem',·'Fish',·'Focus·Lens',·'Relic',·'Upgrades',·...tradableArcanes,·...tradableMods with ⏎··'Captura',⏎··'Cut·Gem',⏎··'Fish',⏎··'Focus·Lens',⏎··'Relic',⏎··'Upgrades',⏎··...tradableArcanes,⏎··...tradableMods,⏎

(prettier/prettier)

🪛 GitHub Check: Lint

[failure] 35-35:
Replace 'Captura',·'Cut·Gem',·'Fish',·'Focus·Lens',·'Relic',·'Upgrades',·...tradableArcanes,·...tradableMods with ⏎··'Captura',⏎··'Cut·Gem',⏎··'Fish',⏎··'Focus·Lens',⏎··'Relic',⏎··'Upgrades',⏎··...tradableArcanes,⏎··...tradableMods,⏎

🪛 GitHub Actions: Pull Request Checks

[error] 35-35: Prettier formatting check failed. Replace 'Captura', 'Cut Gem', 'Fish', 'Focus Lens', 'Relic', 'Upgrades', ...tradableArcanes, ...tradableMods with ⏎ 'Captura',⏎ 'Cut Gem',⏎ 'Fish',⏎ 'Focus Lens',⏎ 'Relic',⏎ 'Upgrades',⏎ ...tradableArcanes,⏎ ...tradableMods,⏎.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
build/parser.mjs (2)

451-469: Code properly identifies arcane types from wiki data.

The implementation correctly checks for arcanes in the wikia data and assigns the appropriate type. This addresses the core functionality needed for the ArcaneScraper.

One optimization suggestion:

-    // eslint-disable-next-line no-restricted-syntax
-    for (const type of types) {
-      const contains = type.regex
-        ? new RegExp(type.id, 'ig').test(item.uniqueName)
-        : item.uniqueName.includes(type.id);
-      if (contains) {
-        if (type.append) item.type = `${item.type}${type.name}`;
-        else item.type = type.name;
-        // if (item.type !== type.name) console.error(`${item.name} didn't update types`)
-        break;
-      }
-    }
+    const matchedType = types.find((type) => {
+      const contains = type.regex
+        ? new RegExp(type.id, 'ig').test(item.uniqueName)
+        : item.uniqueName.includes(type.id);
+      return contains;
+    });
+    
+    if (matchedType) {
+      if (matchedType.append) item.type = `${item.type}${matchedType.name}`;
+      else item.type = matchedType.name;
+    }

1002-1013: Fix the JSDoc comment for the arcane wiki data method.

The method comment incorrectly describes this as adding data for mods rather than arcanes.

/**
-   * Add additional data for mods from the wiki
+   * Add additional data for arcanes from the wiki
 * @param {Item} item mod to append wikia data to
-   * @param {WikiaArcane} wikiaItem to pull data from
+   * @param {WikiaArcane} wikiaItem arcane data to pull from
 */
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 716d4fa and 8b6b3ce.

📒 Files selected for processing (7)
  • build/parser.mjs (6 hunks)
  • build/scraper.mjs (4 hunks)
  • build/tradable.mjs (2 hunks)
  • build/wikia/WikiaDataScraper.mjs (0 hunks)
  • build/wikia/scrapers/ArcaneScraper.mjs (1 hunks)
  • build/wikia/transformers/transformArcanes.mjs (1 hunks)
  • index.d.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • build/wikia/WikiaDataScraper.mjs
🚧 Files skipped from review as they are similar to previous changes (4)
  • build/wikia/scrapers/ArcaneScraper.mjs
  • build/scraper.mjs
  • build/wikia/transformers/transformArcanes.mjs
  • index.d.ts
🧰 Additional context used
🧠 Learnings (1)
build/parser.mjs (1)
Learnt from: justsomelegs
PR: WFCD/warframe-items#714
File: build/parser.mjs:929-931
Timestamp: 2025-03-29T16:32:58.039Z
Learning: In the Parser class, category names are normalized with `.toLowerCase()` before being used in switch statements, allowing case-insensitive matching.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build
🔇 Additional comments (4)
build/tradable.mjs (2)

4-17: Good addition of tradable arcane types.

This comprehensive list of arcane types ensures that all arcane variants will be properly marked as tradable in the system. The naming pattern follows the established format seen with mods (${type} Mod).


35-44: LGTM! Implementation follows the established pattern.

The changes to tradableTypes correctly integrate the arcane types using the spread operator, matching how the tradable mods are handled.

build/parser.mjs (2)

929-931: Support for arcanes category in the switch statement.

The switch statement properly includes the 'arcanes' case with a call to the new addArcaneWikiaData method. As noted in the retrieved learnings, the .toLowerCase() on the category name ensures case-insensitive matching.


196-196: Data parameter propagation is correctly implemented.

The data parameter is now passed to addType in both the filter and quickFilter methods, ensuring arcane type resolution works throughout the processing pipeline.

Also applies to: 233-233

Introduce a new scraper class `ArcaneScraper` and a corresponding transformer `transformArcanes` to handle scraping and transforming arcane data from the Warframe wiki.
@TobiTenno TobiTenno enabled auto-merge (squash) March 29, 2025 18:46
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8b6b3ce and 434e53e.

📒 Files selected for processing (7)
  • build/parser.mjs (6 hunks)
  • build/scraper.mjs (4 hunks)
  • build/tradable.mjs (2 hunks)
  • build/wikia/WikiaDataScraper.mjs (0 hunks)
  • build/wikia/scrapers/ArcaneScraper.mjs (1 hunks)
  • build/wikia/transformers/transformArcanes.mjs (1 hunks)
  • index.d.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • build/wikia/WikiaDataScraper.mjs
🚧 Files skipped from review as they are similar to previous changes (5)
  • build/wikia/scrapers/ArcaneScraper.mjs
  • build/wikia/transformers/transformArcanes.mjs
  • build/scraper.mjs
  • build/tradable.mjs
  • index.d.ts
🧰 Additional context used
🧠 Learnings (1)
build/parser.mjs (1)
Learnt from: justsomelegs
PR: WFCD/warframe-items#714
File: build/parser.mjs:929-931
Timestamp: 2025-03-29T16:32:58.039Z
Learning: In the Parser class, category names are normalized with `.toLowerCase()` before being used in switch statements, allowing case-insensitive matching.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build
🔇 Additional comments (4)
build/parser.mjs (4)

929-931: Switch statement correctly handles Arcanes category

The switch statement now handles the 'arcanes' category by calling the new addArcaneWikiaData method. As noted in the retrieved learnings, category names are normalized with .toLowerCase() before being used in switch statements, so this will correctly match any case variation of "Arcanes".


1002-1013: New addArcaneWikiaData method is well-structured

The method follows the same pattern as other similar methods in the class (addModWikiaData, addWeaponWikiaData, etc.), which maintains code consistency. The JSDoc documentation is also complete.

The method correctly sets the item's thumbnail, URL, transmutability, and type from the Wikia data.


196-196: Update of filter method to pass data parameter

The method now correctly passes the data parameter to the addType method, ensuring arcanes can be properly typed during the filtering process.


233-233: Update of quickFilter method to pass data parameter

Similar to the filter method update, the quickFilter method now correctly passes the data parameter to the addType method.

@TobiTenno TobiTenno merged commit 7c3e6cd into WFCD:master Mar 29, 2025
10 checks passed
@wfcd-bot-boi
Copy link
Collaborator

🎉 This PR is included in version 1.1268.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants