Code Reviews

Introduction

In this article you’ll find out how to submit code to The C# Academy for review. The objective is to make it easy for reviewers to clone and test code and submit comments directly on code. It’s also similar to the work flow used in real life production applications and will force you to get familiar with how to submit pull requests on Github. Here’s a step by step list with the process. You’ll probably need it for the first few projects and then it will become second nature.

Once your pull request is approved, your repository will be part of the C# Academy archive. The reviewers will be relatively strict with coding standards, so you'll have a good taste of the demands of the software engineering industry. Below is a video tutorial plus a list of steps on how to create a pull-request for your code to be reviewed.

1. Forking the Review Repository

Log into Github and create a fork of our review repository. Each project in the academy has a different review repository .They can be found here. If you can't find a repository for a project, let us know by reaching out via our Discord community.

2. Clone The Fork

Click on the green “Code” button to see the repository name. You can click on the two-square icon to copy the repository’s address.

Using the command line, navigate to a folder of your choice and use the following command:

git clone your-repository-name. The repository consists of a list of folders, one for each project from other students, that has been submitted, approved and merged.

3. Create Your Project

Using visual studio, create a new project with the following name: 'projectName.yourGithubName' and when prompted for its location, choose the folder that was created when cloned the repository. It will inside the folder you used in step 2.

4. Commit and Push your Changes

After finishing working on your project, stage, commit and push your changes to your fork. You won't be able to push your changes from your projects folder, since the repository was initiated in the parent folder. You can either open the parent folder with Visual Studio, or push your changes via the command line, from the parent folder, where you can use the following commands:

git add .
git commit -m "type your message here"
git push

5. Create a Pull Request

Back in Github, go to your fork where you’ll see a message saying your branch is ahead of the master. Click on contribute and “Open Pull Request”. By default, the title will be the message in your last commit. You can choose to change the title or leave as it is. Then click on “Create Pull Request”.

6. Fix any code-analysis issues

We're currently implementing automatic code-analysis to speed up the code review process. In some projects, after submitting a pull request, you'll see the following:

This means your code is currently being scanned by a code-analysis tool. Wait a few minutes and you'll see if any issues have been picked up. If no problems were found, you don't need to do anything. You'll see the following message:

If issues were found, you'll see the following message. Click on the 'details' link on the right side:

Another screen will be opened. Click on 'Resolve' or 'View more details on Codacy Production':

In the next screen you'll be able to see all pending issues. You can expand each alert to see exactly where the error is by click on the down arrow on the right side. Go back to your code, fix those errors, commit and push. Your PR will be updated automatically and the code-analysis will run again. Check if all tests passed and wait for The C# Academy to review your code.

7. Rework your project

Once you change your project based on the comments, all you need to do is repeat step 4 (stage, commit, push) and the pull request will be updated. You don’t need to submit another Pull request. Once your project is accepted, go to the Academy's repository where you'll see your project included.

Ask Questions

Dealing with source control can be cumbersome and there's a bit to learn. But it's a vital aspect of a developer's knowledge and it's important you get used to troubleshooting it, since you'll inevitably need it when working in any organization. Feel free to get help on our Discord community if you get stuck.

Common Issues

  • Before submitting your code, make sure it follows C# coding conventions.
  • Remove unused 'using' statements and any other code that's not being used.
  • Don't write too many statements without spacing. It makes your code harder to read.
  • On the other hand, never have more than one empty line. Or empty lines between code and brackets.
  • Use the latest namespaces and usings convention to prevent extra indentation of your classes and to write less code.
  • Double check the project's requirements to make sure your project fulfils them.
  • Refactor your code. You'll be surprised about how many improvements you can think of by checking your code a couple more times after completion.

Introduction

In this article you’ll find out how to submit code to The C# Academy for review. The objective is to make it easy for reviewers to clone and test code and submit comments directly on code. It’s also similar to the work flow used in real life production applications and will force you to get familiar with how to submit pull requests on Github. Here’s a step by step list with the process. You’ll probably need it for the first few projects and then it will become second nature.

Once your pull request is approved, your repository will be part of the C# Academy archive. The reviewers will be relatively strict with coding standards, so you'll have a good taste of the demands of the software engineering industry. Below is a video tutorial plus a list of steps on how to create a pull-request for your code to be reviewed.

1. Forking the Review Repository

Log into Github and create a fork of our review repository. Each project in the academy has a different review repository .They can be found here. If you can't find a repository for a project, let us know by reaching out via our Discord community.

2. Clone The Fork

Click on the green “Code” button to see the repository name. You can click on the two-square icon to copy the repository’s address.

Using the command line, navigate to a folder of your choice and use the following command:

git clone your-repository-name. The repository consists of a list of folders, one for each project from other students, that has been submitted, approved and merged.

3. Create Your Project

Using visual studio, create a new project with the following name: 'projectName.yourGithubName' and when prompted for its location, choose the folder that was created when cloned the repository. It will inside the folder you used in step 2.

4. Commit and Push your Changes

After finishing working on your project, stage, commit and push your changes to your fork. You won't be able to push your changes from your projects folder, since the repository was initiated in the parent folder. You can either open the parent folder with Visual Studio, or push your changes via the command line, from the parent folder, where you can use the following commands:

git add .
git commit -m "type your message here"
git push

5. Create a Pull Request

Back in Github, go to your fork where you’ll see a message saying your branch is ahead of the master. Click on contribute and “Open Pull Request”. By default, the title will be the message in your last commit. You can choose to change the title or leave as it is. Then click on “Create Pull Request”.

6. Fix any code-analysis issues

We're currently implementing automatic code-analysis to speed up the code review process. In some projects, after submitting a pull request, you'll see the following:

This means your code is currently being scanned by a code-analysis tool. Wait a few minutes and you'll see if any issues have been picked up. If no problems were found, you don't need to do anything. You'll see the following message:

If issues were found, you'll see the following message. Click on the 'details' link on the right side:

Another screen will be opened. Click on 'Resolve' or 'View more details on Codacy Production':

In the next screen you'll be able to see all pending issues. You can expand each alert to see exactly where the error is by click on the down arrow on the right side. Go back to your code, fix those errors, commit and push. Your PR will be updated automatically and the code-analysis will run again. Check if all tests passed and wait for The C# Academy to review your code.

7. Rework your project

Once you change your project based on the comments, all you need to do is repeat step 4 (stage, commit, push) and the pull request will be updated. You don’t need to submit another Pull request. Once your project is accepted, go to the Academy's repository where you'll see your project included.

Ask Questions

Dealing with source control can be cumbersome and there's a bit to learn. But it's a vital aspect of a developer's knowledge and it's important you get used to troubleshooting it, since you'll inevitably need it when working in any organization. Feel free to get help on our Discord community if you get stuck.

Common Issues

  • Before submitting your code, make sure it follows C# coding conventions.
  • Remove unused 'using' statements and any other code that's not being used.
  • Don't write too many statements without spacing. It makes your code harder to read.
  • On the other hand, never have more than one empty line. Or empty lines between code and brackets.
  • Use the latest namespaces and usings convention to prevent extra indentation of your classes and to write less code.
  • Double check the project's requirements to make sure your project fulfils them.
  • Refactor your code. You'll be surprised about how many improvements you can think of by checking your code a couple more times after completion.

An error has occurred. This application may no longer respond until reloaded. Reload 🗙