A TOTAL OF 565 ERRORS AND 10 WARNINGS WERE FOUND IN 151 FILES

https://git.drupalcode.org/project/backup_migrate/-/jobs/7752320

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

ivnish created an issue. See original summary.

danrod’s picture

Just following on this one.

danrod’s picture

Assigned: Unassigned » danrod

kieran.cott made their first commit to this issue’s fork.

kieran.cott’s picture

Status: Active » Needs review

I've taken a pass at resolving these in MR 62, the vast majority of these were fixed by PHPCBF - the remainder is nearly all docblocks and removing commented out lines, the exception being the removal of strict config schema opt-outs from functional tests.

There is a little bit of overlap with #3357391 for things such as dependency injections, because PHPCS is run using DrupalPractice which is reporting DrupalPractice.Objects.GlobalDrupal.GlobalDrupal and DrupalPractice.Objects.GlobalFunction.GlobalFunction as warnings - but only changes necessary to get PHPCS to pass have been made here.

ivnish’s picture

Assigned: danrod » Unassigned
ivnish’s picture

@kieran.cott thanks! MR introducing some new cspell issues https://git.drupalcode.org/issue/backup_migrate-3564661/-/jobs/10483641

kieran.cott’s picture

Thanks for pointing out @ivnish, I've now fixed those cspell issues.

schillerm’s picture

Hi, when I run phpcs on MR!62 I am currently getting 3 errors .. see below..

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml web/modules/contrib/backup_migrate

FILE: /home/m/Documents/Issues/backup-migrate-11-3564661/web/modules/contrib/backup_migrate/src/Core/Config/README.md
---------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 4 WARNINGS AFFECTING 7 LINES
---------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
3 | WARNING | [ ] Line exceeds 80 characters; contains 591 characters
5 | WARNING | [ ] Line exceeds 80 characters; contains 388 characters
8 | WARNING | [ ] Line exceeds 80 characters; contains 171 characters
36 | WARNING | [ ] Line exceeds 80 characters; contains 96 characters
56 | ERROR | [x] Concat operator must be surrounded by a single space
58 | ERROR | [x] list(...) is forbidden, use [...] instead.
---------------------------------------------------------------------------------------------------------------------

kieran.cott’s picture

Hi @schillerm - PHPCS on the CI pipeline passes successfully: https://git.drupalcode.org/issue/backup_migrate-3564661/-/jobs/10497128 - this job uses the drupal-contrib-project standard from the Drupal GitLab Template's default phpcs.xml.dist.

The reason you're seeing failures locally appears to be that you are using a different standard and running PHPCS against the README.md file.

nitinkumar_7’s picture

I have reviewed MR and the latest CI pipeline run. The phpcs job now passes successfully with zero coding standards errors or warnings, meaning the primary objective of this issue is resolved.

The overall pipeline failure appears to be caused by other jobs (such as the recent cspell changes or unrelated test failures). Since the PHPCS issues themselves are fully addressed here, those remaining pipeline errors can be broken out and resolved in a separate issue. Ready for RTBC , keeping status needs review for maintainer approval.

ivnish’s picture

Status: Needs review » Needs work

Needs check why schema fails with error:

Schema errors for backup_migrate.backup_migrate_schedule.daily_schedule with the following errors: backup_migrate.backup_migrate_schedule.daily_schedule:keep variable type is string but applied schema class is Drupal\Core\TypedData\Plugin\DataType\IntegerData

All tests failed with this error. Only the last test was previously failed

kieran.cott’s picture

Thanks @ivnish, looks like daily_schedule.yml sets keep: '' as a string, while the schema treats keep as an integer.

I've had a look into this and it's not an issue that has been introduced here. It looks like removing strictConfigSchema = FALSE (which was skipping the config schema validation test) has exposed an existing issue:

  • 386dcee on 2016-03-11 added the schedule schema with keep as type: integer.
  • e65d7a4 on 2020-09-01 introduced AdminFunctionalityTest with strict schema disabled.
  • fbd2f1b on 2022-12-10 added the installed daily schedule config with keep: ''.

and then in this branch, strict schema has been enabled again to get PHPCS to pass, exposing the mismatch.

Would you like me to take a pass at making the schedule config/form save keep as an integer on this branch, or would you prefer to treat this as a separate issue?

kieran.cott’s picture

Status: Needs work » Needs review
ivnish’s picture

Status: Needs review » Needs work

del

ivnish’s picture

Status: Needs work » Needs review
kieran.cott’s picture

I believe that's because on that branch AdminFunctionalityTest.php still has the test bypass:

protected $strictConfigSchema = FALSE;

So the issue is obfuscated on the PHPStan branch.

It's only been removed on this branch (to get PHPCS to pass) - thus exposing the issue.

schillerm’s picture

Hi kieran.cott, yes you are right I was missing phpcs.xml. Re ran locally with that phpcs.xml file and no phpcs errors now. Sorry about that.

danrod’s picture

@kieran.cott could we fix the schedule config/form issue in this MR? please let us know, I can look on it as well.

kieran.cott’s picture

Thanks @danrod.

I've stored schedule retention as integer 0 for “keep all backups”, completed source config schemas for saved name values, and extended settings profile schema for notification settings.

Form submissions have also been normalised before save: schedule retention and settings profile checkbox values have been cast to the expected scalar types. The related functional test data has been corrected so timestamp format is submitted to timestamp_format.

I've also updated the the Drupal MySQL source to call the up-to-date getConnection() and readSqlCommand() methods.

PHPUnit CI pipeline output now exactly matches that of the 5.1.x branch:

danrod’s picture

Thank you @kieran.cott

I ran the tests locally and got no failures, I will do some manual tests before merging this.

danrod’s picture

I did some manual testing and the functionality works as expected, I'm setting this to RTBC, but I'm not merging yet, just in case anyone wants to test this MR as well.

danrod’s picture

Status: Needs review » Reviewed & tested by the community
schillerm’s picture

Hi, I just pulled the latest commits and ran phpcs again, no errors showing up. Seems fine to me.

danrod’s picture

Thanks @schillerm , merging this now.

danrod’s picture

Merged, thanks a lot to everyone involved.

danrod’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.