Repository with source code from http://rosettacode.org/wiki/Category:Kotlin

Overview

Build Status Gitter chat

Rosetta Code Kotlin

This is a repository with the Kotlin source code from RosettaCode wiki.

The main motivation for extracting all the code into a repository is to make sure it actually compiles and to make it more maintainable (e.g. by applying static analysis and migrating code as the Kotlin language evolves).

This project is intended to be like a wiki. You are, therefore, more than welcome to contribute. All pull requests will be considered.

How to contribute?

In general, the following things can be improved:

  • clean up code (e.g. using IDE suggestions)
  • add unit tests for existing tasks
  • update all tasks to the latest version of Kotlin

Step 1: Fork, clone and compile

You will need to fork the repository on GitHub and then clone that repository to your working computer – the usual GitHub workflow. Once you have your local clone, make sure the project compiles (it's good to check you can compile the project yourself even if it's green in CI server).

If you want to use Gradle, then ./gradlew classes.

Step 2: Pull code from Rosetta Code website

You will need to run a script which checks that Kotlin code in repository is still the same as Kotlin code on Rosetta Code website. There are several ways to do it:

  • in Gradle run ./gradlew pull.
  • in IDE run scripts/PullFromRosettaCode.kt.

Note that the script caches data downloaded from web into .cache directory. You can run the script without clearing cache using ./gradlew pullDirty or scripts/PullFromRosettaCodeDirty.kt. This will make script execution faster but changes from RosettaCode website might be missed.

Possible outputs from the script:

  • all source code files match perfectly. You can move to the next step :)
  • source code exists on Rosetta Code website but doesn't exist in git repository. The script will automatically download source code. But you will need to compile it, add to git, commit and send a pull request.
  • source code exists in git repository but doesn't exist on Rosetta Code website.
  • source code exists in both git repository and the website, but has different content. In this case you will need to manually find what the difference is, and modify repository or website to keep code in sync. You can set system property to automatically pull code from website for files with difference, e.g. ./gradlew -DoverwriteLocalFiles=true pull.

Files downloaded by the script will have additional package task_name line which might not exist on Rosetta Code website. This is to avoid name clashes between different tasks. This line won't be considered when diffing repository and website code. If you use IDE to edit Kotlin code, it might report that package name doesn't match file directory. It's suggested to disable this inspection for this project.

Step 3: Add/modify tasks

  • Make changes and check that project still compiles (and tests pass).

  • Commit, push and send pull request on GitHub.

  • Update Rosetta Code website:

    • in Gradle run ./gradlew push.
    • in IDE run scripts/PushToRosettaCode.kt.

    You need to have an account on Rosetta Code website to make modifications.
    Adding new tasks is currently a manual step, i.e. you can only do it from browser. (It might be a good idea to use <lang scala> tag because Kotlin doesn't have syntax highlighting on Rosetta Code website at the moment.)

Step 4: Profit

Congratulations! You have just contributed to the World Wide Web!! :octocat:

You might also like...
The source code for the Words app codelab

Words App This folder contains the source code for the Words app codelab. Introduction Words app allows you to select a letter and use Intents to navi

The source code of the MVVM Caching Course
The source code of the MVVM Caching Course

MVVM Caching Course This is the source code of the MVVM Caching Course created by Florian Walther (Coding in Flow) and Gabor Varadi (Zhuinden/EpicPand

This folder contains the source code for the Words app codelab.

Words App This folder contains the source code for the Words app codelab. Introduction Words app allows you to select a letter and use Intents to navi

This folder contains the source code for the Bus Scheduler app codelab

Bus Scheduler App This folder contains the source code for the Bus Scheduler app codelab. Introduction The Bus Scheduler app displays a list of bus st

This folder contains the source code for the Words app codelab

Words App This folder contains the source code for the Words app codelab. Introd

Advent of Code 2021 in Kotlin, solved by myself. Focus on code readability. With GitHub Actions all puzzles are executed and their solutions printed

Advent of Code 2021 in Kotlin Focus on Code Readability. With CI Solution Printing. Welcome to the Advent of Code1 Kotlin project created by michaeltr

A repository full of Forge 1.8.9 Kotlin utilities

kotlin-forge-api kotlin-forge-api is a repository full of different APIs to be used by mods for Forge 1.8.9 to make modding easier! Warning! To use an

This repository shows how to declare Hibernate entities using Kotlin
This repository shows how to declare Hibernate entities using Kotlin

JPA Entities in Kotlin This repository was originally used in the "Getting the Most from JPA with Kotlin" webinar. To follow the webinar flow step by

This repository demonstrates how Kotlin can simplify Spring Boot configuration properties file mapping

Kotlin spring-boot nested config props This repository demonstrates how Kotlin can simplify Spring Boot configuration properties file mapping @Constru

Comments
  • Gradle build

    Gradle build

    I added a Gradle build, using a Groovy script for now, a Kotlin script to replace it is in the works. I amended the readme file accordingly. The .gitignore script has been added.

    opened by russel 0
  • No modification reason on RC.

    No modification reason on RC.

    This flow should be improved to give proper modification reasons on Rosetta Code rather that the current "see this repo" which requires further searching to see if anyone deigned to comment for RC.

    opened by Paddy3118 2
Owner
Dmitry Kandalov
Dmitry Kandalov
XliteKt is an open-source, and forever open-source Kotlin based OSRS Emulator for educational purposes.

xlitekt Introduction XliteKt is an open-source, and forever open-source Kotlin based OSRS Emulator for educational purposes. Currently built around th

Runetopic 6 Dec 16, 2022
Akka-in-action-kotlin - Accompanying source code for Akka in Action by Kotlin

Akka実践バイブル Kotlin版サンプルコード ( Accompanying source code for Akka in Action by Kotli

nrs 7 Jul 26, 2022
Provides Ktor Server libs for building awesome Kotlin plugins which needs to provide builtin HTTP servers

Ktor Plugin Provides Ktor Server libs for building awesome Kotlin plugins which needs to provide builtin HTTP servers. Requires: https://github.com/Po

null 0 Nov 13, 2021
Webclient-kotlin-sample - An example of using the http web client to promote synchronous and asynchronous https calls

Web Client Consumer Kotlin Sample The project is an example of using the http we

null 1 May 1, 2022
A server which delivers client configuration settings to an end-user over http.

RuneTopic HTTP Server A server which delivers client configuration settings to an end-user over http. Setup Guide You can host a http server with Dock

Runetopic 2 Dec 1, 2021
Multiplatform HTTP-Client implementation using Ktor

Kotlin Multiplatform HTTP-Client using Ktor Simple demonstration of a Ktor-based multiplatform HTTP-client in Kotlin Overview base submodule: common c

Jan Weidenhaupt 2 Oct 21, 2022
Kotlin microservices with REST, and gRPC using BFF pattern. This repository contains backend services. Everything is dockerized and ready to "Go" actually "Kotlin" :-)

Microservices Kotlin gRPC Deployed in EC2, Check it out! This repo contains microservices written in Kotlin with BFF pattern for performing CRUD opera

Oguzhan 18 Apr 21, 2022
This folder contains the source code for the Words app codelab.

Words App This folder contains the source code for the Words app codelab. Introduction Words app allows you to select a letter and use Intents to navi

Ibrahim Alfaifi 0 Nov 8, 2021
This folder contains the source code for the Words app codelab.

Choose the letter, choose the word from a list then press it to google search for it. Ps. Learnt from Android-Basics-Kotlin powered by Google.

null 0 Nov 14, 2021