Skip to content

Latest commit

 

History

History
132 lines (98 loc) · 3.55 KB

CONTRIBUTING.md

File metadata and controls

132 lines (98 loc) · 3.55 KB

How to contribute

  • Fork the repository. If you are not used to Github, please check out fork a repository.
  • Branch your repository, to commit the desired changes.
  • Test your code.
  • Send a pull request to us.

Recommended soft

How to submit an issue

  • Use bug report or feature request templates.

How to submit a pull request

  • Check if the develop branch exists. If it exist use it to pull your request into.
  • If you want to send a bug fix, use Fix word in the title of your PR (i.e. Fix page permissions).
  • If you want to send a new feature, use Add word in the title of your PR (i.e Add a new frontpage template).

In any case, the title of each of your commits should continue such a phrase — If applied, this commit will ... (Update HelloPortal addon, etc.)

Styleguides with examples

PHP Styleguide

  • Use PHP 8.1+ with tabs instead of spaces
/**
 * Get array with bubble sorting
 *
 * @param array $array
 * @return array
 */
function getBubbleSortedArray(array $array): array
{
    $count = count($array);
    for ($j = 0; $j < $count - 1; $j++) {
        for ($i = 0; $i < $count - $j - 1; $i++) {
            if ($array[$i] > $array[$i + 1]){
                $tmp_var = $array[$i + 1];
                $array[$i + 1] = $array[$i];
                $array[$i] = $tmp_var;
            }
        }
    }

    return $array;
}

$array = [5, 3, 2, 6, 1, 4, 7];
$result = getBubbleSortedArray($array);
var_dump($result);

In short

  • Variable names: $camelCase = true
  • Function names: snake_case()
  • Class names: class PascalCase
  • Method names: $this->camelCase()
  • Array key names: $var['snake_case']
  • Object key names: $obj->camelCase
  • Constant names: CONSTANT_NAME

HTML Styleguide

CSS Styleguide

  • Use LESS (portal.less) to modify desired rules.
#comment_form {
  textarea {
    width: 100%;
    height: 30px;
  }

  button {
    &[name='comment'] {
      margin-top: 10px;
      float: right;
      display: none;
    }
  }
}

JavaScript Styleguide

'use strict';

Array.prototype.bubbleSort = function () {
  let swapped;

  do {
    swapped = false;

    this.forEach((item, index) => {
      if (item > this[index + 1]) {
        let temp = item;

        this[index] = this[index + 1];
        this[index + 1] = temp;
        swapped = true;
      }
    });
  } while (swapped);

  return this;
};

const arr = [5, 3, 2, 6, 1, 4, 7];
console.log('Source array: ', arr);
// Source array:  (7) [5, 3, 2, 6, 1, 4, 7]

console.log('Sorted array: ', arr.bubbleSort());
// Sorted array:  (7) [1, 2, 3, 4, 5, 6, 7]

Semantic Versioning

We try using Major.Minor.Patch for releases.