Symfony controller action method should not be too long

  • Major
  • Readability

More information: https://insight.sensiolabs.com/what-we-analyse/symfony.controller.action_method_too_long

23% of all actions have more than 20 lines. This violation is raised when more than 10% actions are too long.

Time to fix: about 2.95 hours
Open Issue Permalink
Collective

Files should not be executable

  • Major
  • Security

More information: https://insight.sensiolabs.com/what-we-analyse/php.too_permissive_file_permissions

Your project contains files with permissive permissions. In order to avoid opening a security breach, you should restrict execution rights on following files:

  • .gitignore
  • CompilerPass/WidgetCompilerPass.php
  • Controller/AbstractController.php
  • Controller/AbstractPageController.php
  • Controller/AjaxController.php
  • Controller/CrudController.php
  • Controller/DefaultController.php
  • Controller/MenuController.php
  • Controller/PageController.php
  • Controller/WidgetController.php
  • DependencyInjection/Configuration.php
  • DependencyInjection/TellawSunshineAdminExtension.php
  • Entity/Context.php
  • Entity/Filter.php
  • Entity/MessageBag.php
  • Event/EntityEvent.php
  • Event/SunshineEvents.php
  • Form/Type/AttachmentType.php
  • Form/Type/ChoiceButtonType.php
  • Form/Type/DefaultType.php
  • Form/Type/FiltersType.php
  • Form/Type/Select2Type.php
  • Interfaces/CrudServiceInterface.php
  • README.md
  • Repository/CrudRepository.php
  • Resources/Documentation/backoffice-custom-controller.md
  • Resources/Documentation/backoffice-page.md
  • Resources/Documentation/controller-load-ajax-widget.md
  • Resources/Documentation/entity-configuration.md
  • Resources/Documentation/filed-types-overrides.md
  • Resources/Documentation/filtering-default-value.md
  • Resources/Documentation/filtering-option-multiple.md
  • Resources/Documentation/list-order.md
  • Resources/Documentation/menu.md
  • Resources/Documentation/relations.md
  • Resources/Documentation/roles-configuration.md
  • Resources/Documentation/setup.md
  • Resources/Documentation/theme.md
  • Resources/Documentation/widgets/crud-list.md
  • Resources/config/entities/sample.config.yml
  • Resources/config/routing.yml
  • Resources/config/services.yml
  • Resources/translations/messages.fr.yml
  • Resources/views/Default/_index.html.twig
  • Resources/views/Default/base.html.twig
  • Resources/views/Default/index.html.twig
  • Resources/views/Form/fields.html.twig
  • Resources/views/Form/filterFields.html.twig
  • Resources/views/Menu/index.html.twig
  • Resources/views/Menu/menu_item.html.twig
  • Resources/views/Page/edit.html.twig
  • Resources/views/Page/index.html.twig
  • Resources/views/Page/list.html.twig
  • Resources/views/Widget/ajax-datatable.html.twig
  • Resources/views/Widget/edit.html.twig
  • Resources/views/Widget/fields/field_array.html.twig
  • Resources/views/Widget/fields/field_bigint.html.twig
  • Resources/views/Widget/fields/field_boolean.html.twig
  • Resources/views/Widget/fields/field_date.html.twig
  • Resources/views/Widget/fields/field_datetime.html.twig
  • Resources/views/Widget/fields/field_datetimetz.html.twig
  • Resources/views/Widget/fields/field_decimal.html.twig
  • Resources/views/Widget/fields/field_email.html.twig
  • Resources/views/Widget/fields/field_float.html.twig
  • Resources/views/Widget/fields/field_guid.html.twig
  • Resources/views/Widget/fields/field_id.html.twig
  • Resources/views/Widget/fields/field_image.html.twig
  • Resources/views/Widget/fields/field_integer.html.twig
  • Resources/views/Widget/fields/field_json_array.html.twig
  • Resources/views/Widget/fields/field_object-multiple.html.twig
  • Resources/views/Widget/fields/field_object.html.twig
  • Resources/views/Widget/fields/field_raw.html.twig
  • Resources/views/Widget/fields/field_simple_array.html.twig
  • Resources/views/Widget/fields/field_smallint.html.twig
  • Resources/views/Widget/fields/field_string.html.twig
  • Resources/views/Widget/fields/field_tel.html.twig
  • Resources/views/Widget/fields/field_text.html.twig
  • Resources/views/Widget/fields/field_time.html.twig
  • Resources/views/Widget/fields/field_toggle.html.twig
  • Resources/views/Widget/fields/field_url.html.twig
  • Resources/views/Widget/list.html.twig
  • Resources/views/Widget/view.html.twig
  • Resources/views/Widgets/base-widget-sunshine.html.twig
  • Resources/views/base-login.html.twig
  • Resources/views/base-security.html.twig
  • Resources/views/base-skeleton.html.twig
  • Resources/views/base-sunshine.html.twig
  • Service/AbstractWidget.php
  • Service/CrudService.php
  • Service/EntityService.php
  • Service/MenuService.php
  • Service/PageService.php
  • Service/WidgetService.php
  • Service/Widgets/EditWidget.php
  • Service/Widgets/ListWidget.php
  • Service/Widgets/ViewWidget.php
  • TellawSunshineAdminBundle.php
  • Twig/CollectionExtension.php
  • Twig/MenuExtension.php
  • Twig/ThemeExtension.php
  • Twig/WidgetExtension.php
  • composer.json
  • composer.lock

