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:
|
||||
APP_ENV: testing
|
||||
|
||||
- name: Php code sniffer
|
||||
run: ./vendor/bin/phpcs
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@master
|
||||
if: failure()
|
||||
|
|
|
@ -13,7 +13,8 @@ function format_bytes($bytes, bool $is_drive_size = true, string $beforeunit = '
|
|||
{
|
||||
$btype = ($is_drive_size === true) ? 1000 : 1024;
|
||||
$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') {
|
||||
return round($bytes, 3).$beforeunit.$labels[$x].$afterunit;
|
||||
} elseif ($labels[$x] == 'GB') {
|
||||
|
|
|
@ -41,11 +41,10 @@ class ItemRestController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
* @return void
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,5 +18,4 @@ class VerifyCsrfToken extends Middleware
|
|||
'test_config',
|
||||
//'get_stats'
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
use stdClass;
|
||||
use Symfony\Component\ClassLoader\ClassMapGenerator;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
/**
|
||||
* App\Item
|
||||
*
|
||||
|
@ -68,6 +69,7 @@ use Symfony\Component\ClassLoader\ClassMapGenerator;
|
|||
* @method static \Illuminate\Database\Query\Builder|Item withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
// @codingStandardsIgnoreEnd
|
||||
class Item extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
|
|
@ -218,6 +218,7 @@ class Setting extends Model
|
|||
return self::_fetch($key, $user);
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
|
@ -225,6 +226,7 @@ class Setting extends Model
|
|||
*/
|
||||
public static function _fetch($key, $user = null)
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
//$cachekey = ($user === null) ? $key : $key.'-'.$user->id;
|
||||
//if (Setting::cached($cachekey)) {
|
||||
// return Setting::$cache[$cachekey];
|
||||
|
|
|
@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
/**
|
||||
* App\User
|
||||
*
|
||||
|
@ -42,6 +43,7 @@ use Illuminate\Notifications\Notifiable;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|User whereUsername($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
// @codingStandardsIgnoreEnd
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
|
|
|
@ -27,7 +27,11 @@ class SettingsSeeder extends Seeder
|
|||
|
||||
foreach ($languageDirectories as $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'));
|
||||
$result[$language] = "$resultNative ($resultEn)";
|
||||
}
|
||||
|
@ -201,7 +205,12 @@ class SettingsSeeder extends Seeder
|
|||
|
||||
if ($support = Setting::find(8)) {
|
||||
$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();
|
||||
} else {
|
||||
$setting = new Setting;
|
||||
|
@ -210,7 +219,11 @@ class SettingsSeeder extends Seeder
|
|||
$setting->key = 'support';
|
||||
$setting->type = 'text';
|
||||
$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->save();
|
||||
}
|
||||
|
@ -275,7 +288,7 @@ class SettingsSeeder extends Seeder
|
|||
$home_tag->save();
|
||||
$home_tag_id = $home_tag->id;
|
||||
|
||||
if($home_tag_id != 0) {
|
||||
if ($home_tag_id != 0) {
|
||||
Log::info("Home Tag returned with id $home_tag_id from db! Changing to 0.");
|
||||
|
||||
DB::update('update items set id = 0 where id = ?', [$home_tag_id]);
|
||||
|
|
|
@ -15,7 +15,7 @@ class UsersSeeder extends Seeder
|
|||
public function run()
|
||||
{
|
||||
// Groups
|
||||
if (! $user = User::find(1)) {
|
||||
if (!User::find(1)) {
|
||||
$user = new User;
|
||||
$user->username = 'admin';
|
||||
$user->email = 'admin@test.com';
|
||||
|
@ -24,13 +24,11 @@ class UsersSeeder extends Seeder
|
|||
|
||||
$user_id = $user->id;
|
||||
|
||||
if($user_id != 1) {
|
||||
if ($user_id != 1) {
|
||||
Log::info("First User returned with id $user_id from db! Changing to 1.");
|
||||
|
||||
DB::update('update users set id = 1 where id = ?', [$user_id]);
|
||||
}
|
||||
} else {
|
||||
//$user->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
<file>database</file>
|
||||
<file>resources</file>
|
||||
<file>routes</file>
|
||||
<file>tests</file>
|
||||
|
||||
<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>*/migrations/*</exclude-pattern>
|
||||
<exclude-pattern>*/seeds/*</exclude-pattern>
|
||||
|
|
Loading…
Reference in a new issue