Skip to content

Coding Standards for writing this repository

Fernando Dodino edited this page Nov 16, 2019 · 12 revisions

These are the recommended coding standards & conventions

IDE

General consideration

  • we use english as primary language, although in issues you can express yourself in spanish if you feel more comfortable
  • define always good and intention-revealing names, no p, no x please!

Wollok files

  • use 2 spaces for indent, no tabs
  • declarative sentences preferred, eg. fold instead of forEach, any instead of count + length > 0
  • value objects should be considered immutable

Before opening a PR

It could be useful to verify the code and run the sanity tests with wollok-cli. Recommended way of making changes:

  • having wollok xtext implementation. Lets say root folder is wollok
  • alter a Wollok core library file (lang.wlk, lib.wlk or any other)
  • go to Eclipse Wollok Xtext and refresh org.uqbar.project.wollok.lib folder. This will update the .jars files
  • child wollok folder should point to this github repository, for example: wollok-language
  • run the following script in wollok-language folder
./validateWollokXtext.sh

This will check

  • .wlk core libraries (with Xtext validations)
  • and sanity tests (omitting validation process, running only Wollok interpreter)

Changes could break any Wollok implementation, but at least you are sure which are the next steps.

Sanity Tests

  • we have a folder hierarchy, so you should add your in the corresponding location. If you have questions, you can subscribe to wollok-dev@googlegroups.com and send e-mails.
  • if you are adding a new file, take your time, and explain
    • the scenario: which features do the classes/objects have. Avoid complex scenarios, split them into several files to ease maintainability.
    • tests, where they begin
  • whenever possible, avoid several asserts in the same test