Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Shiv_Sharma created an issue. See original summary.

kpoornima’s picture

Assigned: Unassigned » kpoornima

looking on it

kpoornima’s picture

Assigned: kpoornima » Unassigned
Status: Active » Needs review

Please review and merge

nishant’s picture

Status: Needs review » Needs work

I have checkout 3379900-phpcs-errors this branch and run the above command, I saw some phpcs cs error, I am posting below.

FILE: /var/www/html/web/modules/live_weather/src/Plugin/Block/LiveWeatherBlock.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
 9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/live_weather/src/Form/LiveWeatherDeleteForm.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/live_weather/src/Form/LiveWeatherForm.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/live_weather/src/Controller/LiveWeatherController.php
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/live_weather/src/LiveWeather.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Serialization\Json.
-----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
shreya_th’s picture

StatusFileSize
new22.08 KB

Kindly Review this phpcs fixed issues patch file.

bunty oberoi’s picture

Status: Needs work » Needs review
aayushmankotia’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new111.82 KB

Hi @Shreya_th,
I have tested your patch and found no errors. I've attached a screenshot for your reference.

These are the steps I followed:

1. Took clone from git version 3.0.0 in drupal 10.1.x

2. Ran this command:

./vendor/bin/phpcs --standard="Drupal,DrupalPractice" --extensions="php,module,inc,install,test,profile,theme,md,yml" modules/contrib/live_weather/

3. Applied patch and again ran phpcs command.

screenshot

I found no error. Moving it to RTBC.

avpaderno’s picture

Title: Fix the issues reported by phpcs on live_weather module » Fix the issues reported by PHP_CodeSniffer
Issue tags: -phpcs warning +Coding standards
avpaderno’s picture

Status: Reviewed & tested by the community » Needs work
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    parent::submitForm($form, $form_state);
+    // parent::submitForm($form, $form_state);.
   }

If a method is merely calling the parent method, that method can be removed. There is no need to comment out the code.

   protected $httpClient;
-
   /**
    * A logger instance.
    *
    * @var \Psr\Log\LoggerInterface
    */
   protected $logger;
-
   /**
    * The configuration factory service.
    *

Between a line defining a class property and the comment for the next property there must be an empty line.

mrinalini9’s picture

Status: Needs work » Needs review
StatusFileSize
new21.92 KB
new3.35 KB

Updated patch #6 by addressing #10 and some other phpcs issues (missing type hint), please review it.

Thanks!

vsheokeen’s picture

Status: Needs review » Reviewed & tested by the community

Took clone from latst version
Ran the PHPCS commands
Applied the Patch
Ran again all commands.

Now it looks clean. So moving to RTBC

avpaderno’s picture

Status: Reviewed & tested by the community » Needs work
+      '#description' => $this->t(
+    'Enter Where On Earth IDentification of location. Find WOEID to use this url http://woeid.rosselliot.co.nz'),
+    ];

The second line is not correctly indented.
It is probably better to leave the method call on a single line, as it is easier to understand. The fact the first line ends with ( and the last line ends with ] is a bit confusing.

   public function submitForm(array &$form, FormStateInterface $form_state) {
-    parent::submitForm($form, $form_state);
   }

The full method must be deleted.

+   * @param string|null $woeid
+   *   The Where On Earth IDentifier of the location.

IDentifier should be identifier. It is not necessary to say of the location, since a Where on Earth identifier is surely for a location.

+        'oauth_nonce' =>
+        uniqid(mt_rand(1, 1000)),

The second line is not correctly indented. It is probably better to put the code on a single line.

-        CURLOPT_HEADER => false,
+        CURLOPT_HEADER =>
+        FALSE,

There is not need to put FALSE on a new line.

+      '#title' =>
+      $this->t('Location list'),
+      '#description' =>
+      $this->t('Select locations to display in block'),

The second line is not correctly indented and it is not necessary to use two lines.

mrinalini9’s picture

Status: Needs work » Needs review
StatusFileSize
new21.63 KB
new2.52 KB

Updated patch #11 by addressing #13, please review it.

Thanks!

avpaderno’s picture

Status: Needs review » Needs work
   /**
    * The Drupal configuration factory.
    *
    * @var \Drupal\Core\Config\ConfigFactoryInterface
    */
   protected $configFactory;
-
   /**
    * The Live weather controller.
    *

That empty line must be kept.

   /**
-   * {@inheritdoc}
+   * Creates an instance of the LiveWeatherForm plugin.
+   *
+   * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
+   *   The service container.
+   * @param array $configuration
+   *   An associative array of configuration settings.
+   * @param string $plugin_id
+   *   The plugin ID for the plugin instance.
+   * @param mixed $plugin_definition
+   *   The plugin definition.
+   *
+   * @return static
+   *   A new instance of the LiveWeatherForm plugin.
    */
   public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {

Since that is a method defined in an interface, the existing documentation comment is already correct.

   /**
-   * {@inheritdoc}
+   * Builds the form for configuring the block settings.
+   *
+   * @param array $form
+   *   An associative array representing the form structure.
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   *   The current state of the form.
+   *
+   * @return array
+   *   The built form structure.
    */
-  public function blockForm($form, FormStateInterface $form_state) {

The existing documentation comment is already correct.

Preethy_ray made their first commit to this issue’s fork.

yashaswi18’s picture

Applied patch provided in #14, patch applied cleanly, all phpcs issues are fixed. The reviews yet to be addressed.
Ran this command to check :
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml live_weather/

avpaderno’s picture

The merge request has more recent changes. That needs to be reviewed, not the patch.

avpaderno’s picture

Status: Needs work » Needs review
nikolay shapovalov’s picture

Status: Needs review » Needs work

Set to NW.

pray_12’s picture

Status: Needs work » Needs review
nikolay shapovalov’s picture

Status: Needs review » Needs work

Thanks. Please check my feedback.

avpaderno’s picture

Issue summary: View changes
zkhan.aamir’s picture

Status: Needs work » Needs review

Hi,

I have checkout 3379900-phpcs-errors this branch and run the above command.
There are no errors found.

Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules
$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,js,yml live_weather/

Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules
$


a.aaronjake’s picture

Status: Needs review » Needs work

Hi @everyone,

Applied the latest changes on MR!6, one error was thrown by my terminal. Please see below:

live_weather git:(main) ✗ curl https://git.drupalcode.org/project/live_weather/-/merge_requests/6.diff | patch -p1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 18602    0 18602    0     0  46684      0 --:--:-- --:--:-- --:--:-- 48191
patching file README.md
patching file src/Controller/LiveWeatherController.php
patching file src/Form/LiveWeatherDeleteForm.php
patching file src/Form/LiveWeatherForm.php
patching file src/Form/LiveWeatherSettingsForm.php
patching file src/LiveWeather.php
patching file src/LiveWeatherInterface.php
patching file src/Plugin/Block/LiveWeatherBlock.php
➜  live_weather git:(main) ✗ ..
➜  contrib git:(main) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig live_weather

FILE: ...-site/drupal-orgissue/web/modules/contrib/live_weather/src/LiveWeather.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 190 | ERROR | [x] Doc comment short description must end with a full stop
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 365ms; Memory: 10MB

Kindly check

Thanks,
Jake

avpaderno’s picture

avpaderno’s picture

Status: Needs work » Needs review
avpaderno’s picture

Issue summary: View changes
avpaderno’s picture

Assigned: avpaderno » Unassigned

avpaderno changed the visibility of the branch 3379900-gitlab-ci-reports to hidden.