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

Add diff-advance exercise #365

Merged
merged 7 commits into from
Nov 2, 2024
Merged

Conversation

BaoCaiH
Copy link
Contributor

@BaoCaiH BaoCaiH commented Mar 1, 2024

Exercise for issue #356

Summary by CodeRabbit

  • Documentation
    • Introduced a new README file titled "Git Kata: Git Diff Advance," detailing tasks for exploring git diff functionalities.
    • Provided setup instructions and objectives for comparing branches and using specific git diff options.
    • Included practical examples and a list of relevant commands to assist users.

@MadsNielsen
Copy link
Contributor

@coderabbitai review

Copy link

coderabbitai bot commented Apr 26, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes introduce a new README file titled "Git Kata: Git Diff Advance," which outlines tasks for exploring functionalities of the git diff command. It includes setup instructions for initializing the environment, objectives for comparing branches using different git diff options, and emphasizes the use of --word-diff and --name-only. Additionally, it provides examples for selectively compiling or testing changed files, particularly focusing on .pipeline files, along with relevant commands and options.

Changes

File Path Summary
.../README.md Introduces a Git Kata on advanced git diff usage, covering branch comparisons and selective testing.

🐇🌟
In the warren of code, a new Kata takes flight,
With diffs that shimmer in the digital light.
Branches entwine, words in a dance,
In the git-lit expanse, changes enhance.
Skipping through commits, a coder's trance! 🌙
🐇🌟


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

@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

Out of diff range and nitpick comments (2)
diff-advance/README.md (2)

13-13: Consider revising to "Notice what is being removed and added."


16-16: Consider revising to "Let's say we only want to test the pipelines because we're confident enough with the utils not to test them (naughty-list programmer)."

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

Out of diff range and nitpick comments (1)
diff-advance/README.md (1)

16-16: Try to vary your phrasing to enhance readability.

3. Compare `git diff master pipeline-improvement` and `git diff pipeline-improvement master`. Notice what is being removed and added.
4. Include `--word-diff` with `git diff`. In addition to the default, word diff can also be used in different modes, i.e. `--word-diff=color`. See how it is different from normal diff.
5. Include `--name-only` option with `git diff` and see the result.
6. With `--name-only`, we get a list of changed files. This can be useful for example when we want to do selective compile/test of changed files instead of a full re-build, given that steps can be compiled/tested independently. In our exercise, there are 3 steps in a pipeline and a utilities file. Let's say we only want to test the pipelines because we're confident enough with the utils to not test them (naughty-list programmer). We can do something like this:
Copy link

Choose a reason for hiding this comment

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

Consider using "an" instead of "a" before "utilities file" as it sounds more natural.

- a utilities file
+ an utilities file

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.

Suggested change
6. With `--name-only`, we get a list of changed files. This can be useful for example when we want to do selective compile/test of changed files instead of a full re-build, given that steps can be compiled/tested independently. In our exercise, there are 3 steps in a pipeline and a utilities file. Let's say we only want to test the pipelines because we're confident enough with the utils to not test them (naughty-list programmer). We can do something like this:
6. With `--name-only`, we get a list of changed files. This can be useful for example when we want to do selective compile/test of changed files instead of a full re-build, given that steps can be compiled/tested independently. In our exercise, there are 3 steps in a pipeline and an utilities file. Let's say we only want to test the pipelines because we're confident enough with the utils to not test them (naughty-list programmer). We can do something like this:

This will:
1. Get a list of the changed files
2. Filter for only `.pipeline` files
3. `cat`/test only these files
Copy link

Choose a reason for hiding this comment

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

Avoid redundancy by using synonyms or restructuring the sentence.

- `cat`/test only these files
+ `cat`/test these files

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.

Suggested change
3. `cat`/test only these files
3. `cat`/test these files

Comment on lines 18 to 24
`git diff --name-only | grep .pipeline | xargs cat`

This will:
1. Get a list of the changed files
2. Filter for only `.pipeline` files
3. `cat`/test only these files

Copy link

Choose a reason for hiding this comment

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

Clarify the example command to enhance understanding.

- `git diff --name-only | grep .pipeline | xargs cat`
+ `git diff --name-only | grep '.pipeline' | xargs cat`

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.

Suggested change
`git diff --name-only | grep .pipeline | xargs cat`
This will:
1. Get a list of the changed files
2. Filter for only `.pipeline` files
3. `cat`/test only these files
`git diff --name-only | grep '.pipeline' | xargs cat`
This will:
1. Get a list of the changed files
2. Filter for only `.pipeline` files
3. `cat`/test only these files

Comment on lines 25 to 30
## Relevant commands and options
- `git diff`
- `--word-diff`
- `--name-only`
- `grep`
- `xargs`
Copy link

Choose a reason for hiding this comment

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

Ensure proper markdown formatting by adding blank lines around the list.

+ 
- `git diff`
- `--word-diff`
- `--name-only`
- `grep`
- `xargs`
+ 

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.

Suggested change
## Relevant commands and options
- `git diff`
- `--word-diff`
- `--name-only`
- `grep`
- `xargs`
## Relevant commands and options
- `git diff`
- `--word-diff`
- `--name-only`
- `grep`
- `xargs`

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

diff-advance/README.md Show resolved Hide resolved
@BaoCaiH
Copy link
Contributor Author

BaoCaiH commented Apr 26, 2024

You can close this if you want, I'm not doing any more changes base on this AI's review

@JKrag
Copy link
Contributor

JKrag commented Nov 2, 2024

@BaoCaiH Thanks a lot for this contribution and sorry for the very long delay in looking at it.
Don't worry about the Coderabbit AI review. We were mostly just testing out the tool, and needed an actual repo to test it on, and I just let it run because "why not".
I tried your exercise, and it works quite well.

@JKrag JKrag merged commit 733377c into eficode-academy:master Nov 2, 2024
9 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