EscolaLMS/model-fields

View on GitHub
Merge pull request #36 from EscolaLMS/feature/WELLMS-334 #140
Witold Wiśniewski authored 43f1396a
complete00:00:30
Your first build completed successfully!

Congratulations

Your first build completed successfully!

See the Results

1
git clone
2
codeclimate validate-config
View output
codeclimate validate-config
No errors or warnings found in .codeclimate.json.
3
codeclimate prepare
View output
codeclimate prepare
4
builder pull-engines
View output
determining required images
docker pull codeclimate/codeclimate-phan:b885
b885: Pulling from codeclimate/codeclimate-phan
8e402f1a9c57: Pulling fs layer
abc2d0fc5668: Pulling fs layer
dc541c3b1e49: Pulling fs layer
9f6ca43a9b11: Pulling fs layer
c7737daaa88e: Pulling fs layer
dacca831c5b2: Pulling fs layer
16fbe636fb42: Pulling fs layer
723d37ca9d09: Pulling fs layer
9eddffd41f08: Pulling fs layer
fb7a0bf324fd: Pulling fs layer
d45ca5424117: Pulling fs layer
dacca831c5b2: Waiting
16fbe636fb42: Waiting
723d37ca9d09: Waiting
9eddffd41f08: Waiting
fb7a0bf324fd: Waiting
d45ca5424117: Waiting
9f6ca43a9b11: Waiting
c7737daaa88e: Waiting
abc2d0fc5668: Verifying Checksum
abc2d0fc5668: Download complete
dc541c3b1e49: Verifying Checksum
dc541c3b1e49: Download complete
8e402f1a9c57: Verifying Checksum
8e402f1a9c57: Download complete
c7737daaa88e: Verifying Checksum
c7737daaa88e: Download complete
dacca831c5b2: Download complete
8e402f1a9c57: Pull complete
abc2d0fc5668: Pull complete
9f6ca43a9b11: Verifying Checksum
9f6ca43a9b11: Download complete
16fbe636fb42: Verifying Checksum
16fbe636fb42: Download complete
723d37ca9d09: Download complete
dc541c3b1e49: Pull complete
fb7a0bf324fd: Verifying Checksum
fb7a0bf324fd: Download complete
9eddffd41f08: Verifying Checksum
9eddffd41f08: Download complete
d45ca5424117: Verifying Checksum
d45ca5424117: Download complete
9f6ca43a9b11: Pull complete
c7737daaa88e: Pull complete
dacca831c5b2: Pull complete
16fbe636fb42: Pull complete
723d37ca9d09: Pull complete
9eddffd41f08: Pull complete
fb7a0bf324fd: Pull complete
d45ca5424117: Pull complete
Digest: sha256:80f9f90a9dc7ed88b958d04b86493d2a7bff8f1bdf1ba775c0c9ba6e254f6181
Status: Downloaded newer image for registry.prod.codeclimate.net/codeclimate/codeclimate-phan:b885
docker pull codeclimate/codeclimate-phpcodesniffer:b163
b163: Pulling from codeclimate/codeclimate-phpcodesniffer
a0710691c81a: Pulling fs layer
a3ed95caeb02: Pulling fs layer
f3c17b6c6935: Pulling fs layer
c3166a36a8d9: Pulling fs layer
83a051f0858f: Pulling fs layer
c3166a36a8d9: Waiting
f0e9f15ec462: Pulling fs layer
034c114563b8: Pulling fs layer
5edc25e33d4e: Pulling fs layer
f0e9f15ec462: Waiting
034c114563b8: Waiting
5edc25e33d4e: Waiting
a3ed95caeb02: Verifying Checksum
a3ed95caeb02: Download complete
f3c17b6c6935: Download complete
a0710691c81a: Download complete
83a051f0858f: Download complete
a0710691c81a: Pull complete
a3ed95caeb02: Pull complete
034c114563b8: Verifying Checksum
034c114563b8: Download complete
c3166a36a8d9: Download complete
f3c17b6c6935: Pull complete
5edc25e33d4e: Download complete
f0e9f15ec462: Verifying Checksum
f0e9f15ec462: Download complete
c3166a36a8d9: Pull complete
83a051f0858f: Pull complete
f0e9f15ec462: Pull complete
034c114563b8: Pull complete
5edc25e33d4e: Pull complete
Digest: sha256:cab8fcc753b6ae0e309b899665b22b1b62c26c56dab9b3c6a938fa72ca7c0640
Status: Downloaded newer image for registry.prod.codeclimate.net/codeclimate/codeclimate-phpcodesniffer:b163
docker pull codeclimate/codeclimate-phpmd:b291
b291: Pulling from codeclimate/codeclimate-phpmd
41dcc117e123: Pulling fs layer
e7cb8c1bd7da: Pulling fs layer
382dd9e936d2: Pulling fs layer
01d3fd4ccf07: Pulling fs layer
d54cbc0233c4: Pulling fs layer
a01b3d804127: Pulling fs layer
02aaff91dfc2: Pulling fs layer
25d9a4b72163: Pulling fs layer
378b764b6ee5: Pulling fs layer
d8ae1ee899c7: Pulling fs layer
f11257bedacf: Pulling fs layer
40adf26d4529: Pulling fs layer
25d9a4b72163: Waiting
01d3fd4ccf07: Waiting
d54cbc0233c4: Waiting
378b764b6ee5: Waiting
a01b3d804127: Waiting
02aaff91dfc2: Waiting
d8ae1ee899c7: Waiting
f11257bedacf: Waiting
40adf26d4529: Waiting
382dd9e936d2: Download complete
e7cb8c1bd7da: Verifying Checksum
e7cb8c1bd7da: Download complete
41dcc117e123: Verifying Checksum
01d3fd4ccf07: Verifying Checksum
01d3fd4ccf07: Download complete
41dcc117e123: Pull complete
a01b3d804127: Verifying Checksum
a01b3d804127: Download complete
d54cbc0233c4: Verifying Checksum
d54cbc0233c4: Download complete
e7cb8c1bd7da: Pull complete
382dd9e936d2: Pull complete
02aaff91dfc2: Verifying Checksum
02aaff91dfc2: Download complete
25d9a4b72163: Verifying Checksum
25d9a4b72163: Download complete
378b764b6ee5: Download complete
d8ae1ee899c7: Verifying Checksum
d8ae1ee899c7: Download complete
01d3fd4ccf07: Pull complete
f11257bedacf: Verifying Checksum
f11257bedacf: Download complete
d54cbc0233c4: Pull complete
40adf26d4529: Verifying Checksum
40adf26d4529: Download complete
a01b3d804127: Pull complete
02aaff91dfc2: Pull complete
25d9a4b72163: Pull complete
378b764b6ee5: Pull complete
d8ae1ee899c7: Pull complete
f11257bedacf: Pull complete
40adf26d4529: Pull complete
Digest: sha256:100ad83154de1d7143edb4360753a5a3c2c35f8a0fd8f00352718003e2b63bfa
Status: Downloaded newer image for registry.prod.codeclimate.net/codeclimate/codeclimate-phpmd:b291
docker pull codeclimate/codeclimate-sonar-php:b23
b23: Pulling from codeclimate/codeclimate-sonar-php
97518928ae5f: Pulling fs layer
043df9f67e9a: Pulling fs layer
a42e650909d2: Pulling fs layer
0dff3d7a1a0e: Pulling fs layer
e109c25d106c: Pulling fs layer
b2fb00c172a9: Pulling fs layer
1519b1438731: Pulling fs layer
cfbd8af1af7a: Pulling fs layer
ea3b98fb78f4: Pulling fs layer
1c654bf89a09: Pulling fs layer
b2fb00c172a9: Waiting
1519b1438731: Waiting
cfbd8af1af7a: Waiting
ea3b98fb78f4: Waiting
1c654bf89a09: Waiting
0dff3d7a1a0e: Waiting
e109c25d106c: Waiting
a42e650909d2: Verifying Checksum
a42e650909d2: Download complete
97518928ae5f: Verifying Checksum
97518928ae5f: Download complete
e109c25d106c: Verifying Checksum
e109c25d106c: Download complete
97518928ae5f: Pull complete
b2fb00c172a9: Download complete
043df9f67e9a: Verifying Checksum
043df9f67e9a: Download complete
0dff3d7a1a0e: Verifying Checksum
0dff3d7a1a0e: Download complete
cfbd8af1af7a: Verifying Checksum
cfbd8af1af7a: Download complete
043df9f67e9a: Pull complete
a42e650909d2: Pull complete
ea3b98fb78f4: Verifying Checksum
ea3b98fb78f4: Download complete
1c654bf89a09: Verifying Checksum
1c654bf89a09: Download complete
1519b1438731: Verifying Checksum
1519b1438731: Download complete
0dff3d7a1a0e: Pull complete
e109c25d106c: Pull complete
b2fb00c172a9: Pull complete
1519b1438731: Pull complete
cfbd8af1af7a: Pull complete
ea3b98fb78f4: Pull complete
1c654bf89a09: Pull complete
Digest: sha256:600639355d67f629857951762cd4d8d2bc9eb16a0496c67a3d6049830edcc87b
Status: Downloaded newer image for registry.prod.codeclimate.net/codeclimate/codeclimate-sonar-php:b23
5
structure
View output
12
Parser process id: 12
codeclimate-parser socket not present
waiting 1s...
6
duplication
View output
12
Parser process id: 12
codeclimate-parser socket not present
waiting 1s...
7
phan
phan engine documentation
8
phpcodesniffer
phpcodesniffer engine documentation
9
phpmd
phpmd engine documentation
10
sonar-php
sonar-php engine documentation
View output
INFO: Java 1.8.0_322 Amazon.com Inc. (64-bit)
INFO: Linux 4.4.0-1128-aws amd64
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-core-2.17.0.899.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-cli-2.1.0.566.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
INFO: Index files
INFO: Invalid character encountered in file '/code/docs/edit.png' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: Invalid character encountered in file '/code/docs/list.png' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: 51 files indexed
INFO: 28 source files to be analyzed
ERROR: Unable to parse file: /code/src/Services/Contracts/ModelFieldsServiceContract.php
ERROR: Parse error at line 20 column 131:

10: 
11: interface ModelFieldsServiceContract
12: {
13: 
14:     public function addOrUpdateMetadataField(string $class_type, string $name, string $type, string $default = '', array $rules = null, int $visibility = 1 << 0, array $extra = null): Metadata;
15: 
16:     public function removeMetaField(string $class_type, string $name): bool;
17: 
18:     public function getFieldsMetadata(string $class_type): Collection;
19: 
20:     public function getFieldsMetadataListPaginated(string $class_type, ?int $perPage = 15, ?OrderDto $orderDto = null): Collection|LengthAwarePaginator;
                                                                                                                                      ^
21: 
22:     public function castField(mixed $value, ?Metadata $field): mixed;
23: 
24:     /**
25:      * @return array<string, string>
26:      */
27:     public function getExtraAttributesValues(Model $model, ?int $visibility = null): array;
28: 
29:     public function getFieldsMetadataRules(string $class_type): array;
30: }

ERROR: Unable to parse file: /code/src/Services/ModelFieldsService.php
ERROR: Parse error at line 79 column 131:

69:                     // If table not exist set in cache value to false
70:                     Cache::put('model_fields_metadata_table_exists', false);
71:                 }
72:                 return collect([]);
73:             });
74:         }
75: 
76:         return collect([]);
77:     }
78: 
79:     public function getFieldsMetadataListPaginated(string $class_type, ?int $perPage = 15, ?OrderDto $orderDto = null): Collection|LengthAwarePaginator
                                                                                                                                      ^