Time to fix: about 15 minutes
Open Issue Permalink
Collective
chmod a-x '.gitignore' \
    'CompilerPass/WidgetCompilerPass.php' \
    'Controller/AbstractController.php' \
    'Controller/AbstractPageController.php' \
    'Controller/AjaxController.php' \
    'Controller/CrudController.php' \
    'Controller/DefaultController.php' \
    'Controller/MenuController.php' \
    'Controller/PageController.php' \
    'Controller/WidgetController.php' \
    'DependencyInjection/Configuration.php' \
    'DependencyInjection/TellawSunshineAdminExtension.php' \
    'Entity/Context.php' \
    'Entity/Filter.php' \
    'Entity/MessageBag.php' \
    'Event/EntityEvent.php' \
    'Event/SunshineEvents.php' \
    'Form/Type/AttachmentType.php' \
    'Form/Type/ChoiceButtonType.php' \
    'Form/Type/DefaultType.php' \
    'Form/Type/FiltersType.php' \
    'Form/Type/Select2Type.php' \
    'Interfaces/CrudServiceInterface.php' \
    'README.md' \
    'Repository/CrudRepository.php' \
    'Resources/Documentation/backoffice-custom-controller.md' \
    'Resources/Documentation/backoffice-page.md' \
    'Resources/Documentation/controller-load-ajax-widget.md' \
    'Resources/Documentation/entity-configuration.md' \
    'Resources/Documentation/filed-types-overrides.md' \
    'Resources/Documentation/filtering-default-value.md' \
    'Resources/Documentation/filtering-option-multiple.md' \
    'Resources/Documentation/list-order.md' \
    'Resources/Documentation/menu.md' \
    'Resources/Documentation/relations.md' \
    'Resources/Documentation/roles-configuration.md' \
    'Resources/Documentation/setup.md' \
    'Resources/Documentation/theme.md' \
    'Resources/Documentation/widgets/crud-list.md' \
    'Resources/config/entities/sample.config.yml' \
    'Resources/config/routing.yml' \
    'Resources/config/services.yml' \
    'Resources/translations/messages.fr.yml' \
    'Resources/views/Default/_index.html.twig' \
    'Resources/views/Default/base.html.twig' \
    'Resources/views/Default/index.html.twig' \
    'Resources/views/Form/fields.html.twig' \
    'Resources/views/Form/filterFields.html.twig' \
    'Resources/views/Menu/index.html.twig' \
    'Resources/views/Menu/menu_item.html.twig' \
    'Resources/views/Page/edit.html.twig' \
    'Resources/views/Page/index.html.twig' \
    'Resources/views/Page/list.html.twig' \
    'Resources/views/Widget/ajax-datatable.html.twig' \
    'Resources/views/Widget/edit.html.twig' \
    'Resources/views/Widget/fields/field_array.html.twig' \
    'Resources/views/Widget/fields/field_bigint.html.twig' \
    'Resources/views/Widget/fields/field_boolean.html.twig' \
    'Resources/views/Widget/fields/field_date.html.twig' \
    'Resources/views/Widget/fields/field_datetime.html.twig' \
    'Resources/views/Widget/fields/field_datetimetz.html.twig' \
    'Resources/views/Widget/fields/field_decimal.html.twig' \
    'Resources/views/Widget/fields/field_email.html.twig' \
    'Resources/views/Widget/fields/field_float.html.twig' \
    'Resources/views/Widget/fields/field_guid.html.twig' \
    'Resources/views/Widget/fields/field_id.html.twig' \
    'Resources/views/Widget/fields/field_image.html.twig' \
    'Resources/views/Widget/fields/field_integer.html.twig' \
    'Resources/views/Widget/fields/field_json_array.html.twig' \
    'Resources/views/Widget/fields/field_object-multiple.html.twig' \
    'Resources/views/Widget/fields/field_object.html.twig' \
    'Resources/views/Widget/fields/field_raw.html.twig' \
    'Resources/views/Widget/fields/field_simple_array.html.twig' \
    'Resources/views/Widget/fields/field_smallint.html.twig' \
    'Resources/views/Widget/fields/field_string.html.twig' \
    'Resources/views/Widget/fields/field_tel.html.twig' \
    'Resources/views/Widget/fields/field_text.html.twig' \
    'Resources/views/Widget/fields/field_time.html.twig' \
    'Resources/views/Widget/fields/field_toggle.html.twig' \
    'Resources/views/Widget/fields/field_url.html.twig' \
    'Resources/views/Widget/list.html.twig' \
    'Resources/views/Widget/view.html.twig' \
    'Resources/views/Widgets/base-widget-sunshine.html.twig' \
    'Resources/views/base-login.html.twig' \
    'Resources/views/base-security.html.twig' \
    'Resources/views/base-skeleton.html.twig' \
    'Resources/views/base-sunshine.html.twig' \
    'Service/AbstractWidget.php' \
    'Service/CrudService.php' \
    'Service/EntityService.php' \
    'Service/MenuService.php' \
    'Service/PageService.php' \
    'Service/WidgetService.php' \
    'Service/Widgets/EditWidget.php' \
    'Service/Widgets/ListWidget.php' \
    'Service/Widgets/ViewWidget.php' \
    'TellawSunshineAdminBundle.php' \
    'Twig/CollectionExtension.php' \
    'Twig/MenuExtension.php' \
    'Twig/ThemeExtension.php' \
    'Twig/WidgetExtension.php' \
    'composer.json' \
    'composer.lock'

