Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Regenerate POT files if Vue files have been staged #1101

Closed
wants to merge 2 commits into from
Closed

Conversation

dhruvkb
Copy link
Member

@dhruvkb dhruvkb commented Mar 11, 2022

Fixes

Description

Since the PO files contain references to Vue components, this PR updates the code that generates them to run when Vue files are in the Git diff.

Testing Instructions

  1. Make some line movements in Vue files.
  2. Move and rename some Vue files.
  3. Commit. Your last commit will also contain POT changes.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@dhruvkb dhruvkb added 🟩 priority: low Low priority and doesn't need to be rushed 🤖 aspect: dx Concerns developers' experience with the codebase 🧰 goal: internal improvement Improvement that benefits maintainers, not users labels Mar 11, 2022
@dhruvkb dhruvkb requested a review from a team as a code owner March 11, 2022 08:36
Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

I don't love this solution because it forces you to commit all changes to the pot file regardless of whether you're commit all changes to all vue files that are changed.

For example, if you make changes to a.vue and b.vue but only stage b.vue, the line updates for a.vue will also be committed when you commit b.vue.

An alternative to this is to make this check a pre-push check to fail before running the unit tests if the POT file is out of date.

In any case, it's a pre-existing problem with the en.json file and theoretically the POT file having incorrect line numbers doesn't break the app's functionality so wouldn't inadvertently render an otherwise valid commit invalid (broken).

@dhruvkb
Copy link
Member Author

dhruvkb commented Mar 16, 2022

In any case, we're not merging PRs till all reasonable checks pass so at the time of merge all differences between the POT and the Vue code will be resolved.

Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

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

LGTM

@dhruvkb
Copy link
Member Author

dhruvkb commented Mar 16, 2022

I just realised that this will still allow the POT check CI to fail. Need a more resilient approach here.

@dhruvkb dhruvkb marked this pull request as draft March 16, 2022 14:57
@sarayourfriend
Copy link
Contributor

@dhruvkb Is there a problem with just always running the POT generation in pre-commit regardless of the files changed?

@dhruvkb
Copy link
Member Author

dhruvkb commented Mar 16, 2022

The issue is that POT generation will include the changed but unstaged files unless those are staged before the commit.

@sarayourfriend
Copy link
Contributor

@dhruvkb It did that for the original solution anyway, that's what my comment was about above.

We could move it to pre-push and encourage it to be a separate commit if that would make it clearer. What you said about the PR getting squashed before merge making the commit-level discrepancies irrelevant makes sense to me.

@dhruvkb
Copy link
Member Author

dhruvkb commented May 5, 2022

This is not a good solution and still leaves room for CI failures.

@dhruvkb dhruvkb closed this May 5, 2022
@dhruvkb dhruvkb deleted the pot_changes branch May 5, 2022 09:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🤖 aspect: dx Concerns developers' experience with the codebase 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟩 priority: low Low priority and doesn't need to be rushed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants