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

Fixed the eslint_disable_check.py script #2521

Merged
merged 4 commits into from
Sep 15, 2024

Conversation

ARYANSHAH1567
Copy link

@ARYANSHAH1567 ARYANSHAH1567 commented Sep 10, 2024

What kind of change does this PR introduce?

Bugfix

Issue Number:

Fixes #2519

Summary by CodeRabbit

  • New Features

    • Introduced a Python script to enforce code quality by checking for eslint-disable statements in TypeScript files.
    • Enhanced the linting process to include this new custom check for improved adherence to coding standards.
  • Bug Fixes

    • Improved error handling in the wipeExistingData function for better context in error logging.

Copy link

coderabbitai bot commented Sep 10, 2024

Walkthrough

The changes introduce a Python script, eslint_disable_check.py, to enforce code quality by detecting eslint-disable statements in TypeScript files. The script scans .tsx files in a specified directory and integrates with the lint:check command in package.json, enhancing the linting process by ensuring that any usage of eslint-disable results in a failure during pull request checks.

Changes

File Change Summary
.github/workflows/eslint_disable_check.py Added a script to check for eslint-disable statements in TypeScript files.
package.json Modified the lint:check script to include execution of the new Python script.
setup.ts Updated error handling in wipeExistingData function to capture error context.
.github/workflows/pull-request.yml Updated the GitHub Actions workflow to run the new Python script after ESLint checks.

Assessment against linked issues

Objective Addressed Explanation
Detect the use of eslint-disable in files submitted in the PR (#2519)
Ensure the PR fails when eslint-disable is found, including // eslint-disable-next-line (#2519) The script does not currently check for this line.

🐰 In the code, a new check takes flight,
To catch those disables, both day and night.
With every PR, it scans with care,
Ensuring clean code is always fair.
Hooray for linting, let standards shine bright! 🌟


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>.
    • 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 show all the console.log statements in this repository.
    • @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.

Copy link

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 10, 2024
Copy link

codecov bot commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.09%. Comparing base (6093752) to head (1ef2db1).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2521      +/-   ##
===========================================
+ Coverage    98.89%   99.09%   +0.20%     
===========================================
  Files          349      349              
  Lines        17769    17769              
  Branches      2371     2371              
===========================================
+ Hits         17573    17609      +36     
+ Misses         193      160      -33     
+ Partials         3        0       -3     

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

@ARYANSHAH1567
Copy link
Author

I am not sure but hope this fixed the issue . If any changes required do let me know

@Cioppolo14
Copy link
Contributor

@ARYANSHAH1567 Can you test using the guidance in the issue to make sure it does?

@ARYANSHAH1567
Copy link
Author

@ARYANSHAH1567 Can you test using the guidance in the issue to make sure it does?

When i run the .py script individually it returns error that //next-line comment is present but when i run the lint:check it returns all the eslint error. So that's why i am not sure if its working or no

@palisadoes
Copy link
Contributor

  1. You need to test it against this PR to see why it's not working as expected
  2. Edit files and restore them to their original condition as part of the testing

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

Outside diff range, codebase verification and nitpick comments (1)
setup.ts (1)

222-223: Use the error parameter for logging or handling, or remove it if not needed.

It's a good practice to include the error parameter in the catch block for capturing and potentially logging the error object for more informative error handling.

However, in the current implementation, the error parameter is unused, and a comment has been added to disable the ESLint rule for unused variables.

If the intention is to log or handle the error in some way, please use the error parameter accordingly. Otherwise, consider removing the error parameter along with the comment to avoid disabling the ESLint rule unnecessarily.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 828d3b9 and 874f9ba.

Files selected for processing (1)
  • setup.ts (1 hunks)

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 10, 2024
@ARYANSHAH1567
Copy link
Author

@palisadoes found the problem. In the pull-request.yml while running the linting error it was running only the eslint check and not executing the eslint-disable.py file due to which these errors were not failing the tests. Now my pr fails for linting due to comment //eslint-disable

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 10, 2024
@ARYANSHAH1567
Copy link
Author

Same for the Admin it also executes only the command npx eslint does not include the eslint-disable.py script

@palisadoes
Copy link
Contributor

Have you tried asking our slack channel for assistance?

@ARYANSHAH1567
Copy link
Author

Have you tried asking our slack channel for assistance?

I have added the script for disable comment check. Now if I remove the comments from my pr then the pr will pass all its tests

Once i remove the eslint-disable comment it passes the tests
@ARYANSHAH1567
Copy link
Author

my previous commit on this pr failed as the line //eslint-disable next line was present

@palisadoes palisadoes merged commit df7a52d into PalisadoesFoundation:develop Sep 15, 2024
10 of 11 checks passed
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.

3 participants