Template should not have too many variables

  • Minor
  • Architecture

More information: https://insight.sensiolabs.com/what-we-analyse/symfony.controller.too_many_template_variables

50% of all your templates have more than 6 variables, the threshold is 5%.

Collective

Occurences of the rule violations:

Object parameters should be type hinted

  • Minor
  • Bugrisk

More information: https://insight.sensiolabs.com/what-we-analyse/php.object_parameter_not_type_hinted

  1. * @param Form|FormBuilder $form
  2. * @param array $formConfiguration
  3. * @return mixed
  4. * @throws \Exception
  5. */
  6. public function buildFormFields($form, $formConfiguration, $forcedClass = "")

    The parameter form, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Adama dodo CISSE
  7. {
  8. foreach ($formConfiguration as $fieldName => $field) {
  9. $fieldAttributes = array();
  10. if (isset($field['label'])) {

Unused method, property, variable or parameter 2

  • Minor
  • Deadcode

More information: https://insight.sensiolabs.com/what-we-analyse/php.unused_local_variable_or_private_member

  1. */
  2. protected $entityService;
  3. /**
  4. * @var ContainerInterface
  5. */
  6. private $container;

    This container attribute is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Eric
  7. /**
  8. * CrudService constructor.
  9. * @param EntityManagerInterface $em
  10. * @param EntityService $entityService
  1. * @param $listConfiguration
  2. * @param $baseConfiguration
  3. * @param bool $isCount Si requête de type COUNT
  4. * @return mixed
  5. */
  6. protected function addSelectAndJoin(QueryBuilder $qb, $listConfiguration, $baseConfiguration, $isCount = false)

    This baseConfiguration argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by nicolas
  7. {
  8. // GET COLUMNS AS FIELDS
  9. foreach ($listConfiguration as $key => $item) {
  10. if (isset($item["type"]) && $item["type"] != "custom" || !isset($item["type"])) {