- Issue created by @himanshu_jhaloya
- @himanshu_jhaloya opened merge request.
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 10:08am 9 May 2023 - Status changed to Needs work
4 months ago 12:03pm 11 July 2024 - šµšPhilippines cleavinjosh
Hi @himanshu_jhaloya,
I tried to apply MR!1 but encountered an error.
ā cmrf_user_sync git:(1.0.x) ā curl https://git.drupalcode.org/project/cmrf_user_sync/-/merge_requests/1.diff | git apply -v % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 43375 0 43375 0 0 97k 0 --:--:-- --:--:-- --:--:-- 97k Checking patch cmrf_user_sync.info.yml... error: while searching for: core_version_requirement: ^8 || ^9 || ^10 package: 'CiviCRM' dependencies: - cmrf_core error: patch failed: cmrf_user_sync.info.yml:5 error: cmrf_user_sync.info.yml: patch does not apply Checking patch cmrf_user_sync.module... Checking patch cmrf_user_sync.routing.yml... Checking patch src/Annotation/UserMessageProcessor.php... Checking patch src/Form/UserSyncConfigForm.php... Checking patch src/Plugin/QueueWorker/UserSyncQueue.php... error: while searching for: <?php /* * @author Klaas Eikelboom <klaas.eikelboom@civicoop.org> * @date 17-Jan-2022 * @license GPL-2.0-or-later */ namespace Drupal\cmrf_user_sync\Plugin\QueueWorker; use Drupal\Core\Annotation\QueueWorker; use Drupal\Core\Queue\QueueWorkerBase; /** error: patch failed: src/Plugin/QueueWorker/UserSyncQueue.php:1 error: src/Plugin/QueueWorker/UserSyncQueue.php: patch does not apply Checking patch src/Plugin/UserMessageProcessor/BasicUserProvider.php... error: while searching for: /** * Process a message. * * @param $contact_id * @param $message * @param \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig $config * * @return void */ public function process($contact_id, $message, $config) { if ($config->get('enable_logging')) { \Drupal::logger('cmrf_user_sync')->notice('Processing message for Contact [@contact_id]. Message: @message',[ '@contact_id' => $contact_id, '@message' => json_encode($message, JSON_PRETTY_PRINT), ]); } /* @var $query \Drupal\Core\Entity\Query\Sql\Query */ $query = \Drupal::entityQuery('user'); $users = $query->condition('field_user_contact_id',$contact_id)->execute(); $email = $message[$config->get('email')]; $name = $message[$config->get('name')]; $emailExists = $this->checkIfEmailExist($email); if(empty($users) && !$emailExists && $email){ $user = User::create([ 'mail' => $email, 'field_user_contact_id' => $contact_id, 'name' => $name, 'status' => 1 ]); $user->save(); \Drupal::logger('cmrf_user_sync')->notice('Created new user @name identified with @contact_id',[ '@name' => $name, '@contact_id' => $contact_id, ]); } else if(empty($users) && $emailExists) { \Drupal::logger('cmrf_user_sync')->notice('Unable to create user @name identified with @contact_id because another user with email @email already exists',[ '@name' => $name, '@contact_id' => $contact_id, '@email' => $email, ]); } else if(count($users)==1 && $email){ $user = User::load(reset($users)); if($emailExists){ \Drupal::logger('cmrf_user_sync')->notice('Could not update email for user @name identified with @contact_id because other user with email @email already exists',[ '@name' => $name, '@contact_id' => $contact_id, '@email' => $email, ]); } else { $user->mail->value = $email; } $user->field_user_contact_id->value=$contact_id; $user->name->value=$name; $user->status = 1; $user->save(); \Drupal::logger('cmrf_user_sync')->notice('Updates existing user @name identified with @contact_id',[ '@name' => $name, '@contact_id' => $contact_id, ]); } elseif(count($users)==1 && !$email){ $user = User::load(reset($users)); if (!$user->hasRole('administrator')) { $user->status = 0; error: patch failed: src/Plugin/UserMessageProcessor/BasicUserProvider.php:116 error: src/Plugin/UserMessageProcessor/BasicUserProvider.php: patch does not apply Checking patch src/Plugin/UserMessageProcessor/UserSyncLogger.php... Checking patch src/Plugin/UserMessageProcessorBase.php... Hunk #2 succeeded at 13 (offset 1 line). Hunk #3 succeeded at 28 (offset 1 line). error: while searching for: /** * Process a message. * * @param $contact_id * @param $message * @param \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig $config * * @return void */ abstract public function process($contact_id, $message, $config); /** * Returns the form. * * Child classes could override this function to change the configuration form. * * @param array $form * @param \Drupal\Core\Form\FormStateInterface $form_state * @param \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig $config * @param string|null $connection * @param string|null $messageDefinitionName * * @return array */ public function buildForm(array $form, FormStateInterface $form_state, $config, $connection=null, $messageDefinitionName=null) { return $form; } /** * Validates the form and sets errors if there are any. * * Child classes could override this function to change the configuration form. * * @param array $form * @param \Drupal\Core\Form\FormStateInterface $form_state * @param \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig $config * @param string|null $connection * @param string|null $messageDefinitionName * * @return void */ public function validateForm(array $form, FormStateInterface $form_state, $config, $connection=null, $messageDefinitionName=null) { } /** * Process the submitted configuration. * * Child classes could override this function to change the configuration form. * * @param array $form * @param \Drupal\Core\Form\FormStateInterface $form_state * @param \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig $config * @param string|null $connection * @param string|null $messageDefinitionName * * @return void */ public function submitForm(array $form, FormStateInterface $form_state, $config, $connection=null, $messageDefinitionName=null) { } /** * Returns a list of fields available in the message definition. * * @param $connection * @param $messageDefinitionName * * @return array */ protected function getFieldsFromMessageDefinition($connection, $messageDefinitionName) { $call = $this->core->createCall($connection,'ChangeMessageDefinition','getsingle',['name'=>$messageDefinitionName],[]); $result = $this->core->executeCall($call); $fields = $result['message_provider_fields']; if (!is_array($fields)) { $fields = array(); } return $fields; error: patch failed: src/Plugin/UserMessageProcessorBase.php:65 error: src/Plugin/UserMessageProcessorBase.php: patch does not apply Checking patch src/Plugin/UserMessageProcessorInterface.php... error: while searching for: /** * Process a message. * * @param $contact_id * @param $message * @param \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig $config * * @return void */ public function process($contact_id, $message, $config); /** * Returns the form. * * @param array $form * @param \Drupal\Core\Form\FormStateInterface $form_state * @param \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig $config * @param string|null $connection * @param string|null $messageDefinitionName * * @return array */ public function buildForm(array $form, FormStateInterface $form_state, $config, $connection=null, $messageDefinitionName=null); /** * Validates the form and sets errors if there are any. * * @param array $form * @param \Drupal\Core\Form\FormStateInterface $form_state * @param \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig $config * @param string|null $connection * @param string|null $messageDefinitionName * * @return void */ public function validateForm(array $form, FormStateInterface $form_state, $config, $connection=null, $messageDefinitionName=null); /** * Process the submitted configuration. * * @param array $form * @param \Drupal\Core\Form\FormStateInterface $form_state * @param \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig $config * @param string|null $connection * @param string|null $messageDefinitionName * * @return void */ public function submitForm(array $form, FormStateInterface $form_state, $config, $connection=null, $messageDefinitionName=null); } error: patch failed: src/Plugin/UserMessageProcessorInterface.php:18 error: src/Plugin/UserMessageProcessorInterface.php: patch does not apply Checking patch src/Plugin/UserSyncManager.php... Checking patch src/Plugin/views/argument_default/CurrentUserContactId.php... ā cmrf_user_sync git:(1.0.x) ā
Please check and advise.
Thank you. - š®š¹Italy apaderno Brescia, š®š¹
apaderno ā changed the visibility of the branch 3359010-fix-the-issues to hidden.
- Status changed to Needs review
4 months ago 12:51pm 16 July 2024 - šµšPhilippines cleavinjosh
Hi,
I fix some of the phpcs issues. These are the remaining issues.
ā contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml cmrf_user_sync FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/cmrf_user_sync/cmrf_user_sync.info.yml ----------------------------------------------------------------------------------------------------------- FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE ----------------------------------------------------------------------------------------------------------- 7 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:" ----------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/cmrf_user_sync/cmrf_user_sync.routing.yml ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 7 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access | | administration pages" which is about viewing but not changing configurations. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/cmrf_user_sync/cmrf_user_sync.module ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- FOUND 10 ERRORS AND 2 WARNINGS AFFECTING 10 LINES ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3 | ERROR | [ ] Missing short description in doc comment 4 | ERROR | [x] The second line in the file doc comment must be "@file" 4 | WARNING | [ ] @author tags are not usually used in Drupal, because over time multiple contributors will touch the code anyway 34 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", | | "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates." 44 | ERROR | [ ] Missing short description in doc comment 45 | ERROR | [ ] Missing parameter comment 45 | ERROR | [ ] Missing parameter type 46 | ERROR | [ ] Missing parameter comment 47 | ERROR | [ ] Missing parameter comment 48 | ERROR | [ ] Missing parameter comment 50 | ERROR | [ ] Description for the @return value is missing 52 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/cmrf_user_sync/src/Form/UserSyncConfigForm.php ------------------------------------------------------------------------------------------------------------------------------------------ FOUND 7 ERRORS AND 4 WARNINGS AFFECTING 11 LINES ------------------------------------------------------------------------------------------------------------------------------------------ 3 | ERROR | Namespaced classes, interfaces and traits should not begin with a file doc comment 18 | WARNING | The class short comment should describe what the class does and not simply repeat the class name 21 | ERROR | Missing member variable doc comment 30 | ERROR | Missing short description in doc comment 87 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 99 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 111 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 148 | ERROR | Doc comment is empty 155 | ERROR | Doc comment is empty 162 | ERROR | Doc comment is empty 206 | ERROR | Doc comment is empty ------------------------------------------------------------------------------------------------------------------------------------------ FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/cmrf_user_sync/src/Plugin/QueueWorker/UserSyncQueue.php ---------------------------------------------------------------------------------------------------------------------------- FOUND 8 ERRORS AFFECTING 8 LINES ---------------------------------------------------------------------------------------------------------------------------- 3 | ERROR | Namespaced classes, interfaces and traits should not begin with a file doc comment 25 | ERROR | Missing short description in doc comment 30 | ERROR | Missing short description in doc comment 35 | ERROR | Missing short description in doc comment 40 | ERROR | Missing short description in doc comment 63 | ERROR | Doc comment is empty 84 | ERROR | Missing short description in doc comment 85 | ERROR | Missing parameter comment ---------------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/cmrf_user_sync/src/Plugin/UserMessageProcessor/PortalUserProvider.php ------------------------------------------------------------------------------------------------------------------------------------------ FOUND 31 ERRORS AND 7 WARNINGS AFFECTING 38 LINES ------------------------------------------------------------------------------------------------------------------------------------------ 3 | ERROR | Namespaced classes, interfaces and traits should not begin with a file doc comment 19 | ERROR | Missing short description in doc comment 24 | ERROR | Wrong function doc comment end; expected "*/", found "**/" 31 | ERROR | Missing parameter comment 32 | ERROR | Missing parameter comment 33 | ERROR | Missing parameter comment 34 | ERROR | Missing parameter comment 35 | ERROR | Missing parameter comment 37 | ERROR | Description for the @return value is missing 55 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 61 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 68 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 75 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 85 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 93 | ERROR | Doc comment is empty 112 | WARNING | Line exceeds 80 characters; contains 81 characters 114 | ERROR | Missing parameter comment 115 | ERROR | Missing parameter comment 116 | ERROR | Missing parameter comment 117 | ERROR | Missing parameter comment 118 | ERROR | Missing parameter comment 120 | ERROR | Description for the @return value is missing 133 | WARNING | Line exceeds 80 characters; contains 81 characters 135 | ERROR | Missing parameter comment 136 | ERROR | Missing parameter comment 137 | ERROR | Missing parameter comment 138 | ERROR | Missing parameter comment 139 | ERROR | Missing parameter comment 141 | ERROR | Description for the @return value is missing 157 | ERROR | Missing parameter comment 158 | ERROR | Missing parameter comment 159 | ERROR | Missing parameter comment 215 | ERROR | Doc comment is empty 256 | ERROR | Doc comment is empty 300 | ERROR | Missing short description in doc comment 301 | ERROR | Missing parameter comment 302 | ERROR | Missing parameter comment 304 | ERROR | Description for the @return value is missing ------------------------------------------------------------------------------------------------------------------------------------------ FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/cmrf_user_sync/src/Plugin/UserMessageProcessor/BasicUserProvider.php ------------------------------------------------------------------------------------------------------------------------------------------ FOUND 30 ERRORS AND 6 WARNINGS AFFECTING 33 LINES ------------------------------------------------------------------------------------------------------------------------------------------ 3 | ERROR | Namespaced classes, interfaces and traits should not begin with a file doc comment 16 | ERROR | Missing short description in doc comment 21 | ERROR | Wrong function doc comment end; expected "*/", found "**/" 28 | ERROR | Missing parameter comment 29 | ERROR | Missing parameter comment 30 | ERROR | Missing parameter comment 31 | ERROR | Missing parameter comment 32 | ERROR | Missing parameter comment 34 | ERROR | Description for the @return value is missing 52 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 58 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 64 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 71 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead 79 | WARNING | Line exceeds 80 characters; contains 81 characters 81 | ERROR | Missing parameter comment 82 | ERROR | Missing parameter comment 83 | ERROR | Missing parameter comment 84 | ERROR | Missing parameter comment 85 | ERROR | Missing parameter comment 87 | ERROR | Description for the @return value is missing 100 | WARNING | Line exceeds 80 characters; contains 81 characters 102 | ERROR | Missing parameter comment 103 | ERROR | Missing parameter comment 104 | ERROR | Missing parameter comment 105 | ERROR | Missing parameter comment 106 | ERROR | Missing parameter comment 108 | ERROR | Description for the @return value is missing 120 | ERROR | Missing parameter comment 120 | ERROR | Missing parameter type 121 | ERROR | Missing parameter comment 121 | ERROR | Missing parameter type 122 | ERROR | Missing parameter comment 124 | ERROR | Description for the @return value is missing 194 | ERROR | Missing parameter comment 194 | ERROR | Missing parameter type 196 | ERROR | Description for the @return value is missing ------------------------------------------------------------------------------------------------------------------------------------------ FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/cmrf_user_sync/src/Plugin/UserMessageProcessor/UserSyncLogger.php -------------------------------------------------------------------------------------------------------------------------------------- FOUND 9 ERRORS AFFECTING 7 LINES -------------------------------------------------------------------------------------------------------------------------------------- 3 | ERROR | Namespaced classes, interfaces and traits should not begin with a file doc comment 13 | ERROR | Missing short description in doc comment 18 | ERROR | Wrong function doc comment end; expected "*/", found "**/" 24 | ERROR | Missing parameter comment 24 | ERROR | Missing parameter type 25 | ERROR | Missing parameter comment 25 | ERROR | Missing parameter type 26 | ERROR | Missing parameter comment 28 | ERROR | Description for the @return value is missing -------------------------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/cmrf_user_sync/src/Plugin/UserMessageProcessorBase.php --------------------------------------------------------------------------------------------------------------------------- FOUND 29 ERRORS AND 3 WARNINGS AFFECTING 30 LINES --------------------------------------------------------------------------------------------------------------------------- 3 | ERROR | Namespaced classes, interfaces and traits should not begin with a file doc comment 22 | ERROR | Missing member variable doc comment 31 | ERROR | Missing short description in doc comment 70 | ERROR | Missing parameter comment 71 | ERROR | Missing parameter comment 72 | ERROR | Missing parameter comment 79 | WARNING | Line exceeds 80 characters; contains 81 characters 81 | ERROR | Missing parameter comment 82 | ERROR | Missing parameter comment 83 | ERROR | Missing parameter comment 84 | ERROR | Missing parameter comment 85 | ERROR | Missing parameter comment 87 | ERROR | Description for the @return value is missing 96 | WARNING | Line exceeds 80 characters; contains 81 characters 98 | ERROR | Missing parameter comment 99 | ERROR | Missing parameter comment 100 | ERROR | Missing parameter comment 101 | ERROR | Missing parameter comment 102 | ERROR | Missing parameter comment 104 | ERROR | Description for the @return value is missing 113 | WARNING | Line exceeds 80 characters; contains 81 characters 115 | ERROR | Missing parameter comment 116 | ERROR | Missing parameter comment 117 | ERROR | Missing parameter comment 118 | ERROR | Missing parameter comment 119 | ERROR | Missing parameter comment 121 | ERROR | Description for the @return value is missing 130 | ERROR | Missing parameter comment 130 | ERROR | Missing parameter type 131 | ERROR | Missing parameter comment 131 | ERROR | Missing parameter type 133 | ERROR | Description for the @return value is missing --------------------------------------------------------------------------------------------------------------------------- FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/cmrf_user_sync/src/Plugin/UserMessageProcessorInterface.php -------------------------------------------------------------------------------------------------------------------------------- FOUND 21 ERRORS AFFECTING 21 LINES -------------------------------------------------------------------------------------------------------------------------------- 23 | ERROR | Missing parameter comment 24 | ERROR | Missing parameter comment 25 | ERROR | Missing parameter comment 32 | ERROR | Missing parameter comment 33 | ERROR | Missing parameter comment 34 | ERROR | Missing parameter comment 35 | ERROR | Missing parameter comment 36 | ERROR | Missing parameter comment 38 | ERROR | Description for the @return value is missing 45 | ERROR | Missing parameter comment 46 | ERROR | Missing parameter comment 47 | ERROR | Missing parameter comment 48 | ERROR | Missing parameter comment 49 | ERROR | Missing parameter comment 51 | ERROR | Description for the @return value is missing 58 | ERROR | Missing parameter comment 59 | ERROR | Missing parameter comment 60 | ERROR | Missing parameter comment 61 | ERROR | Missing parameter comment 62 | ERROR | Missing parameter comment 64 | ERROR | Description for the @return value is missing -------------------------------------------------------------------------------------------------------------------------------- Time: 385ms; Memory: 12MB ā contrib
Please review.
Thank you.
- Status changed to Fixed
4 months ago 6:11pm 6 August 2024 - š³š±Netherlands Klaas Culemborg
I have run the phpcs and the correction manually.
Automatically closed - issue fixed for 2 weeks with no activity.