chore: Add php code sniffer github check (#1066)
This commit is contained in:
parent
d910f8e4f7
commit
5eb1f55b82
13 changed files with 36 additions and 16 deletions
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
@ -45,6 +45,9 @@ jobs:
|
||||||
env:
|
env:
|
||||||
APP_ENV: testing
|
APP_ENV: testing
|
||||||
|
|
||||||
|
- name: Php code sniffer
|
||||||
|
run: ./vendor/bin/phpcs
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@master
|
uses: actions/upload-artifact@master
|
||||||
if: failure()
|
if: failure()
|
||||||
|
|
|
@ -13,7 +13,8 @@ function format_bytes($bytes, bool $is_drive_size = true, string $beforeunit = '
|
||||||
{
|
{
|
||||||
$btype = ($is_drive_size === true) ? 1000 : 1024;
|
$btype = ($is_drive_size === true) ? 1000 : 1024;
|
||||||
$labels = ['B', 'KB', 'MB', 'GB', 'TB'];
|
$labels = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||||
for ($x = 0; $bytes >= $btype && $x < (count($labels) - 1); $bytes /= $btype, $x++); // use 1000 rather than 1024 to simulate HD size not real size
|
// use 1000 rather than 1024 to simulate HD size not real size
|
||||||
|
for ($x = 0; $bytes >= $btype && $x < (count($labels) - 1); $bytes /= $btype, $x++);
|
||||||
if ($labels[$x] == 'TB') {
|
if ($labels[$x] == 'TB') {
|
||||||
return round($bytes, 3).$beforeunit.$labels[$x].$afterunit;
|
return round($bytes, 3).$beforeunit.$labels[$x].$afterunit;
|
||||||
} elseif ($labels[$x] == 'GB') {
|
} elseif ($labels[$x] == 'GB') {
|
||||||
|
|
|
@ -41,11 +41,10 @@ class ItemRestController extends Controller
|
||||||
/**
|
/**
|
||||||
* Show the form for creating a new resource.
|
* Show the form for creating a new resource.
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,5 +18,4 @@ class VerifyCsrfToken extends Middleware
|
||||||
'test_config',
|
'test_config',
|
||||||
//'get_stats'
|
//'get_stats'
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use Symfony\Component\ClassLoader\ClassMapGenerator;
|
use Symfony\Component\ClassLoader\ClassMapGenerator;
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
/**
|
/**
|
||||||
* App\Item
|
* App\Item
|
||||||
*
|
*
|
||||||
|
@ -68,6 +69,7 @@ use Symfony\Component\ClassLoader\ClassMapGenerator;
|
||||||
* @method static \Illuminate\Database\Query\Builder|Item withoutTrashed()
|
* @method static \Illuminate\Database\Query\Builder|Item withoutTrashed()
|
||||||
* @mixin \Eloquent
|
* @mixin \Eloquent
|
||||||
*/
|
*/
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
class Item extends Model
|
class Item extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
|
@ -218,6 +218,7 @@ class Setting extends Model
|
||||||
return self::_fetch($key, $user);
|
return self::_fetch($key, $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
/**
|
/**
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
|
@ -225,6 +226,7 @@ class Setting extends Model
|
||||||
*/
|
*/
|
||||||
public static function _fetch($key, $user = null)
|
public static function _fetch($key, $user = null)
|
||||||
{
|
{
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
//$cachekey = ($user === null) ? $key : $key.'-'.$user->id;
|
//$cachekey = ($user === null) ? $key : $key.'-'.$user->id;
|
||||||
//if (Setting::cached($cachekey)) {
|
//if (Setting::cached($cachekey)) {
|
||||||
// return Setting::$cache[$cachekey];
|
// return Setting::$cache[$cachekey];
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
/**
|
/**
|
||||||
* App\User
|
* App\User
|
||||||
*
|
*
|
||||||
|
@ -42,6 +43,7 @@ use Illuminate\Notifications\Notifiable;
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereUsername($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|User whereUsername($value)
|
||||||
* @mixin \Eloquent
|
* @mixin \Eloquent
|
||||||
*/
|
*/
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use Notifiable;
|
use Notifiable;
|
||||||
|
|
|
@ -27,7 +27,11 @@ class SettingsSeeder extends Seeder
|
||||||
|
|
||||||
foreach ($languageDirectories as $languageDirectory) {
|
foreach ($languageDirectories as $languageDirectory) {
|
||||||
$language = self::getLanguageFromDirectory($languageDirectory);
|
$language = self::getLanguageFromDirectory($languageDirectory);
|
||||||
$resultNative = mb_convert_case(Locale::getDisplayLanguage($language.'-', $language), MB_CASE_TITLE, 'UTF-8');
|
$resultNative = mb_convert_case(
|
||||||
|
Locale::getDisplayLanguage($language.'-', $language),
|
||||||
|
MB_CASE_TITLE,
|
||||||
|
'UTF-8'
|
||||||
|
);
|
||||||
$resultEn = ucfirst(Locale::getDisplayLanguage($language, 'en'));
|
$resultEn = ucfirst(Locale::getDisplayLanguage($language, 'en'));
|
||||||
$result[$language] = "$resultNative ($resultEn)";
|
$result[$language] = "$resultNative ($resultEn)";
|
||||||
}
|
}
|
||||||
|
@ -201,7 +205,12 @@ class SettingsSeeder extends Seeder
|
||||||
|
|
||||||
if ($support = Setting::find(8)) {
|
if ($support = Setting::find(8)) {
|
||||||
$support->label = 'app.settings.support';
|
$support->label = 'app.settings.support';
|
||||||
$support->value = '<a rel="noopener" target="_blank" href="https://discord.gg/CCjHKn4">Discord</a> | <a rel="noopener" target="_blank" href="https://github.com/linuxserver/Heimdall">Github</a> | <a rel="noopener" target="_blank" href="https://blog.heimdall.site/">Blog</a>';
|
$support->value =
|
||||||
|
'<a rel="noopener" target="_blank" href="https://discord.gg/CCjHKn4">Discord</a>'.
|
||||||
|
' | '.
|
||||||
|
'<a rel="noopener" target="_blank" href="https://github.com/linuxserver/Heimdall">Github</a>'.
|
||||||
|
' | '.
|
||||||
|
'<a rel="noopener" target="_blank" href="https://blog.heimdall.site/">Blog</a>';
|
||||||
$support->save();
|
$support->save();
|
||||||
} else {
|
} else {
|
||||||
$setting = new Setting;
|
$setting = new Setting;
|
||||||
|
@ -210,7 +219,11 @@ class SettingsSeeder extends Seeder
|
||||||
$setting->key = 'support';
|
$setting->key = 'support';
|
||||||
$setting->type = 'text';
|
$setting->type = 'text';
|
||||||
$setting->label = 'app.settings.support';
|
$setting->label = 'app.settings.support';
|
||||||
$setting->value = '<a rel="noopener" target="_blank" href="https://discord.gg/CCjHKn4">Discord</a> | <a rel="noopener" target="_blank" href="https://github.com/linuxserver/Heimdall">Github</a> | <a rel="noopener" target="_blank" href="https://blog.heimdall.site/">Blog</a>';
|
$setting->value = '<a rel="noopener" target="_blank" href="https://discord.gg/CCjHKn4">Discord</a>'.
|
||||||
|
' | '.
|
||||||
|
'<a rel="noopener" target="_blank" href="https://github.com/linuxserver/Heimdall">Github</a>'.
|
||||||
|
' | '.
|
||||||
|
'<a rel="noopener" target="_blank" href="https://blog.heimdall.site/">Blog</a>';
|
||||||
$setting->system = true;
|
$setting->system = true;
|
||||||
$setting->save();
|
$setting->save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class UsersSeeder extends Seeder
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
// Groups
|
// Groups
|
||||||
if (! $user = User::find(1)) {
|
if (!User::find(1)) {
|
||||||
$user = new User;
|
$user = new User;
|
||||||
$user->username = 'admin';
|
$user->username = 'admin';
|
||||||
$user->email = 'admin@test.com';
|
$user->email = 'admin@test.com';
|
||||||
|
@ -29,8 +29,6 @@ class UsersSeeder extends Seeder
|
||||||
|
|
||||||
DB::update('update users set id = 1 where id = ?', [$user_id]);
|
DB::update('update users set id = 1 where id = ?', [$user_id]);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//$user->save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
<file>database</file>
|
<file>database</file>
|
||||||
<file>resources</file>
|
<file>resources</file>
|
||||||
<file>routes</file>
|
<file>routes</file>
|
||||||
<file>tests</file>
|
|
||||||
|
|
||||||
<exclude-pattern>bootstrap/cache/*</exclude-pattern>
|
<exclude-pattern>bootstrap/cache/*</exclude-pattern>
|
||||||
|
<exclude-pattern>app/SupportedApps/*</exclude-pattern>
|
||||||
|
<exclude-pattern>resources/lang/*</exclude-pattern>
|
||||||
<exclude-pattern>bootstrap/autoload.php</exclude-pattern>
|
<exclude-pattern>bootstrap/autoload.php</exclude-pattern>
|
||||||
<exclude-pattern>*/migrations/*</exclude-pattern>
|
<exclude-pattern>*/migrations/*</exclude-pattern>
|
||||||
<exclude-pattern>*/seeds/*</exclude-pattern>
|
<exclude-pattern>*/seeds/*</exclude-pattern>
|
||||||
|
|
Loading…
Reference in a new issue