Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only fail qmlformat stage if Qt >= 5.15 is used #3929

Merged
merged 4 commits into from
Jun 12, 2021

Conversation

daschuer
Copy link
Member

this uses "moc -v" for version check, because this is needed for building anyway.

Copy link
Member

@Holzhaus Holzhaus left a comment

Choose a reason for hiding this comment

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

Not sure if this is a good idea. It's more convenient for people that merge main into their PR, but may lead to skin change PRs with broken qml formatting without the contributor expecting it. And if we ever accidently have a too old Qt version on CI, we won't notice qml formatting issues.

tools/qmlformat.py Outdated Show resolved Hide resolved
@daschuer
Copy link
Member Author

Not sure if this is a good idea.

It just does automatically what is suggested by the error message. The contributor has no chance to fix it on such a system.
Verifying the qt version on our CI is another topic.

Co-authored-by: Jan Holthuis <holthuis.jan@googlemail.com>
@Holzhaus
Copy link
Member

Not sure if this is a good idea.

It just does automatically what is suggested by the error message. The contributor has no chance to fix it on such a system.
Verifying the qt version on our CI is another topic.

Before:

  1. User installs pre-commit hooks
  2. User makes QML changes
  3. User commits, sees the error message and either updates Qt or skips the hook (in that case CI failure is expected)

After:

  1. User installs pre-commit hooks
  2. User makes QML changes
  3. User commits. The qmlformat hook passes.
  4. User opens PR and is confused that the pre-commit hook suddenly fails although everything "worked" locally -> "pre-commit is broken!!!"

@uklotzde
Copy link
Contributor

I agree with Jan and would prefer the safe (and future proof) version.

@daschuer
Copy link
Member Author

daschuer commented Jun 1, 2021

I think my version is the future proved one, please verify:

Before:
User installs pre-commit hooks
User makes QML changes
User commits, sees the error message and permanently disabled the hook.
He is facing unrelated and unnecessary hassle, nothing to do with the one liner fix he is trying to commit ...
(User will unlikely intall a home build Qt update just because of qmlformat)
Later the distro will updating QT
User will keep the hook disabled

After:
User installs pre-commit hooks
User makes QML changes
User commits. The qmlformat hook passes.
User opens PR and is confused that the pre-commit hook suddenly fails ...
(This is why we have CI, it may fail for plenty of reasons on targets that differ from the dev machine.)
Once the dev machine is automatically updated by the distro to QT 5.14 it works automatically without additional actions.

@daschuer
Copy link
Member Author

Uh ... this is really helpful. Imagine you are on qt 5.12 ...
Did you reconsider this?

Copy link
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

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

@Holzhaus Merge?

@daschuer Maybe we should add a TODO that allows us to better identify and remove obsolete code once we have switched to Qt >= 5.15? All this new code is only there for the purpose of backwards compatibility. The expression (5, 15) is not easily identifiable as the Qt version when searching for it.

@Holzhaus
Copy link
Member

Uh ... this is really helpful. Imagine you are on qt 5.12 ...
Did you reconsider this?

As I said, the proper fix would be to run echo "export SKIP=qmlformat" >> ~/.profile. We could even add this to the error message. But I won't stand in the way if you really want to merge this.

@daschuer
Copy link
Member Author

Yes, I really like to merge it, because of the good first time experience and the feature that it is automatically enabled once QT 5.14 is installed.

@uklotzde
Copy link
Contributor

I am not excited that we need to add another ugly workaround for Ubuntu. At least its just a build script.

LGTM

@uklotzde uklotzde merged commit 9fa60a7 into mixxxdj:main Jun 12, 2021
@daschuer daschuer deleted the qmlformat branch August 1, 2021 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants