danthareja / contribute-to-open-source

[STILL ACTIVE] Learn the GitHub workflow by contributing code in a fun simulation project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DRY up the codebase

danthareja opened this issue · comments

Welcome new contributors!

In this experience, you are a doer. You take action first, and learn about the action afterwards. This design helps you get comfortable in the unknown, an entity that is omnipresent in the coding world. If you're feeling confused, that's ok. Read the instructions carefully, trust the process, and have fun!

To help guide you through the experience, there will be comment blocks (like the one your reading now) that explains just enough context before your next action.

Open Source and GitHub

An open source project is any code that can be freely used, changed, and shared by anyone. An open source project usually contains a license that declares specific terms of use. Open source projects are important because they help develop and spread great ideas and push technology forward.

GitHub is a website that hosts open source projects. A project on GitHub is called a repository (or repo), a folder that holds code. GitHub allows people to collaborate on a repo through features like issues and pull requests. By the end of this experience, you'll understand how to use these features to contribute your ideas to other projects.

Issues

Issues (like this one) allow people to track and discuss any task related to the project. Issues are not always problems with the code. They can also be feature requests or questions about how to use the code.

To help organize the project, issues can be tagged with one or more label. When you graduate from this project and are looking for more ways to contribute, look for projects with issues tagged with labels help wanted, good first issue, up-for-grabs, first-timers-only, or something similarly inviting.

Your turn

Now that you have a bit of context about the experience, continue reading the body of the issue to learn how to fix it.


We're off to an amazing start disrupting the calculator industry. Our beautiful contributors burned all of last week's midnight oil to release our first version and the initial reception has been unprecedented!

After a code review from some experts, we've learned that there's some unnecessary repetition in the codebase. Removing this repetition will make our codebase easier to maintain as we continue to grow into the world's best calculator company.

The team is burnt out from last week's push and needs your help! Before blowing half of our capital investment on a vacation in the Swiss Alps, the team managed to write some tests for this refactor, and left behind a roadmap to the next big release:


This experience can be completed by multiple people. Below, you'll see references to this issue from various other contributors. You can ignore them.

i am working on it and facing eslint problems since i am working on windows do i need to take care special care?

@sourabh1031, are they the same problems you mentioned in your other issue danthareja/contribute-to-open-source-server#2? If so, did you try what I mentioned in the reply?

No need. As long as the styling issues are fixed, you can keep developing on Windows.

is it still open for contribution?

Hey @Ri2parna, thanks for asking if this is still open, you're following a good practice when contributing to a new project.

In short, yes! This project is still open for contribution.

In long, everyone can always contribute to this project because you contribute you work to a branch made just for you (one is automatically created when you fork this repository). This deviates from most projects where you usually contribute to the master, and is done this way so that multiple people can practice contributing the same work.

Follow the instructions above and have fun!

Hey @danthareja, just wanted to say thanks for putting this little practice scenario together.

I've wanted to get into open source contribution for a while now, but was too intimidated by the Git arena to even get started. However, after going through your training module, I now feel like I have a better understanding of what's going on/how things are done and am confident enough to try to help out on some "real" projects!

I'm glad you enjoyed it @scelestus1, Have fun contributing out there!

Aaaaaaaa! I did it. My first PR accepted and the message saying "You did it. You are an open source developer now" is AN ABSOLUTE BLISS!
Thank you so much for such amazing and well-detailed guidelines. Means a lot.
Thank you.

Just one question, while contributing to real projects the only difference is in the last step that is creating the pull request across the forks, instead of changing the first base from master to ourselves(our username) we should keep that to master right? Correct me if I am wrong.

screenshot 28
In node.js the project is not install.What to do?

@niteshnanda02, did you figure this one out? Based on the screenshot, it looks like you are inside of the node command-line. If you follow the instruction to exit the (press Control+D), you should exit the node command-line, back to your regular terminal window. Once in the regular terminal window, you should be able to type npm install again.

@MisterAwesome23, apologies for the delay in getting back to you.

Aaaaaaaa! I did it. My first PR accepted and the message saying "You did it. You are an open source developer now" is AN ABSOLUTE BLISS!
Thank you so much for such amazing and well-detailed guidelines. Means a lot.
Thank you.

This makes me smile so much, I'm glad you enjoyed the process!

Just one question, while contributing to real projects the only difference is in the last step that is creating the pull request across the forks, instead of changing the first base from master to ourselves(our username) we should keep that to master right? Correct me if I am wrong.

Yes! By convention, most projects live on the master branch, so you would be correct in this case. This is not always the case though! Do make sure to reference the individual project's contributing guidelines to see if they require any special steps.

Just one question, while contributing to real projects the only difference is in the last step that is creating the pull request across the forks, instead of changing the first base from master to ourselves(our username) we should keep that to master right? Correct me if I am wrong.

What's the error in this?
screenshot 29

@niteshnanda02, this is the expected error message you will receive the first time you run npm test. Your job now is to make the red tests turn green by writing code in calculator.js that satisfies the test cases. If you're confused on exactly what the tests are doing, check out the documentation for the test libraries: Mocha and Chai and Sinon

Yeaaayy, my PR already merged. It's very excited even has been merged by bot.

Yess, my first commit ,
i am feeling so great !

Good question, @Xyno18!

There are a few comments that describe how to implement _check inside of the file src/calculator.js. If these comments are confusing, I'd recommend starting with a free introduction to JavaScript course to learn the basic syntax of the language. Once you're familiar with variables, conditional statements, and functions, you should come back here.

whyerror

why this error?

Hey,
Question: On this page Open a Pull Request part,

  • This is a weird requirement. In the real-world, most projects will expect you to open a Pull Request against the master base branch. Can you guess why it's needed here?

Why would be the reason?

Good question @qaws01395!

This requirement is necessary here in order to allow multiple people to contribute the same code. Without this requirement, once one contributor's PR was merged into master, no one else would be able to merge the same code.

Thanks for the explanation!

Hi,

I'm new to open source and would like to contribute.

Welcome to open-source, @jpkim921!

Have you completed the exercise from this repo? If not, that's a great place to start -- just complete the instructions in the issue's body above. Once you complete the exercise, you'll get an automated comment in your pull request with some ideas for your next contribution.

If you have further questions, feel free to ask here.

I'm new to Open Source collaboration, I can contribute?

commented

New to OpenSource and would like to contribute

Yes! @HakaCode and @OMLAKSHMI - you both are very welcome to contribute.

Please head over to issue #1 and follow the instructions there.

OKay, let me have a gpo @danthareja

Is this issue still active @danthareja

Yes! Everyone can contribute their own solution to this issue @karenefereyan. Make sure you read the instructions about submitting a PR to your own branch, and have fun!

Thank you ❤️ great job

Amazing

Team work

I had some problems with the dependencies, but I think I managed to fix it. Still, kind of afraid of messing everything up.

I haven't had this much fun debugging in a long time! I'm not really sure if I've ever had this much fun debugging, to be honest. Haven't fixed it yet, but really loving it. Thank you!

I made the PR, thanks for making this. Loved working on it!

Nice work @syspentarc, thanks for playing!

I'm new to GitHub, but I've done one or two PRs before and did my research prior to joining the platform. This really gave me more confidence in working on doing more of these types of contributions instead of looking more to documentation to contribute to.

Please consider doing more like this, I'd love to see more stuff exactly like this. 😄

Hi, I am new to contributing to open source and it was a fun little assignment. I just wanted clarification on one thing, we are selecting the base branch with our name so that we don't make changes to the master branch of the repo . Is that so?

Hi, I am new to contributing to open source and it was a fun little assignment. I just wanted clarification on one thing, we are selecting the base branch with our name so that we don't make changes to the master branch of the repo . Is that so?

Yeah, that's exactly right. That's a distinct difference between this project and one you'll find out in the real world.

If you made changes to the master branch of the repo, only one person would be able to contribute, or we'd have to do some complex revert/pulling which could be hard to understand for new contributors.

commented

I would like to contribute if possible?

I get a 185 errors when I run "npm run lint". The errors are all linebreak errors as follows "error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style"
Error

Thanks for helping us beginners to take our first steps.
Appreciate your efforts 😄

Sorry for the stupid question, but how do I take care of the errors? Have been following the instructions on this but I'm a bit lost now so any guidance would be appreciated.

Sorry for the stupid question, but how do I take care of the errors? Have been following the instructions on this but I'm a bit lost now so any guidance would be appreciated.

@TB9652
According to the image that you have posted, I think that you are using Windows to build the project. I recommend using Linux based OS like Ubuntu.
Also, if you do not have Ubuntu, you can always try using the Windows Subsystem for Linux (WSL), it is very convenient.

hey @TB9652, sorry for the delay here. there are no stupid questions!

windows and mac have two different default line endings. i authored this on a mac, which defaults to the 'CLRF' line ending. since you're on windows, you're seeing the error message, which is asking you to write to the mac line endings.

to fix the errors, try running npm run lint -- --fix, which tells eslint to self-correct these endings.

to fix the errors, try running npm run lint -- --fix, which tells eslint to self-correct these endings.

@danthareja @TB9652
Sorry, had no idea about this command.

Thanks for the guidance. I will try that and let you know how it goes. I'm not very well schooled on using Git Bash. I have more experience using Microsoft VS so this is a true learning experience for me.

Committed to the issue and contributed

Welcome new contributors!

In this experience, you are a doer. You take action first, and learn about the action afterwards. This design helps you get comfortable in the unknown, an entity that is omnipresent in the coding world. If you're feeling confused, that's ok. Read the instructions carefully, trust the process, and have fun!
To help guide you through the experience, there will be comment blocks (like the one your reading now) that explains just enough context before your next action.

Open Source and GitHub

An open source project is any code that can be freely used, changed, and shared by anyone. An open source project usually contains a license that declares specific terms of use. Open source projects are important because they help develop and spread great ideas and push technology forward.
GitHub is a website that hosts open source projects. A project on GitHub is called a repository (or repo), a folder that holds code. GitHub allows people to collaborate on a repo through features like issues and pull requests. By the end of this experience, you'll understand how to use these features to contribute your ideas to other projects.

Issues

Issues (like this one) allow people to track and discuss any task related to the project. Issues are not always problems with the code. They can also be feature requests or questions about how to use the code.
To help organize the project, issues can be tagged with one or more label. When you graduate from this project and are looking for more ways to contribute, look for projects with issues tagged with labels help wanted, good first issue, up-for-grabs, first-timers-only, or something similarly inviting.

Your turn

Now that you have a bit of context about the experience, continue reading the body of the issue to learn how to fix it.

We're off to an amazing start disrupting the calculator industry. Our beautiful contributors burned all of last week's midnight oil to release our first version and the initial reception has been unprecedented!

After a code review from some experts, we've learned that there's some unnecessary repetition in the codebase. Removing this repetition will make our codebase easier to maintain as we continue to grow into the world's best calculator company.

The team is burnt out from last week's push and needs your help! Before blowing half of our capital investment on a vacation in the Swiss Alps, the team managed to write some tests for this refactor, and left behind a roadmap to the next big release:

This experience can be completed my multiple people. Below, you'll see references to this issue from various other contributors. You can ignore them.

Implement check #27

How do you get your username to show up in the base ref when opening a new pull request?

#1512 how to implement check

@danthareja why is my pull request closed?

@danthareja why is my pull request closed?

As mentioned in the contributing guidelines, I can only accept a pull request made to your branch.

This is a weird requirement, but it's necessary here in order to allow multiple people to contribute the same code. In the real world, most projects would expect you to open a Pull Request against the master base branch.

Click here to open this pull request to your branch

Hi, in the npm run lint I am getting the following error:

img

@sourabh1031, are they the same problems you mentioned in your other issue danthareja/contribute-to-open-source-server#2? If so, did you try what I mentioned in the reply?

I believe this should be on the Contributors.md since we, begginners, dont understand this erros yet and ive run into this "problem" myself, or maybe we should at least be directed on how to solve then.

Could you please assign this task to me?

commented
commented

Can i work on this project?

this still an issue ?

Can i work on this?

commented

Hello 👋

commented

@danthareja There is a typo in the issue description

This experience can be completed my multiple people.

This experience can be completed by multiple people.

typo-in-issue-description

@danthareja There is a typo in the issue description

Great catch! Thanks for the contribution :)

It is said to implement __checks to make tests pass but when clicking on that link, I am directed to
exports._check = () => {
// DRY up the codebase with this function
// First, move the duplicate error checking code here
// Then, invoke this function inside each of the others
// HINT: you can invoke this function with exports._check()
};

What do these instructions mean? I am unclear about them as to what do I have to write in the codeblock

Just ran and re-ran the tests as per the instructions and noticed there was a change in the package-lock.json file. Did nothing on the code base though.