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

fixes: Added feature to show commits #55

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Harshdev098
Copy link
Contributor

@Harshdev098 Harshdev098 commented Feb 9, 2025

Fixes issue #51

Changes:
Added a function to fetch commits of the contributor with the repository name under the specified time period

Summary by Sourcery

New Features:

  • Display commits made by a contributor to a specific repository within a defined time period.

Copy link

sourcery-ai bot commented Feb 9, 2025

Reviewer's Guide by Sourcery

This pull request introduces a new feature to fetch and display commit information from GitHub for a given contributor. The implementation involves constructing the proper API URL, performing an AJAX call to retrieve commits under a specified time period, and then processing and displaying the commit details in the scrum board.

Sequence diagram for fetching and displaying GitHub commits

sequenceDiagram
    participant Browser
    participant ScrumHelper
    participant GitHubAPI

    %% User triggers the scrum board refresh
    Browser->>ScrumHelper: Trigger allIncluded()
    ScrumHelper->>ScrumHelper: Initialize variables (githubUsername, projectName, dates)
    ScrumHelper->>ScrumHelper: Construct commitsUrl
    ScrumHelper->>GitHubAPI: $.ajax GET(commitsUrl)
    GitHubAPI-->>ScrumHelper: Return commit data
    ScrumHelper->>ScrumHelper: Store commit data in githubPrCommitsData
    ScrumHelper->>ScrumHelper: Call writeGithubCommits()
    Note right of ScrumHelper: Loop through commits, format HTML list items
    ScrumHelper->>Browser: Update scrum board with commit information
Loading

File-Level Changes

Change Details Files
Implemented commit fetching functionality via AJAX.
  • Declared a new variable to store commits data.
  • Constructed the commits URL using project name, GitHub username, and start/end dates.
  • Added an AJAX GET request to the GitHub API to fetch commits data.
src/scripts/scrumHelper.js
Implemented commit display functionality.
  • Created a new function to generate HTML list items for each commit including commit hash, message, and PR reference (if available).
  • Updated the interval logic to check for commit data availability and call the commit display function accordingly.
src/scripts/scrumHelper.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Harshdev098 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider replacing the polling via setInterval with a promise-based or async/await approach to handle API call completion.
  • Add error handling logic in your AJAX call for fetching commits instead of leaving the error callback empty.
  • Validate that githubPrCommitsData is an array before iterating to avoid potential runtime errors.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Harshdev098
Copy link
Contributor Author

@mariobehling I have commited the changes to fetch the commits for fixing issue #51. Can you please review it.

Harshdev098 and others added 3 commits March 20, 2025 11:43
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@Harshdev098
Copy link
Contributor Author

@hongquan Done with the changes!

@hongquan
Copy link
Member

Please run Biome to format your code.

@Harshdev098
Copy link
Contributor Author

@hongquan Done ✅

@shahmeerkhan12
Copy link

Is this issue still open?

@Harshdev098
Copy link
Contributor Author

@hongquan Done with the changes

@hongquan
Copy link
Member

Could you look back and check your work, there are many occurence of "inconsistent style of variable name".

@Harshdev098
Copy link
Contributor Author

Done with the required changes @hongquan

@Harshdev098 Harshdev098 requested a review from hongquan April 2, 2025 07:33
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