yari icon indicating copy to clipboard operation
yari copied to clipboard

Filecheck and savecompress should be run as part of flaw checking

Open hamishwillee opened this issue 3 years ago • 4 comments

Given that an uncompressed file will stop fail PR acceptance tests in CI it would be much better if uncompressed files were reported as flaws and I was given the opportunity to fix them before submitting the PR.

Note, I've reported this before, but only as part of other issues.

hamishwillee avatar Feb 17 '21 21:02 hamishwillee

I suspect this is a duplicate of another issue filed as an "enhancement" or "post-launch" issue. You're suggesting that the flaw checker should also do what the file-checker does so that you're alerted before you make the PR.

peterbe avatar Feb 18 '21 17:02 peterbe

Yes.

Fixing these as a flaw would save quite a bit of time.

Typical cycle right now is ... after finishing a PR, uploading, and indulging in some FIGJAM I get an email telling me one of the images I uploaded needs to be compressed. I fix it and reupload. Then I get a second notification for another image I forgot to compress. Repeat.

hamishwillee avatar Feb 18 '21 22:02 hamishwillee

@schalkneethling Bunch of yari cases appear to have been closed too. This is still IMO valid.

hamishwillee avatar May 30 '22 00:05 hamishwillee

@schalkneethling Bunch of yari cases appear to have been closed too. This is still IMO valid.

Yup, I have reopened a bunch a bit earlier. Please do let me know if there are ones I missed. Thanks.

schalkneethling avatar May 30 '22 10:05 schalkneethling

Our current plan is to actually move checks from flaws (build-time) to filecheck (on-demand) to reduce our build time, so we don't plan on doing the inverse (moving filecheck into flaws). In the long-term, filecheck would be the same as flaws and independent from our build, and we could possibly even run it during pre-commit like we run other linters.

caugner avatar Nov 29 '22 10:11 caugner

The problem now is that you submit your PR you don't find out about the problem until tests fail. This has cost me a heap of time. I think you are saying that I will be able to submit any old file size and there won't be any tests any more pre-submission? If so, thanks - that would be much less irritating.

and we could possibly even run it during pre-commit like we run other linters.

And of course this would be even better ^^^

hamishwillee avatar Dec 02 '22 00:12 hamishwillee

And of course this would be even better ^^^

@hamishwillee FYI Since September 2022 (https://github.com/mdn/content/pull/21009), yarn filecheck is actually run on images to be committed as part of the pre-commit hook:

https://github.com/mdn/content/blob/0882acacfbe8bded94c00f743b1756cd914856e6/.lintstagedrc.json#L4

So if you commit an image on the command line and it is too big or can be significantly compressed, it should prevent you from committing. 🎉

(And once https://github.com/mdn/yari/pull/7716 lands, the UX will be much better.)

caugner avatar Dec 06 '22 23:12 caugner

Thanks, I guess I haven't added any images since September!

So if you commit an image on the command line and it is too big or can be significantly compressed, it should prevent you from

Given that at this point there is nothing a user can do to commit except compress the file, can the linter also run --save-compress?

hamishwillee avatar Dec 08 '22 22:12 hamishwillee