Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rapikan kode dengan bantuan php-cs-fixer #181

Merged
merged 6 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 6 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.github/ export-ignore
.editorconfig export-ignore
.php-cs-fixer.php export-ignore
code_of_conduct.md export-ignore
composer.json export-ignore
docs export-ignore
package.json export-ignore
package-lock.json export-ignore
package.json export-ignore

.github/ export-ignore
docs export-ignore
22 changes: 22 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Style PHP-CS-Fixer

on:
pull_request:

jobs:
php-cs-fixer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Install composer packages
run: composer install

- name: Run PHP-CS-Fixer Lint
run: composer csfix

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply PHP-CS-Fixer changes
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ donjo-sys/vlucas/phpdotenv/*
/node_modules

docs/.vitepress/dist

.php-cs-fixer.cache
22 changes: 22 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
use Nexus\CsConfig\FixerGenerator;
use PhpCsFixer\Finder;

$finder = Finder::create()
->in(__DIR__)
->exclude('donjo-sys')
->exclude('donjo-app/views');

$overrides = [];

$options = [
'finder' => $finder,
'customFixers' => FixerGenerator::create('donjo-sys/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
];

return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"vlucas/phpdotenv": "^5.5"
},
"require-dev": {
"mikey179/vfsstream": "1.6.*",
"codeigniter/coding-standard": "^1.1",
"friendsofphp/php-cs-fixer": "^3",
"mikey179/vfsstream": "1.6.*"
},
"config": {
"lock": false,
Expand All @@ -17,5 +19,8 @@
"preferred-install": "dist",
"sort-packages": true,
"vendor-dir": "donjo-sys"
},
"scripts": {
"csfix": "./donjo-sys/bin/php-cs-fixer fix"
}
}
1 change: 1 addition & 0 deletions docs/changelog/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Rilis: _Belum rilis, versi dev_
atau tidak ditemukan pada v3.10-CRI
- Meningkatakan versi CodeIgniter menjadi v3.1.13, sebelumnya v2.2.6
- Menambahkan berkas env untuk mempermudah pengaturan
- Merapikan kode dengan bantuan *php-cs-fixer* kecuali dibagian view

## :hammer_and_wrench: Perbaikan
- Beberapa error pada halaman siteman telah diperbaiki
Expand Down
17 changes: 9 additions & 8 deletions donjo-app/config/autoload.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

defined('BASEPATH') || exit('No direct script access allowed');

/*
| -------------------------------------------------------------------
Expand Down Expand Up @@ -39,7 +40,7 @@
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
$autoload['packages'] = [];

/*
| -------------------------------------------------------------------
Expand All @@ -58,7 +59,7 @@
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('session','database');
$autoload['libraries'] = ['session', 'database'];

/*
| -------------------------------------------------------------------
Expand All @@ -79,7 +80,7 @@
| $autoload['drivers'] = array('cache' => 'cch');
|
*/
$autoload['drivers'] = array();
$autoload['drivers'] = [];

/*
| -------------------------------------------------------------------
Expand All @@ -89,7 +90,7 @@
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url','donjolib','date','pict');
$autoload['helper'] = ['url', 'donjolib', 'date', 'pict'];

/*
| -------------------------------------------------------------------
Expand All @@ -103,7 +104,7 @@
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array();
$autoload['config'] = [];

/*
| -------------------------------------------------------------------
Expand All @@ -117,7 +118,7 @@
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array();
$autoload['language'] = [];

/*
| -------------------------------------------------------------------
Expand All @@ -132,4 +133,4 @@
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = array();
$autoload['model'] = [];
77 changes: 39 additions & 38 deletions donjo-app/config/config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

defined('BASEPATH') || exit('No direct script access allowed');

/*
|--------------------------------------------------------------------------
Expand All @@ -23,9 +24,9 @@
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://" . $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? 'https' : 'http');
$config['base_url'] .= '://' . $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -54,7 +55,7 @@
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
$config['uri_protocol'] = 'REQUEST_URI';

/*
|--------------------------------------------------------------------------
Expand All @@ -80,7 +81,7 @@
| than english.
|
*/
$config['language'] = 'english';
$config['language'] = 'english';

/*
|--------------------------------------------------------------------------
Expand All @@ -104,7 +105,7 @@
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
$config['enable_hooks'] = false;

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -140,7 +141,7 @@
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = FALSE;
$config['composer_autoload'] = false;

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -186,10 +187,10 @@
| use segment based URLs.
|
*/
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
$config['enable_query_strings'] = false;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';

/*
|--------------------------------------------------------------------------
Expand All @@ -203,7 +204,7 @@
| for backwards compatibility purposes!
|
*/
$config['allow_get_array'] = TRUE;
$config['allow_get_array'] = true;

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -315,7 +316,7 @@
| of query parameters.
|
*/
$config['cache_query_string'] = FALSE;
$config['cache_query_string'] = false;

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -385,14 +386,14 @@
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_samesite'] = 'Lax';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_samesite'] = 'Lax';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = null;
$config['sess_match_ip'] = false;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = false;

/*
|--------------------------------------------------------------------------
Expand All @@ -410,12 +411,12 @@
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
$config['cookie_samesite'] = 'Lax';
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = false;
$config['cookie_httponly'] = false;
$config['cookie_samesite'] = 'Lax';

/*
|--------------------------------------------------------------------------
Expand All @@ -429,7 +430,7 @@
| for backwards compatibility purposes!
|
*/
$config['standardize_newlines'] = FALSE;
$config['standardize_newlines'] = false;

/*
|--------------------------------------------------------------------------
Expand All @@ -443,7 +444,7 @@
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;
$config['global_xss_filtering'] = false;

/*
|--------------------------------------------------------------------------
Expand All @@ -459,12 +460,12 @@
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
$config['csrf_protection'] = false;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = true;
$config['csrf_exclude_uris'] = [];

/*
|--------------------------------------------------------------------------
Expand All @@ -486,7 +487,7 @@
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
$config['compress_output'] = false;

/*
|--------------------------------------------------------------------------
Expand All @@ -513,7 +514,7 @@
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = FALSE;
$config['rewrite_short_tags'] = false;

/*
|--------------------------------------------------------------------------
Expand Down
Loading