80:     {
81:         if (!config('model-fields.enabled')) {
82:             return collect([]);
83:         }
84: 
85:         $classTypes = class_parents($class_type) ? array_merge([$class_type], class_parents($class_type)) : [$class_type];
86:         $query = Metadata::query()
87:             ->whereIn('class_type', $classTypes)
88:             ->orderBy($orderDto?->getOrderBy() ?? 'id', $orderDto?->getOrder() ?? 'asc');
89: 

ERROR: Unable to parse file: /code/src/Http/Controllers/ModelFieldsAdminApiController.php
ERROR: Parse error at line 17 column 13:

 7: use EscolaLms\ModelFields\Http\Controllers\Contracts\ModelFieldsAdminApiContract;
 8: use EscolaLms\ModelFields\Http\Requests\MetadataCreateOrUpdateRequest;
 9: use EscolaLms\ModelFields\Http\Requests\MetadataDeleteRequest;
10: use EscolaLms\ModelFields\Http\Requests\MetadataListRequest;
11: use EscolaLms\ModelFields\Http\Resources\MetadataResource;
12: use EscolaLms\ModelFields\Services\Contracts\ModelFieldsServiceContract;
13: use Illuminate\Http\JsonResponse;
14: 
15: class ModelFieldsAdminApiController extends EscolaLmsBaseController implements ModelFieldsAdminApiContract
16: {
17:     private ModelFieldsServiceContract $service;
                ^
18: 
19:     public function __construct(ModelFieldsServiceContract $service)
20:     {
21:         $this->service = $service;
22:     }
23: 
24:     public function list(MetadataListRequest $request): JsonResponse
25:     {
26:         /** @var string $classType */
27:         $classType = $request->get('class_type');

ERROR: Unable to parse file: /code/src/Http/Controllers/ModelFieldsApiController.php
ERROR: Parse error at line 17 column 13:

 7: use Illuminate\Http\JsonResponse;
 8: use EscolaLms\ModelFields\Services\Contracts\ModelFieldsServiceContract;
 9: use EscolaLms\ModelFields\Http\Controllers\Contracts\ModelFieldsApiContract;
10: use EscolaLms\ModelFields\Http\Resources\MetadataResource;
11: use EscolaLms\ModelFields\Http\Requests\MetadataCreateOrUpdateRequest;
12: use EscolaLms\ModelFields\Http\Requests\MetadataDeleteRequest;
13: use EscolaLms\ModelFields\Http\Requests\MetadataListRequest;
14: 
15: class ModelFieldsApiController extends EscolaLmsBaseController implements ModelFieldsApiContract
16: {
17:     private ModelFieldsServiceContract $service;
                ^
18: 
19:     public function __construct(ModelFieldsServiceContract $service)
20:     {
21:         $this->service = $service;
22:     }
23: 
24:     public function list(MetadataListRequest $request): JsonResponse
25:     {
26:         /** @var string|false $classType */
27:         $classType = $request->get('class_type');

ERROR: Unable to parse file: /code/src/ModelFieldsServiceProvider.php
ERROR: Parse error at line 18 column 12:

 8: 
 9: /**
10:  * SWAGGER_VERSION
11:  */
12: 
13: class ModelFieldsServiceProvider extends ServiceProvider
14: {
15:     /**
16:      * @var string[]
17:      */
18:     public array $singletons = [
               ^
19:         ModelFieldsServiceContract::class => ModelFieldsService::class,
20:     ];
21: 
22:     /**
23:      * Bootstrap any application services.
24:      *
25:      * @return void
26:      */
27:     public function boot(): void
28:     {

ERROR: Unable to parse file: /code/src/Models/Model.php
ERROR: Parse error at line 15 column 13:

 5: use Illuminate\Database\Eloquent\Model as BaseModel;
 6: use Illuminate\Database\Eloquent\Relations\MorphMany;
 7: use Illuminate\Support\Collection;
 8: use EscolaLms\ModelFields\Services\Contracts\ModelFieldsServiceContract;
 9: use Illuminate\Support\Facades\App;
10: use EscolaLms\ModelFields\Enum\MetaFieldTypeEnum;
11: use Illuminate\Support\Facades\Cache;
12: 
13: abstract class Model extends BaseModel
14: {
15:     private ModelFieldsServiceContract $service;
                ^
16:     private Collection $extraFields;
17: 
18:     public function __construct(array $attributes = [])
19:     {
20:         $this->service = App::make(ModelFieldsServiceContract::class);
21:         parent::__construct($attributes);
22:     }
23: 
24:     private function getExtraAttributesValues(): array
25:     {

ERROR: Unable to parse file: /code/src/Traits/ModelFields.php
ERROR: Parse error at line 13 column 13:

 3: namespace EscolaLms\ModelFields\Traits;
 4: 
 5: use EscolaLms\ModelFields\Models\Field;
 6: use Illuminate\Support\Collection;
 7: use EscolaLms\ModelFields\Enum\MetaFieldTypeEnum;
 8: use EscolaLms\ModelFields\Facades\ModelFields as ModelFieldsFacade;
 9: use Illuminate\Support\Facades\Cache;
10: 
11: trait ModelFields
12: {
13:     private Collection $extraFields;
                ^
14: 
15:     private function getExtraAttributesValues(): array
16:     {
17:         return ModelFieldsFacade::getExtraAttributesValues($this);
18:     }
19: 
20:     public function attributesToArray()
21:     {
22:         $attributes =  parent::attributesToArray();
23:         $extraAttributes = $this->getExtraAttributesValues();

INFO: 28/28 source files have been analyzed
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.453s
INFO: Final Memory: 11M/95M
INFO: ------------------------------------------------------------------------