Merge branch 'develop'

This commit is contained in:
Dennis Eichhorn 2024-03-15 22:51:58 +00:00
commit 840c55c7ea
33 changed files with 259 additions and 87 deletions

12
.github/FUNDING.yml vendored
View File

@ -1,12 +0,0 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # orange_management
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://paypal.me/orangemgmt']

View File

@ -1,6 +1,6 @@
# Individual Contributor License Agreement ("CLA") 1.0
Thank you for your interest in Karaka-Management (the "Company"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Company must provide a Contributor License Agreement ("CLA") on file that has been made available to each Contributor. This license is for your protection as a Contributor as well as the protection of the Company and its users; it does not change your rights to use your own Contributions for any other purpose.
Thank you for your interest in Jingga e. K. (the "Company"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Company must provide a Contributor License Agreement ("CLA") on file that has been made available to each Contributor. This license is for your protection as a Contributor as well as the protection of the Company and its users; it does not change your rights to use your own Contributions for any other purpose.
By contributing to the Company You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Company. In return, the Company shall not use Your Contributions in a way that is contrary to the public benefit or inconsistent with its bylaws in effect at the time of the Contribution. Except for the license granted herein to the Company and recipients of software distributed by the Company, You reserve all right, title, and interest in and to Your Contributions.

View File

@ -21,4 +21,11 @@
* [Application Sample]({%}?page=phpOMS/application)
* [Modules]({%}?page=application/module)
* [Packages]({%}?page=application/packages)
* [Language Files]({%}?page=basics/language_files)
## phpOMS
## jsOMS
## cssOMS
## cOMS

View File

@ -3,11 +3,13 @@
The following directory structure shows how a update/patch package has to be structured.The purpose of the different files will be
covered afterwards.
```
* {UniquePackageName.tar.gz}
* signature.cert
* Files
* package.json
* {other_files_or_subdirectories}
```
## Package Name

View File

@ -1,6 +1,6 @@
```c++
/**
* Karaka
* Jingga
*
* @package App
* @copyright Dennis Eichhorn
@ -34,42 +34,42 @@ int main(int argc, char **argv)
/* --------------- Basic setup --------------- */
const char *arg = Utils::ApplicationUtils::compile_arg_line(argc, argv);
// Set program path as cwd
char *cwd = Utils::ApplicationUtils::cwd();
if (cwd == NULL) {
printf("Couldn't get the CWD\n");
return -1;
}
char *cwdT = Utils::StringUtils::search_replace(cwd, "\\", "/");
free(cwd);
cwd = cwdT;
Utils::ApplicationUtils::chdir_application(cwd, argv[0]);
// Check config
if (!Utils::FileUtils::file_exists("config.json")) {
Controller::ApiController::notInstalled(argc, argv);
return -1;
}
/* --------------- App setup --------------- */
// Load config
FILE *in = fopen("config.json", "r");
if (in == NULL) {
printf("Couldn't open config.json\n");
return -1;
}
app.config = nlohmann::json::parse(in);
fclose(in);
// Setup db connection
DataStorage::Database::DbConnectionConfig dbdata = {
DataStorage::Database::database_type_from_str(app.config["db"]["core"]["masters"]["admin"]["db"].get_ref<const std::string&>().c_str()),
@ -79,50 +79,50 @@ int main(int argc, char **argv)
app.config["db"]["core"]["masters"]["admin"]["login"].get_ref<const std::string&>().c_str(),
app.config["db"]["core"]["masters"]["admin"]["password"].get_ref<const std::string&>().c_str(),
};
app.pool = Threads::pool_create(app.config["app"]["threads"]["count"].get<int>());
app.db = DataStorage::Database::create_connection(dbdata);
app.db->connect();
/* --------------- Handle request --------------- */
// Handle routes
Router::Router router = generate_routes(&app);
Router::RouterFunc ptr = Router::match_route(&router, arg);
// No endpoint found
if (ptr == NULL) {
ptr = &Controller::ApiController::printHelp;
}
// Dispatch found endpoint
(*ptr)(argc, argv);
/* --------------- Cleanup --------------- */
Threads::pool_destroy(app.pool);
DataStorage::Database::free_MapperData((DataStorage::Database::MapperData *) &Models::ResourceMapper);
app.db->close();
app.db = NULL;
Router::free_router(&router);
free((char *) arg);
arg = NULL;
// Reset CWD (don't know if this is necessary)
chdir(cwd);
free(cwd);
}
```
```c++
/**
* Karaka
* Jingga
*
* @package Models
* @copyright Dennis Eichhorn
@ -146,12 +146,12 @@ Router::Router generate_routes(Application::ApplicationAbstract *app)
Controller::ApiController::app = app;
Router::Router router = Router::create_router(4);
Router::set(&router, "^.*?\\-h *.*$", (void *) &Controller::ApiController::printHelp);
Router::set(&router, "^.*?\\-v *.*$", (void *) &Controller::ApiController::printVersion);
Router::set(&router, "^.*?\\-r *.*$", (void *) &Controller::ApiController::checkResources);
Router::set(&router, "^.*?\\-\\-install *.*$", (void *) &Controller::InstallController::installApplication);
return router;
}

View File

@ -9,7 +9,7 @@ Alerts are boxes styled in such a way that they attract the attention of the use
![Alert ok](Developer-Guide/frontend/elements/alerts/ok.png)
```html
<div class="log-msg log-msg-status-ok"><i class="fa fa-check"></i>This is ok</div>
<div class="log-msg log-lvl-ok"><i class="fa fa-check"></i>This is ok</div>
```
#### Advanced
@ -17,7 +17,7 @@ Alerts are boxes styled in such a way that they attract the attention of the use
![Alert ok advanced](Developer-Guide/frontend/elements/alerts/ok_advanced.png)
```html
<div class="log-msg log-msg-status-ok">
<div class="log-msg log-lvl-ok">
<h1 class="log-msg-title">This is a Title</h1><i class="close fa fa-times"></i>
<div class="log-msg-content">This is a message</div>
</div>
@ -28,7 +28,7 @@ Alerts are boxes styled in such a way that they attract the attention of the use
![Alert info](Developer-Guide/frontend/elements/alerts/info.png)
```html
<div class="log-msg log-msg-status-info"><i class="fa fa-bell"></i>This is a info</div>
<div class="log-msg log-lvl-info"><i class="fa fa-bell"></i>This is a info</div>
```
### Warning
@ -36,7 +36,7 @@ Alerts are boxes styled in such a way that they attract the attention of the use
![Alert warning](Developer-Guide/frontend/elements/alerts/warning.png)
```html
<div class="log-msg log-msg-status-warning"><i class="fa fa-exclamation-triangle"></i>This is a warning</div>
<div class="log-msg log-lvl-warning"><i class="fa fa-exclamation-triangle"></i>This is a warning</div>
```
### Error
@ -44,7 +44,7 @@ Alerts are boxes styled in such a way that they attract the attention of the use
![Alert error](Developer-Guide/frontend/elements/alerts/error.png)
```html
<div class="log-msg log-msg-status-error"><i class="fa fa-times"></i>This is an error</div>
<div class="log-msg log-lvl-error"><i class="fa fa-times"></i>This is an error</div>
```

View File

@ -1,6 +1,6 @@
# First steps
After you installed the application and configured your development environment you are ready to make your first code contributions.
After you [installed]({%}?page=general/setup.md) the application and configured your development environment you are ready to make your first code contributions.
Please note that besides the general development guide the organization also provides various other organizational documents which help to understand the processes, development status and decisions made.
@ -11,3 +11,62 @@ Please note that besides the general development guide the organization also pro
* [Conflict of interest](https://github.com/Karaka-Management/Organization-Guide/blob/master/Policies%20%26%20Guidelines/Conflict%20of%20Interest%20Policy.md)
* [Activity Policy](https://github.com/Karaka-Management/Organization-Guide/blob/master/Policies%20%26%20Guidelines/Organization%20Activity%20Policy.md)
* [Organization Guidelines](https://github.com/Karaka-Management/Organization-Guide/blob/master/Policies%20%26%20Guidelines/Organization%20Guidelines.md)
## First tasks
### Unit tests & code coverage
Implement tests to improve code coverage. Uncovered lines can be found in the coverage [overview](https://dev.jingga.app/src/Karaka/build/coverage/).
### Documentation
#### Test documentation
All tests need to have the following docblocks:
##### Class
```php
/**
* @testdox phpOMS\tests\Image\SkewTest: Image skew
* @internal
*/
```
* @testdox Is a one-line test description which is included in a test report for customers. The **FQN is very important**, it must be present.
##### Function
```php
/**
* @testdox A image can be automatically unskewed
* @group framework
* @covers phpOMS\Image\Skew
*/
```
* @testdox Is a one-line test description which is included in a test report for customers.
* @group Is mostly `framework` (for phpOMS) or `module` for (for Modules)
* @covers Is used to restrict the class which is getting covered by this test
#### Module documentation
Modules have a `Help` and a `Dev` documentation both are insifficient for most modules. Feel free to add some documentation. Consider to use images wherever helpful. Consider to add the used images to https://github.com/Karaka-Management/Build/blob/master/Js/createImages.js which will automatically create new images even if the style changes or minor layout changes are made.
```js
...
[
'http://192.168.178.38/en/admin/module/settings?id=Admin#c-tab-3',
'//*[@id="content"]',
__dirname + '/../../Modules/Admin/Docs/Help/img/admin-module-admin-settings-design.png'
],
...
```
1. Url to the endpoint (must use the same IP used in other examples)
2. XPath of the content you want to take an image from
3. Output directory
### Todos
Usually todos with **low** priority and **easy** difficulty are good beginner todos: https://github.com/orgs/Karaka-Management/projects/10.

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
general/img/metrics.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
general/img/sitespeed.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
general/img/webgrind.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -2,9 +2,9 @@
In order to setup the application for development for the first time please see the following instructions and recommendations.
* [Dev-Environment Requirements](#dev-environment-requirements)
* [Application install options](#application-install-options)
* [cOMS](#coms)
* [Dev-Environment Requirements]({%}#dev-environment-requirements)
* [Application install options]({%}#application-install-options)
* [cOMS]({%}#coms)
## Dev-Environment Requirements
@ -16,7 +16,7 @@ The following dev tools are highly recommended and the documentation assumes you
```sh
# For php/html/javascript developers
sudo apt-get install git poppler-utils mariadb-server mariadb-client postgresql postgresql-contrib vsftpd tesseract-ocr wget curl grep sed composer nodejs npm software-properties-common php8.1 php8.1-dev php8.1-cli php8.1-common php8.1-mysql php8.1-pgsql php8.1-xdebug php8.1-opcache php8.1-pdo php8.1-sqlite php8.1-mbstring php8.1-curl php8.1-imap php8.1-bcmath php8.1-zip php8.1-dom php8.1-xml php8.1-phar php8.1-gd php-pear apache2 redis redis-server memcached sqlite3 wkhtmltopdf
sudo apt-get install git poppler-utils mariadb-server mariadb-client postgresql postgresql-contrib vsftpd tesseract-ocr wget curl grep sed composer nodejs npm software-properties-common php8.1 php8.1-dev php8.1-cli php8.1-common php8.1-mysql php8.1-pgsql php8.1-xdebug php8.1-opcache php8.1-pdo php8.1-sqlite php8.1-mbstring php8.1-curl php8.1-imap php8.1-bcmath php8.1-zip php8.1-dom php8.1-xml php8.1-phar php8.1-gd php-pear apache2 redis redis-server memcached sqlite3 wkhtmltopdf imagemagick
sudo systemctl enable apache2
sudo mysql_secure_installation
@ -42,11 +42,11 @@ Which IDE or editor a developer uses is up to the individual developer. From exp
## Application install options
Option 1 and 2 require you to install the dev tools in advance!
Option 2 and 3 require you to install the dev tools in advance!
1. Option: Use the virtual machine we provide for devs which has everything setup and configured to start almost instantly after download **Most Recommended**
2. Option: Installs the application (with a lot of dummy data, this may take a long time). **Recommended (slow but a lot of useful data)**
3. Option: Installs the application (with or without performing tests). **Recommended (slow and much less useful data)**
3. Option: Installs the application (with or without performing tests). **(slow and much less useful data)**
### Option 1: VM
@ -65,11 +65,18 @@ Please contact us if you would like to use our VM, we will send you a download l
Additional tools and settings coming with the VM:
1. Automatic trace and benchmark generation with every web request in `/var/www/html/webgrind/Logs`
2. Webgrind view `http://vm_ip:82`
3. Trace visualization `http://vm_ip:81`
1. composer & npm already installed incl. the respective developer tools
2. Automatic trace and benchmark generation with every web request in `/var/www/html/webgrind/Logs`
3. Webgrind view `http://vm_ip:82`
4. Trace visualization `http://vm_ip:81`
1. Download the latest trace from `http://vm_ip:82/Logs`
2. Drag and drop that downloaded `*.xt` file in the trace visualizer
5. `sitespeed.io ./Build/Helper/Scripts/sitespeedDemoUrls.txt -b chrome --outputFolder /var/www/html/sitespeed`
6. Slow sql query threashold is defined as 0.5s.
<p class="cT">
<img width="150px" tabindex="0" src="./Developer-Guide/general/img/webgrind.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/general/img/trace_visualizer.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/general/img/sitespeed.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/general/img/codecoverage.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/general/img/coverage_analysis.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/general/img/metrics.jpg">
</p>
### Option 2: Demo Application
@ -83,7 +90,7 @@ This will only setup the application including some dummy data and also perform
6. Run `npm install` inside `Karaka`
7. Create the database `omd` in your database management software
8. Adjust the `demoSetup/config.php` file according to your settings (e.g. database user name + password)
9. Run `php demoSetup/setup.php` inside `Karaka` (takes a long time: > 1h)
9. Run `php demoSetup/setup.php` inside `Karaka` (takes a long time: > 2h)
After the installation you'll have access to the following content:
@ -139,3 +146,7 @@ After the installation you'll have access to the following content:
If you are interest on working on the c++ code base you will in addition need the following tools and libraries:
* [OpenCV](https://docs.opencv.org/3.4/d7/d9f/tutorial_linux_install.html)
## References
[Installation](https://github.com/Karaka-Management/User-Guide/blob/develop/setup/install.md)

View File

@ -4,7 +4,9 @@ The user request gets passed through the entire application to all modules. The
The routes usually reference endpoints in the module `controllers` which collects the model data through the model `mapper` and creates a partial response `view` with an assigned `template` and the collected model data.
![Application Flow](Developer-Guide/general/app_flow.drawio.svg)
<p class="cT">
<img alt="Application Flow" src="./Developer-Guide/general/app_flow.drawio.svg">
</p>
In the following only the WebApplication and Application are mentioned as the other components are explained in detail in their respective documentation.
@ -33,4 +35,6 @@ Furthermore the Application also performs a `CSRF` check, defines the `CSP`, aut
A short extract of the database structure can be seen below. Please note that this only contains the very basic tables from a fresh install with very few modules and even then we only included the key tables for simplicity reasons.
![Application Flow](Developer-Guide/general/base_uml.drawio.svg)
<p class="cT">
<img alt="Application UML" src="./Developer-Guide/general/base_uml.drawio.svg">
</p>

View File

@ -37,7 +37,6 @@ data-update-tpl
data-tpl-text-path : remote path for the text
data-tpl-value-path : remote path for the text
## Todos
### General

View File

@ -21,10 +21,10 @@ The .htaccess file can be used to enable URL rewriting, file compression for css
## index.php
In the index file the application gets initialized and executed.
In the index file the application gets initialized and executed.
```php
<?php
<?php
declare(strict_types=1);
// index.php
@ -40,14 +40,14 @@ echo $App->run(); // outputs the application response
\ob_end_flush();
```
We use output buffering `\ob_start()` and `\ob_end_flush()` which allows the application to internally modify the response before it gets returned to the user.
We use output buffering `\ob_start()` and `\ob_end_flush()` which allows the application to internally modify the response before it gets returned to the user.
## Application.php
The application file is responsible for initializing the application resources, handling the request and response population (see Router and Dispatcher) as well as rendering the main view. Another task which is often performed in this file is the user authentication.
```php
<?php
<?php
declare(strict_types=1);
// app/Application.php
@ -160,7 +160,7 @@ class Application extends ApplicationAbstract
The routes file contains the routing information. which is responsible for matching URLs to application end-points.
```php
<?php
<?php
declare(strict_types=1);
// app/Routes.php

View File

@ -13,7 +13,7 @@ The content of the language files is very simple. All you need is the module nam
```php
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 KiB

BIN
quality/img/metrics.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

BIN
quality/img/phpcs.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 KiB

BIN
quality/img/phpstan.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
quality/img/rector.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
quality/img/sitespeed.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

BIN
quality/img/webgrind.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

View File

@ -7,6 +7,8 @@ Code inspections are very important in order to maintain the same code quality t
The following automated tests must pass without errors, failures and warnings for successful code changes:
* `php ./vendor/bin/phpstan analyse -l 9 -c Build/Config/phpstan.neon ./`
* `php ./vendor/bin/php-cs-fixer fix ./ --config=Build/Config/.php-cs-fixer.php --allow-risky=yes`
* `php ./vendor/bin/phpcbf --standard=Build/Config/phpcs.xml ./`
* `php ./vendor/bin/phpcs --severity=1 ./ --standard="Build/Config/phpcs.xml"`
* `php ./vendor/bin/phpunit -c tests/phpunit_no_coverage.xml`
* `php ./vendor/bin/rector process --config Build/Config/rector.php --dry-run ./`
@ -15,6 +17,10 @@ The following automated tests must pass without errors, failures and warnings fo
* `./cOMS/tests/test.sh`
* see [other checks](#other-checks) below
<p class="cT">
<img width="150px" tabindex="0" src="./Developer-Guide/quality/img/webgrind.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/quality/img/trace_visualizer.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/quality/img/sitespeed.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/quality/img/sitespeed_waterfall.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/quality/img/codecoverage.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/quality/img/coverage_analysis.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/quality/img/metrics.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/quality/img/phpunit_html.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/quality/img/phpcs.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/quality/img/phpstan.jpg"> <img width="150px" tabindex="0" src="./Developer-Guide/quality/img/rector.jpg">
</p>
Alternatively you can simply run the helper script in the Build repository, which executes a few of the above mentioned checks:
```sh
@ -121,11 +127,11 @@ Tools used for the code inspection are:
* PHPStan
* Jasmine
* PHPCS
* PHP CS Fixer
* PHP CBF
* Rector
* Custom scripts/tools
These tools are all installed by running the `setup.sh` script from the Build repository.
### PHPUnit
This application uses PHPUnit as unit testing framework. Unit tests for specific classes need to be named in the same manner as the testing class.
@ -139,11 +145,18 @@ php vendor/bin/phpunit -c tests/PHPUnit/phpunit_no_coverage.xml
In order to also create a code coverage report run:
```sh
php -dxdebug.remote_enable=1 -dxdebug.mode=coverage,develop vendor/bin/phpunit -c tests/phpunit_default.xml --log-junit Build/test/junit_php.xml --coverage-html Build/coverage
php -dxdebug.mode=coverage,develop,debug vendor/bin/phpunit -c tests/phpunit_default.xml --log-junit Build/test/junit_php.xml --coverage-html Build/coverage
```
A visualization of the coverage can be found at http://127.0.0.1/Build/coverage
If you would like to run a individual test suit run:
```sh
php -dxdebug.remote_enable=1 -dxdebug.start_with_request=yes -dxdebug.mode=coverage,develop,debug vendor/bin/phpunit tests/MyTest.php
```
#### Modules
Every module needs to have a `Admin` directory containing a class called `AdminTest.php` which is used for testing the installation, activation, deactivation, uninstall and remove of the module. Tests that install, update, remove etc. a module need to have a group called `admin`. After running the `AdminTest.php` test the final state of the module should be installed and active, only this way it's possible to further test the controller and models. A code coverage of at least 90% is mandatory for every module for integration.
@ -176,6 +189,22 @@ php vendor/bin/phpcs --severity=1 ./ --standard="Build/Config/phpcs.xml" -s --re
> Many IDEs allow to integrate phpcs rules/configuration files for automatic checks in the editor
### PHP CS Fixer
The php code base has a defined code style standard. The following command automatically fixes some of the violations
```sh
php vendor/bin/php-cs-fixer fix ./ --config=Build/Config/.php-cs-fixer.php --allow-risky=yes
```
### PHP CBF
The php code base has a defined code style standard. The following command automatically fixes some of the violations
```sh
php vendor/bin/phpcbf --standard=Build/Config/phpcs.xml ./
```
### Rector
```sh
@ -200,6 +229,31 @@ npx eslint ./ -c Build/Config/.eslintrc.json
> Many IDEs allow to integrate eslint rules/configuration files for automatic checks in the editor
### Sitespeed
You can perform sitespeed checks by using sitespeed.io. Example:
```sh
sitespeed.io ./Build/Helper/Scripts/sitespeedDemoUrls.txt -b chrome --outputFolder /var/www/html/sitespeed
```
### Profiles & trace views
1. Automatic trace and benchmark generation with every web request in `/var/www/html/webgrind/Logs`
2. Webgrind view `http://vm_ip:82`
3. Trace visualization `http://vm_ip:81`
1. Download the latest trace from `http://vm_ip:82/Logs`
2. Drag and drop that downloaded `*.xt` file in the trace visualizer
### SQL performance
With query profiling enabled you can inspect slow running queries that may need optimization. The threashold for slow running queries is defined at 0.5s.
```sh
mysqldumpslow -t 10 /var/log/mysql/mysql-slow.log
mysqldumpslow -t 10 -s l /var/log/mysql/mysql-slow.log
```
### Custom scripts
#### C++ tests
@ -253,4 +307,4 @@ The following checks should also be performed. If you use the git hooks from the
## References
[Development process](https://github.com/Karaka-Management/Organization-Guide/blob/master/Processes/Development.md)
[Development process](https://github.com/Karaka-Management/Organization-Guide/blob/master/Processes/01_Development.md)

View File

@ -72,8 +72,8 @@ Javascript can now be included like this:
$head = $response->data['Content']->head;
$nonce = $this->app->appSettings->getOption('script-nonce');
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js', ['nonce' => $nonce]);
$head->addAsset(AssetType::JSLATE, 'Modules/ItemManagement/Controller.js', ['nonce' => $nonce, 'type' => 'module']);
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js?v=' . $this->app->version, ['nonce' => $nonce]);
$head->addAsset(AssetType::JSLATE, 'Modules/ItemManagement/Controller.js?v=' . self::VERSION, ['nonce' => $nonce, 'type' => 'module']);
```
### X-XSS-Protection

View File

@ -1,15 +1,53 @@
# C++
# C/C++
The c++ code should focus on using simplicity over "modern solutions". This may often mean to restrict the code on earlier c++ versions and sometimes even c code.
The C/C++ code should focus on using simplicity over "modern solutions". This may often mean to heavily restrict the code. The following rule of thumb applies:
1. C24 should be used where reasonable (large parts of the cOMS framework)
2. C++ may be used in places where external libraries basically require C++
The reason for the strong focus on C is that we **personally** believe that C is simpler and easier to understand than the various abstractions provided by C++.
## Operating system support
C++ solutions must be valid on Windows 10 and Linux.
C/C++ solutions must be valid on Windows 10+ and Linux.
## Use of namespace
## Namespace
### use
Namespaces must never be globally used. This means for example `use namespace std;` is prohibited and functions from the standard namespace should be prefixed instead `std::`
### Code structuring
It is encouraged to use C++ namespaces to structure code. In C programmers often use prefixes to more or less re-create namespaces. We consider this a hack and advocate for C++ namespaces.
```cpp
namespace Your::Name::Space {
}
```
## Templates
Don't use c++ templates.
Don't use C++ templates.
## Allocation
Use C allocation methods for heap allocation.
## Functions
### C++ function
Don't use C++ standard functions or C++ functions provided by other C++ header files unless you have to work with C++ types which is often required when working with third party libraries.
### Parameters
Generally, functions that thake pointers to non-scalar types should modify the data instead of allocating new memory **IF** reasonable. This forces programmers to consciously create copies before passing data **IF** they need the original data. To indicate that a reference/pointer is not modified by a function define them as const!
We believe this approach provides a framework for better memory management and better performance in general.
Examples for this can be:
* Matrix multiplication with a scalar
* Sorting data (depends on sorting algorithm)

View File

@ -180,17 +180,27 @@ Todos should be documented in the [todo list](https://github.com/orgs/Karaka-Man
In code todos can be created like this
```php
// @todo: Single line todo
// @todo Single line todo
// @bug Single line bug
// @security Single line security
```
```php
/**
* @todo: Multi line todo
* This way developers can see todos directly in the code without going to an external source.
* Todos must not have empty lines in their descriptions.
* If the external ressources have empty lines they must be removed in the todo comment.
* 1. list item 1
* 2. list item 2
* @todo Multi line todo
* This way developers can see todos directly in the code without going to an external source.
* Todos must not have empty lines in their descriptions.
* If the external resources have empty lines they must be removed in the todo comment.
* 1. list item 1
* 2. list item 2
*/
```
We support and recognize the following todo tags:
* @security For todos which have a strong security impact
* @bug For bugs
* @feature For features that should be implemented
* @performance For ideas/concerns regarding performance
* @todo General todos
* @question Ideas and concerns that need further investigation