Skip to content

Ignore non-yaml files when normalizing yamls#7531

Merged
sheldon-b merged 1 commit intomainfrom
sbachstein/make-normalize-yaml-only-check-yml-files
Dec 22, 2022
Merged

Ignore non-yaml files when normalizing yamls#7531
sheldon-b merged 1 commit intomainfrom
sbachstein/make-normalize-yaml-only-check-yml-files

Conversation

@sheldon-b
Copy link
Contributor

@sheldon-b sheldon-b commented Dec 22, 2022

🛠 Summary of changes

Updates make normalize_yaml to ignore non-yaml files.

I ran into an issue where I had a swap file for a translation file and running make normalize_yaml was failing with a really generic error about not being able to parse a file and then just deleting dozens of file contents. It took a long time to track down why it was failing -- this should save other people that pain.

👀 Screenshots

Example of the generic error it surfaced

This is me running make normalize_yaml and then git status to show all of the files it edited (it just deleted the contents of all of the files):

sbachstein@Sheldons-MacBook-Pro identity-idp % make normalize_yaml
yarn normalize-yaml .rubocop.yml --disable-sort-keys --disable-smart-punctuation
yarn run v1.22.18
$ normalize-yaml .rubocop.yml --disable-sort-keys --disable-smart-punctuation
✨  Done in 0.36s.
find ./config/locales -not -path "./config/locales/telephony*" -type f | xargs yarn normalize-yaml
yarn run v1.22.18
$ normalize-yaml ./config/locales/doc_auth/es.yml ./config/locales/doc_auth/en.yml ./config/locales/doc_auth/fr.yml ./config/locales/instructions/es.yml ./config/locales/instructions/en.yml ./config/locales/instructions/fr.yml ./config/locales/devise/es.yml ./config/locales/devise/en.yml ./config/locales/devise/fr.yml ./config/locales/idv/es.yml ./config/locales/idv/en.yml ./config/locales/idv/fr.yml ./config/locales/event_types/es.yml ./config/locales/event_types/en.yml ./config/locales/event_types/fr.yml ./config/locales/banned_user/es.yml ./config/locales/banned_user/en.yml ./config/locales/banned_user/fr.yml ./config/locales/forms/es.yml ./config/locales/forms/en.yml ./config/locales/forms/fr.yml ./config/locales/valid_email/es.yml ./config/locales/valid_email/en.yml ./config/locales/valid_email/fr.yml ./config/locales/report_mailer/es.yml ./config/locales/report_mailer/en.yml ./config/locales/report_mailer/fr.yml ./config/locales/vendor_outage/es.yml ./config/locales/vendor_outage/en.yml ./config/locales/vendor_outage/fr.yml ./config/locales/datetime/es.yml ./config/locales/datetime/en.yml ./config/locales/datetime/fr.yml ./config/locales/user_authorization_confirmation/es.yml ./config/locales/user_authorization_confirmation/en.yml ./config/locales/user_authorization_confirmation/fr.yml ./config/locales/saml_idp/es.yml ./config/locales/saml_idp/en.yml ./config/locales/saml_idp/fr.yml ./config/locales/mailer/es.yml ./config/locales/mailer/en.yml ./config/locales/mailer/fr.yml ./config/locales/shared/es.yml ./config/locales/shared/en.yml ./config/locales/shared/fr.yml ./config/locales/mfa/es.yml ./config/locales/mfa/en.yml ./config/locales/mfa/fr.yml ./config/locales/openid_connect/es.yml ./config/locales/openid_connect/en.yml ./config/locales/openid_connect/fr.yml ./config/locales/event_disavowals/es.yml ./config/locales/event_disavowals/en.yml ./config/locales/event_disavowals/fr.yml ./config/locales/email_addresses/es.yml ./config/locales/email_addresses/en.yml ./config/locales/email_addresses/fr.yml ./config/locales/in_person_proofing/es.yml ./config/locales/in_person_proofing/en.yml ./config/locales/in_person_proofing/fr.yml ./config/locales/in_person_proofing/.en.yml.swp ./config/locales/notices/es.yml ./config/locales/notices/en.yml ./config/locales/notices/fr.yml ./config/locales/time/es.yml ./config/locales/time/en.yml ./config/locales/time/fr.yml ./config/locales/account_reset/es.yml ./config/locales/account_reset/en.yml ./config/locales/account_reset/fr.yml ./config/locales/titles/es.yml ./config/locales/titles/en.yml ./config/locales/titles/fr.yml ./config/locales/components/es.yml ./config/locales/components/en.yml ./config/locales/components/fr.yml ./config/locales/headings/es.yml ./config/locales/headings/en.yml ./config/locales/headings/fr.yml ./config/locales/inherited_proofing/es.yml ./config/locales/inherited_proofing/en.yml ./config/locales/inherited_proofing/fr.yml ./config/locales/links/es.yml ./config/locales/links/en.yml ./config/locales/links/fr.yml ./config/locales/users/es.yml ./config/locales/users/en.yml ./config/locales/users/fr.yml ./config/locales/zxcvbn/es.yml ./config/locales/zxcvbn/en.yml ./config/locales/zxcvbn/fr.yml ./config/locales/image_description/es.yml ./config/locales/image_description/en.yml ./config/locales/image_description/fr.yml ./config/locales/step_indicator/es.yml ./config/locales/step_indicator/en.yml ./config/locales/step_indicator/fr.yml ./config/locales/errors/es.yml ./config/locales/errors/en.yml ./config/locales/errors/fr.yml ./config/locales/account/es.yml ./config/locales/account/en.yml ./config/locales/account/fr.yml ./config/locales/countries/es.yml ./config/locales/countries/en.yml ./config/locales/countries/fr.yml ./config/locales/i18n/es.yml ./config/locales/i18n/en.yml ./config/locales/i18n/fr.yml ./config/locales/pages/es.yml ./config/locales/pages/en.yml ./config/locales/pages/fr.yml ./config/locales/sign_up/es.yml ./config/locales/sign_up/en.yml ./config/locales/sign_up/fr.yml ./config/locales/two_factor_authentication/es.yml ./config/locales/two_factor_authentication/en.yml ./config/locales/two_factor_authentication/fr.yml ./config/locales/service_providers/es.yml ./config/locales/service_providers/en.yml ./config/locales/service_providers/fr.yml ./config/locales/simple_form/es.yml ./config/locales/simple_form/en.yml ./config/locales/simple_form/fr.yml ./config/locales/help_text/es.yml ./config/locales/help_text/en.yml ./config/locales/help_text/fr.yml ./config/locales/risc/es.yml ./config/locales/risc/en.yml ./config/locales/risc/fr.yml ./config/locales/user_mailer/es.yml ./config/locales/user_mailer/en.yml ./config/locales/user_mailer/fr.yml
/Users/sbachstein/Workspace/identity-idp/node_modules/yaml/dist/doc/Document.js:319
            throw new Error('Document with errors cannot be stringified');
                  ^

Error: Document with errors cannot be stringified
    at Document.toString (/Users/sbachstein/Workspace/identity-idp/node_modules/yaml/dist/doc/Document.js:319:19)
    at normalize (file:///Users/sbachstein/Workspace/identity-idp/app/javascript/packages/normalize-yaml/index.js:23:35)
    at file:///Users/sbachstein/Workspace/identity-idp/app/javascript/packages/normalize-yaml/cli.js:31:35
    at async Promise.all (index 60)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [normalize_yaml] Error 1
sbachstein@Sheldons-MacBook-Pro identity-idp % git status
On branch sbachstein/lg-8326-add-return-to-sp-link-to-ready-to-verify-page
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   config/locales/banned_user/en.yml
        modified:   config/locales/banned_user/es.yml
        modified:   config/locales/banned_user/fr.yml
        modified:   config/locales/datetime/en.yml
        modified:   config/locales/datetime/es.yml
        modified:   config/locales/datetime/fr.yml
        modified:   config/locales/devise/en.yml
        modified:   config/locales/devise/es.yml
        modified:   config/locales/devise/fr.yml
        modified:   config/locales/doc_auth/en.yml
        modified:   config/locales/doc_auth/es.yml
        modified:   config/locales/doc_auth/fr.yml
        modified:   config/locales/email_addresses/es.yml
        modified:   config/locales/email_addresses/fr.yml
        modified:   config/locales/event_disavowals/en.yml
        modified:   config/locales/event_disavowals/es.yml
        modified:   config/locales/event_disavowals/fr.yml
        modified:   config/locales/event_types/en.yml
        modified:   config/locales/event_types/es.yml
        modified:   config/locales/event_types/fr.yml
        modified:   config/locales/forms/en.yml
        modified:   config/locales/forms/es.yml
        modified:   config/locales/forms/fr.yml
        modified:   config/locales/idv/en.yml
        modified:   config/locales/idv/es.yml
        modified:   config/locales/idv/fr.yml
        modified:   config/locales/in_person_proofing/es.yml
        modified:   config/locales/instructions/en.yml
        modified:   config/locales/instructions/es.yml
        modified:   config/locales/instructions/fr.yml
        modified:   config/locales/mailer/en.yml
        modified:   config/locales/mailer/es.yml
        modified:   config/locales/mailer/fr.yml
        modified:   config/locales/mfa/en.yml
        modified:   config/locales/mfa/es.yml
        modified:   config/locales/mfa/fr.yml
        modified:   config/locales/openid_connect/en.yml
        modified:   config/locales/openid_connect/es.yml
        modified:   config/locales/openid_connect/fr.yml
        modified:   config/locales/report_mailer/en.yml
        modified:   config/locales/report_mailer/es.yml
        modified:   config/locales/report_mailer/fr.yml
        modified:   config/locales/saml_idp/en.yml
        modified:   config/locales/saml_idp/es.yml
        modified:   config/locales/saml_idp/fr.yml
        modified:   config/locales/shared/en.yml
        modified:   config/locales/shared/es.yml
        modified:   config/locales/shared/fr.yml
        modified:   config/locales/user_authorization_confirmation/en.yml
        modified:   config/locales/user_authorization_confirmation/es.yml
        modified:   config/locales/user_authorization_confirmation/fr.yml
        modified:   config/locales/valid_email/en.yml
        modified:   config/locales/valid_email/es.yml
        modified:   config/locales/valid_email/fr.yml
        modified:   config/locales/vendor_outage/en.yml
        modified:   config/locales/vendor_outage/es.yml
        modified:   config/locales/vendor_outage/fr.yml

no changes added to commit (use "git add" and/or "git commit -a")

@sheldon-b sheldon-b marked this pull request as ready for review December 22, 2022 15:57
Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

@sheldon-b sheldon-b merged commit a0379a2 into main Dec 22, 2022
@sheldon-b sheldon-b deleted the sbachstein/make-normalize-yaml-only-check-yml-files branch December 22, 2022 17:58
mitchellhenke pushed a commit that referenced this pull request Dec 27, 2022
* build-sass: Add CLI flag for additional load paths (#7525)

changelog: Internal, Build Tooling, Improve Sass compilation tool to support additional load paths

* Updating ThreatMetrix failure (sad face) screen content (#7529)

* Updating ThreatMetrix failure (sad face) screen content

changelog: User Facing Improvements, UX, ThreatMetrix failure screen content

* Lints

[skipe changelog]

* Adding contact center number to config and setting dummy default

[skip changelog]

* Ignore non-yaml files when normalizing yamls (#7531)

[skip changelog]

* Lg-8264 po search frontend updates (#7519)

* show updated ui for location page when arcgis is enabled

* add mile(s) away to distance

* changelog: Improvements, Location page, update ui on location pg when arcgis is enabled

* normalize yaml

* fix missing translation test failure

* update strings to include count to handle pluralization

* update collection item test

* add es translation for tty to untranslated keys

* refactor

* Fix flakey in-person feature test (#7533)

* make it okay for the interstitial to not show

it's possible for the interstitial to disappear before the matcher can
catch it.

changelog: Internal, Automated Testing, Improve reliability of successful automated tests

* Make `lintfix` fix erb, javascript, and CSS files too (#7528)

* Make lintfix fix erb files too

* Autofix javascript and CSS files

* [skip changelog]

* Mention that we're fixing things in status updates

* Fix untranslated email input in password reset (#7537)

* Fix untranslated email input in password reset

changelog: Bug Fixes, Internationalization, Fix untranslated email input in password reset

* fix specs

* Update app/views/devise/passwords/new.html.erb

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>

* Move favicons to asset pipeline (#7532)

* Move favicons to asset pipeline

changelog: Internal, Assets, Move favicons to asset pipeline

* use existing design system assets

* LG-7489: Remove show_account_recovery_recovery_options Feature flag (#7524)

* changelog: Internal, Authentication, Remove show_account_recovery_recovery_options feature flag since feature is permanently turned on

* LG-7489: rspec fixes

* remove unneeded spec

* LG-8089: Update to support notifying user of OTP format in message (#7486)

* Improvements, Voice messaging, Notify voice OTP users how long and what type of code to expect (LG-8089)

* update voice

* translation update

* add check to otp_sender

* changelog: Improvements, Voice messaging, Notify voice OTP users how long and what type of code to expect

* fix spec

* Revert "LG-8432: SAML - Update ForceAuthn check (#7514)" (#7520)

This reverts commit a7577b6.

[skip changelog]

* LG-8388: Confirm ThreatMetrix doesn't block IPP (#7521)

* LG-8388: Confirm ThreatMetrix doesn't block IPP

Spec to confirm that IPP is not blocked by a ThreatMetrix
result of 'Reject'

[skip changelog]

* ensure the threatmetrix profiling is enabled

* lints

* Update spec/features/idv/in_person_spec.rb

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>

Co-authored-by: Eric Gade <105373963+eric-gade@users.noreply.github.com>
Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>

* Switching newer Acuant SDK to be the default version (#7513)

* Switching newer Acuant SDK to be the default version

-- What
The introduction of the AB Testing framework for upgrading the Acuant
SDK assumes that the "newer" version is the one being tested, and that
the older is the "default".

This change updates the step doc capture step to assume that version
11.7.1 should be used in all cases when the ab test is switched off.

changelog: Internal, Upgrades, Acuant SDK Upgrade

* Specifying acuant versions in configs and updating names

Specifically, we are switching from use_newer_sdk to use_alternate_sdk

changelog: Internal, Upgrades, Acuant SDK Upgrade

* Acuant context should use config's acuant version by default

changelog: Internal, Upgrades, Acuant SDK Upgrade

* Fixing lints

[skip changelog]

* Revert "Acuant context should use config's acuant version by default"

This reverts commit b420998.

[skip changelog]

* Removing redundant condition (via @aduth)

[skip changelog]

* Add logging criteria, abstract logging decision into method (#7516)

* Abstract logging decision into method

* [skip changelog]

* lintfix

* Test logic in should_log? method

* lintfix

* Add filename fingerprint to JavaScript locale data script (#7527)

* Add filename fingerprint to JavaScript locale data script

changelog: Internal, Build Tooling, Invalidate cache for content-only revisions to JavaScript bundles

* Update specs

* LG-8438: Update language on pages related to OTP (#7515)

Update OTP language

changelog: Improvements, Multi-Factor Authentication, Update OTP language

* Doc auth retry timer should decrease (#7498)

* Move timeout calculation to helper

* Fix calculation of attempted_at and expires_at

* changelog: Bug Fixes, DocAuth, Modify retry timer to decrease

* Remove instance variable from helper

* Revert helper

* Indent

Co-authored-by: Mitchell Henke <mitchell.henke@gsa.gov>

* build-sass: Add CLI flag for additional load paths (#7525)

changelog: Internal, Build Tooling, Improve Sass compilation tool to support additional load paths

Co-authored-by: Oren Kanner <oren.kanner@gsa.gov>
Co-authored-by: Doug Price <douglas.price@gsa.gov>
Co-authored-by: Eric Gade <105373963+eric-gade@users.noreply.github.com>
Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
Co-authored-by: John Skiles Skinner <john.skinner@gsa.gov>
Co-authored-by: jc-gsa <104452882+jc-gsa@users.noreply.github.com>
Co-authored-by: Kimball Bighorse <kimball.bighorse@gsa.gov>
Co-authored-by: Mitchell Henke <mitchell.henke@gsa.gov>

* LG-8414 Remove flag from batch job (#7534)

* LG-8414 Remove flag from batch job

changelog: Internal, Attempts API, Events Batch work

* LG-8390 Write rake tasks to pass or reject users (#7536)

* initial steps for rake script to review profile

* rewrite tasks for passing and rejecting

* add tests for review_profile rake task

* add changelog

changelog: Internal, IdV, Make script to pass or reject TMX review

* activate profile upon passing review

also changed the deactivation reason upon rejection to :threatmetrix_review_rejected

* check for deactivation reason in passing

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
Co-authored-by: Eric Gade <105373963+eric-gade@users.noreply.github.com>
Co-authored-by: Sheldon Bachstein <sheldon.bachstein@gsa.gov>
Co-authored-by: Shannon A <20867088+svalexander@users.noreply.github.com>
Co-authored-by: Tomas Apodaca <thomas.apodaca@gsa.gov>
Co-authored-by: Malick Diarra <malick.diarra@gsa.gov>
Co-authored-by: Oren Kanner <oren.kanner@gsa.gov>
Co-authored-by: Doug Price <douglas.price@gsa.gov>
Co-authored-by: John Skiles Skinner <john.skinner@gsa.gov>
Co-authored-by: jc-gsa <104452882+jc-gsa@users.noreply.github.com>
Co-authored-by: Kimball Bighorse <kimball.bighorse@gsa.gov>
Co-authored-by: Luis H. Matos <ThatSpaceGuy@users.noreply.github.com>
Co-authored-by: Alex Bradley <alexander.bradley@gsa.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants