Kharagpur Winter of Code 2020

Rajiv Ranjan Singh

Rajiv Ranjan Singh / January 03, 2021

6 min read β€’ ––– views

About

Kharagpur Winter of Code is a 5-week long online program for students who are new to open source software development. The program not only helps students to get involved in open source but also prepares them for many open-source summer programs; Google Summer of Code is one of them.

Why KWoC?

Intro to Open Source

KWoC provides an excellent opportunity to get acquainted with Github with Git commands and contribute to open source efficiently. Brush up your coding skills

If you love coding and want to learn about software development, then KWoC helps you get a glimpse of it and gives you a head start.

Prepare for GSoC

With KWoC, you get to know about how to select a project, interact with mentors and learn all other things that prepare you in the best way for the next GSoC.

KWoC Experience

I had contributed to 3 projects:

Graph-API

In this project, I have added ESLint and Prettier GitHub actions and refactored the README file.

Prettier

Prettier is an opinionated code formatter with support for:

Also, it integrates with popular text editors such as Atom and VSCode, and it can be run automatically on save.

Prettier is very popular because it improves code readability and makes the coding style consistent for teams. In addition, developers are more likely to adopt a standard rather than writing their code style from scratch, so tools like Prettier will make your code look good without you ever having to dabble in the formatting.

name: Prettier

on:
 push:
 branches:
 - master
 pull_request:
 branches:
 - master

jobs:
 prettier:
 runs-on: ubuntu-latest

 steps:
 - name: GitHub Action for Prettier
 uses: actions/checkout@v2
 with:
 # Make sure the actual branch is checked out when running on pull requests
 ref: ${{ github.head_ref }}

 - name: Prettify code
 uses: creyD/prettier_action@v2.2
 with:
 # This part is also where you can pass other options, for example:
 prettier_options: --write **/*.{css,html,js,md}

ESLint

ESLint is a tool for identifying and reporting patterns found in ECMAScript/JavaScript code to make code more consistent and avoid bugs. In many ways, it is similar to JSLint and JSHint with a few exceptions:

  • ESLint uses Espree for JavaScript parsing.
  • ESLint uses an AST to evaluate patterns in code.
  • ESLint is completely pluggable, every single rule is a plugin, and you can add more at runtime.
name: ESLint

on:
 push:
 branches:
 - master
 pull_request:
 branches:
 - master

jobs:
 eslint:
 runs-on: ubuntu-latest
 steps:
 - uses: actions/checkout@v1
 with:
 fetch-depth: 1
 - uses: actions/setup-node@v1
 with:
 node-version: 12
 - run: rm -f .yarnclean
 - run: yarn --frozen-lockfile --ignore-engines --ignore-optional --no-bin-links --non-interactive --silent --ignore-scripts --production=false
 env:
 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
 HUSKY_SKIP_INSTALL: true
 # Alternative: if you use npm instead of yarn
 # - run: npm ci --no-audit --prefer-offline
 - uses: tinovyatkin/action-eslint@v1
 with:
 repo-token: ${{secrets.GITHUB_TOKEN}}
 check-name: eslint # this is the check name from above where to post annotations

Configuration file for ESLint, i.e. .eslintrc.json looks like this:

{
  "env": {
    "commonjs": true,
    "es6": true,
    "node": true
  },
  "extends": ["prettier", "airbnb-base"],
  "plugins": ["prettier"],
  "globals": {
    "Atomics": "readonly",
    "SharedArrayBuffer": "readonly"
  },
  "parserOptions": {
    "ecmaVersion": 2018
  },
  "rules": {
    "prettier/prettier": "error"
  }
}

notation-converter

In this project, I have added an issue template for the feature request and added ESLint and Prettier GitHub actions which are explained above.

Issue template for the feature request looks like this:

---
name: πŸš€ Feature
about: Submit a proposal/request for a new feature
labels: "feature"
---

## πŸš€ Feature

(A clear and concise description of what the feature is.)

## Please Describe The Problem To Be Solved

(Replace This Text: Please present a concise description of the problem to be addressed by this feature request. Please be clear what parts of the problem are considered to be in-scope and out-of-scope.)

## (Optional): Suggest a Solution

(Replace This Text: A concise description of your preferred solution. Things to address include:

- Details of the technical implementation
- Tradeoffs made in design decisions
- Caveats and considerations for the future

If there are multiple solutions, please present each one separately. Save comparisons for the very end.)

<!--
 What happens if you skip this step?

 Someone will read your feature proposal and maybe will be able to help you,
 but it’s unlikely that it will get much attention from the team. Eventually,
 the issue will likely get closed in favor of issues that have better explanations.

 Thanks for helping us help you!
-->

World Lines

In this project, I have added golangci-lint. golangci-lint is a fast Go linters runner. It runs linters in parallel, uses caching, supports yaml config, has integrations with all major IDE, and has dozens of linters included.

name: golangci-lint
on:
  push:
  tags:
    - v*
  branches:
    - master
    - main
  pull_request:
jobs:
  golangci:
  name: lint
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v2
    - name: golangci-lint
  uses: golangci/golangci-lint-action@v2
  with:
  # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
  version: v1.29
  # Optional: working directory, useful for monorepos
  # working-directory: somedir
  # Optional: golangci-lint command line arguments.
  # args: --issues-exit-code=0
  # Optional: show only new issues if it's a pull request. The default value is `false`.
  # only-new-issues: true

KWoC statistics

Issues created:

Pull requests merged:

Conclusion

I am thankful to my project mentors, who guided me patiently through the project and were always ready to help, review work in progress, give feedback regarding the overall shape of the project. Last but not least, I would like to thank Kharagpur Open Source Society (KOSS) and Kharagpur Winter of Code (KWoC) organizers for this initiative.