Skip to content
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

fixing restapi gh actions flake #3139

Merged
merged 1 commit into from
Sep 17, 2024
Merged

fixing restapi gh actions flake #3139

merged 1 commit into from
Sep 17, 2024

Conversation

Defi-Moses
Copy link
Collaborator

@Defi-Moses Defi-Moses commented Sep 17, 2024

Edits the rest api to fix a gh actions flake

Summary by CodeRabbit

  • New Features

    • Enhanced testing capabilities with the addition of supertest for improved API endpoint testing.
    • Improved TypeScript support by including the typescript package for better type safety.
  • Chores

    • Updated the build scripts in the package.json for better project structure.

Copy link
Contributor

coderabbitai bot commented Sep 17, 2024

Walkthrough

The changes made to the package.json file for the rest-api package include the addition of a new script for building, the removal of the post-installation script, and the incorporation of supertest and typescript into the dependencies section. The previous development dependencies for these packages have been removed, indicating a shift in their usage within the project.

Changes

File Change Summary
packages/rest-api/package.json - Added: "build:slither": " " in scripts section
- Removed: "postinstall": "npm run build" in scripts section
- Added: "supertest": "^6.3.3" in dependencies section
- Added: "typescript": "^4.8.3" in dependencies section
- Removed: "supertest": "^6.3.3" in devDependencies section
- Removed: "typescript": "^4.8.3" in devDependencies section

Sequence Diagram(s)

(No sequence diagrams generated as the changes do not warrant a control flow visualization.)

Poem

In the garden where code does play,
A new script hops in, brightening the day.
Dependencies shift, like leaves in the breeze,
With TypeScript and testing, we code with ease.
So let’s celebrate this joyful update,
For our little project, it’s looking first-rate! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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 generate interesting stats about this repository and render them as a table.
    -- @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 resolve resolve all the CodeRabbit review comments.
  • @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.

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.
Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI o1 for code reviews: OpenAI's new o1 model is being tested for generating code suggestions in code reviews.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9aadad2 and 8e974b4.

Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (1)
  • packages/rest-api/package.json (3 hunks)
Additional comments not posted (1)
packages/rest-api/package.json (1)

11-11: Verify the necessity of the 'build:slither' script

To ensure that the build:slither script is intentional and correctly implemented, please verify its usage across the codebase.

Run the following script to search for occurrences of build:slither:

Verification successful

Empty 'build:slither' script is likely a placeholder

The 'build:slither' script with an empty command (" ") appears to be a standardized entry across multiple package.json files in the project. For non-contract packages like rest-api, it's likely a placeholder or part of a consistent package structure. Slither analysis seems to be primarily used for smart contracts and is possibly integrated into the CI/CD process rather than local builds for most packages.

While the script doesn't have any negative impact, it's not actively used in the rest-api package. Consider either:

  • Removing it if it's unnecessary for this package.
  • Adding a comment explaining its purpose as a placeholder.
  • Implementing Slither analysis if it becomes relevant for this package in the future.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for references to 'build:slither' in the codebase.

# Test: Find all instances where 'build:slither' is used.
rg --type json '"build:slither"'

Length of output: 786


Script:

#!/bin/bash
# Search for references to 'build:slither' in non-JSON files
rg --type-not json 'build:slither'

# Search for README files that might explain the build process
fd -i readme.md

# Search for Slither configuration files or mentions
rg -i 'slither'

# Check for CI/CD configuration files
fd -e yml -e yaml

Length of output: 6970

"dev": "nodemon --watch src --exec ts-node src/app.ts",
"start": "node dist/app.js",
"lint:fix": "eslint src/**/*.ts --fix",
"lint:check": "eslint . --max-warnings=0",
"ci:lint": "npm run lint:check",
"test": "jest",
"test:coverage": "echo 'No tests defined.'",
"postinstall": "npm run build"
"test:coverage": "echo 'No tests defined.'"
Copy link
Contributor

Choose a reason for hiding this comment

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

'test:coverage' script provides no functional value

The test:coverage script currently echoes 'No tests defined.', which may be misleading. Consider implementing actual test coverage reporting or removing this script to prevent confusion.

Apply this diff to remove the non-functional script:

-    "test:coverage": "echo 'No tests defined.'"
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
"test:coverage": "echo 'No tests defined.'"

@@ -8,14 +8,14 @@
"scripts": {
"build": "tsc",
"build:go": " ",
"build:slither": " ",
Copy link
Contributor

Choose a reason for hiding this comment

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

Empty 'build:slither' script may cause confusion

The build:slither script has been added with an empty command (" "). This could lead to confusion or unintended behavior if someone tries to execute it. If the script is not yet implemented, consider removing it until it's ready or providing a meaningful command.

Apply this diff to remove the empty script:

-    "build:slither": " ",
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
"build:slither": " ",

@@ -26,7 +26,9 @@
"ethers": "5.7.2",
"express": "^4.18.2",
"express-validator": "^7.2.0",
"lodash": "^4.17.21"
"lodash": "^4.17.21",
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate 'lodash' dependency

The lodash package is listed in both dependencies and devDependencies. This duplication can cause unnecessary bloat and potential version conflicts. Determine if lodash is required at runtime or only during development, and include it in the appropriate section.

If lodash is only needed during development, remove it from dependencies:

-    "lodash": "^4.17.21",

Committable suggestion was skipped due to low confidence.

Comment on lines +30 to +31
"supertest": "^6.3.3",
"typescript": "^4.8.3"
Copy link
Contributor

Choose a reason for hiding this comment

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

Move 'supertest' and 'typescript' back to 'devDependencies'

supertest and typescript are typically used for development and testing purposes. Including them in dependencies will install them in production environments unnecessarily, increasing the application's footprint.

Apply this diff to move them back to devDependencies:

-    "supertest": "^6.3.3",
-    "typescript": "^4.8.3"

Add them to devDependencies if they're not already present:

+    "supertest": "^6.3.3",
+    "typescript": "^4.8.3"

Committable suggestion was skipped due to low confidence.

Copy link

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8e974b4
Status: ✅  Deploy successful!
Preview URL: https://83e0b461.sanguine-fe.pages.dev
Branch Preview URL: https://bug-api-gh-actions.sanguine-fe.pages.dev

View logs

Copy link

codecov bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 37.94554%. Comparing base (9aadad2) to head (8e974b4).
Report is 1 commits behind head on master.

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #3139         +/-   ##
===================================================
- Coverage   38.22166%   37.94554%   -0.27612%     
===================================================
  Files            423         418          -5     
  Lines          24371       24240        -131     
  Branches         119          82         -37     
===================================================
- Hits            9315        9198        -117     
+ Misses         14317       14303         -14     
  Partials         739         739                 
Flag Coverage Δ
packages 90.96267% <ø> (ø)
solidity ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@abtestingalpha abtestingalpha merged commit 0357100 into master Sep 17, 2024
36 checks passed
@abtestingalpha abtestingalpha deleted the bug/api-gh-actions branch September 17, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants