Plugin code prechecks : uncommitted change detected?

Plugin code prechecks : uncommitted change detected?

by Astor Bizard -
Number of replies: 16
Picture of Plugin developers
Hello,

I have submitted several plugins in the Moodle plugins directory.
I would like to reduce as much as possible code prechecks errors. However, I keep getting the same errors:
grunt > Uncommitted change detected.
This error pops for every js file I have, either for AMD modules or YUI modules.
I have grunt up-to-date.

Does anyone know what problem causes this error to show, and how to get rid of it? smile

Auxiliary question: I also happen to have externalbackup warnings, saying that my db/upgrade.php file has changed without any changes to the DB (which is normal, as it was only code cleaning). Is it possible to get rid of these warnings as well?

Thank you!
Astor
Average of ratings: -
In reply to Astor Bizard

Re: Plugin code prechecks : uncommitted change detected?

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
We share a goal in achieving 0/0. Have you tried deleting all the contents from the build folder then re-doing the grunt?
It is possible
https://moodle.org/plugins/qtype_gapfill
In reply to Marcus Green

Re: Plugin code prechecks : uncommitted change detected?

by Astor Bizard -
Picture of Plugin developers
@Marcus Green - thank you for your quick answer!
I tried deleting the build folder before running grunt again, but git tells me that no files have changed.
This problem happens on every plugin I submit, but it used not to. The example you provided (congrats, by the way smile ) was last checked 7 months ago. Is it possible that something changed in moodle prechecks policy quite recently?
In reply to Astor Bizard

Re: Plugin code prechecks : uncommitted change detected?

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
"Is it possible that something changed in moodle prechecks policy quite recently?"
Yes it is entirely possible

It is worth setting up some sort of CI/Continuous Integration. I use Github actions. e.g.
https://github.com/marcusgreen/moodle-report_advancedgrading/actions
In reply to Marcus Green

Re: Plugin code prechecks : uncommitted change detected?

by Astor Bizard -
Picture of Plugin developers
I agree, though I do not see how CI would change something in the fact that moodle detects a difference between built versions (as it is what I understand from the error message).
Is there a way to see what moodle expects? So I can at least try to find out what kind of differences are found, and try to fix my grunt build without repeatedly submit new versions of plugins...
Average of ratings: Useful (3)
In reply to Astor Bizard

Re: Plugin code prechecks : uncommitted change detected?

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
"Is there a way to see what moodle expects?"
I don't know, but I have liked/usefulled your posts to see if cleverer people than me can help... One day Moodle will allow tagging people and I will tag the insightful David Mudrak about this (The Doyenne of Moodle Dev.... goes away to look up the meaning of Doyenne...)
In reply to Marcus Green

Re: Plugin code prechecks : uncommitted change detected?

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@Marcus,

Me too I'd like Moodle forums to allow tagging people. Then I would tag you (and maybe you would tag me).😉

By the way, David should rather go by the qualification of "doyen", as "doyenne" is a female "doyen". Athough in these days of Non-binary gender fashion, I expect anything goes.😅


In reply to Astor Bizard

Re: Plugin code prechecks : uncommitted change detected?

by Renaat Debleu -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Did you:
  1. Check your node version (currently v16.14.0 is needed)
  2. Delete the build folder (THX Marcus)
  3. Try to run "grunt shifter" in the src folder?
In reply to Renaat Debleu

Re: Plugin code prechecks : uncommitted change detected?

by Astor Bizard -
Picture of Plugin developers
That may be because of node version, now that you say it, mine is a little outdated...
What grunt version is needed?
In reply to Astor Bizard

Re: Plugin code prechecks : uncommitted change detected?

by coactum Entwickler -
Picture of Plugin developers
Hello all,
i have the same problem with my plugins, the prechecks report "Uncommitted change detected." errors for grunt.
I use the latest node version and have no errors while grunting itself.

Are there any new findings in the meantime? Astor, have you been able to solve the problem for you?

What I asked myself in this context: My new plugin versions always include several Moodle versions, e.g. one plugin release is for Moodle 3.9, 3.10, 3.11, 4.00 and 4.01. Which Node version would I have to use there to ensure that the error is not due to an outdated Node version (as others here have suspected)?
Thanks and best regards,
Daniel
In reply to coactum Entwickler

Re: Plugin code prechecks : uncommitted change detected?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
For github actions, (moodle-plugin-ci) you can deal with this like this: Once you have decided whch Moodle branch you are going to run Grunt with, then you can only run that check on that branch https://github.com/moodleou/moodle-qtype_pmatch/blob/main/.github/workflows/ci.yml#L108

Plugins DB pre-checks, I think there is nothing you can do. At least, I don't know any way.
In reply to Tim Hunt

Re: Plugin code prechecks : uncommitted change detected?

by coactum Entwickler -
Picture of Plugin developers

Hi Tim,

thanks for your reply! Oddly i don't get the error messages on github actions at all.

It is sad that we can't do anything against the plugins db pre-check errors, especially when aiming for the 0/0 errors. That makes this whole point a bit obsolet :/

It would be really cool if someone at Moodle can take a look into this. I would create an issue in the moodle tracker if you think that anyone there is able and willing to help.

In reply to coactum Entwickler

Re: Plugin code prechecks : uncommitted change detected?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well, feature requests / suggestions for the Moodle plugins DB (and other Moodle infrastructure) are tracked in the MDLSITE project in the Tracker. I don't know if there is currently an issue there about this (worth searching) but if not, you could make an issue to describe the problem. That is the first step on the path to getting this improved.
In reply to Tim Hunt

Re: Plugin code prechecks : uncommitted change detected?

by coactum Entwickler -
Picture of Plugin developers
I have not found any current issue to this problem so i made a bug report in the MDLSITE tracker (https://tracker.moodle.org/browse/MDLSITE-7136). Lets hope it helps and someone will take a deeper look into it.
In reply to coactum Entwickler

Re: Plugin code prechecks : uncommitted change detected?

by coactum Entwickler -
Picture of Plugin developers
Just a short update if someone is interested:
I just released a new version of the margic plugin where i compiled the amd modules with the most recent supported moodle version (4.1). That seems to prevent the uncommited changes errors so i am happy now (although i could have sworn that i had already made sure to compile in the latest moodle version in earlier plugin releases as well that nevertheless had the errors 😅).