koreader / crengine

This is the KOReader CREngine fork. It cross-pollinates with the official CoolReader repository at https://github.com/buggins/coolreader, in case you were looking for that one.
70 stars 45 forks source link

ci: improve linting #580

Closed benoit-pierre closed 1 month ago

benoit-pierre commented 1 month ago

Cf. https://github.com/koreader/crengine/pull/579#issuecomment-2241796599.


This change is Reviewable

benoit-pierre commented 1 month ago

Rewrote the whole thing, main commit:

benoit-pierre commented 1 month ago

How slow you ask? ~4 minutes without lvtinydom.cpp, 9 minutes for everything.

Frenzie commented 1 month ago

That approach looks very nice. :-) (Talking about the code.)

Wrt to the output I'm not the biggest fan of hiding the stuff you actually want to see, though I suppose it's workable.

benoit-pierre commented 1 month ago

Wrt to the output I'm not the biggest fan of hiding the stuff you actually want to see, though I suppose it's workable.

It does make it easier to zero-in on the problematic part, without being flooded with all the traces. And avoid the need GA horrible slow search mechanism. I agree that it would be better if there was a way to create already opened groups (for those containing errors).

Let's see if annotation created by problem matchers can help (but there's a stupidly low limit of 10 annotations max in the summary…).

benoit-pierre commented 1 month ago

But the summary is showing more than 10… Maybe 10 errors and 10 warnings?

But if you look at the PR diff, there are some annotations there, now!

benoit-pierre commented 1 month ago

There are definitively more than 10 warnings in the log, so yeah, 10 max annotations for each type in the summary.

benoit-pierre commented 1 month ago

I was going to say adding problem matchers to the lint check on koreader & koreader-base would be nice too, but I remembered we're using CircleCI. :P

Frenzie commented 1 month ago

I suppose they could still be helpful in time, and in any case the collapsing (and slow search) aren't an issue when running the lint locally. What do you think @poire-z?

benoit-pierre commented 1 month ago

No annotation for cr3gui/data/hyph/languages.json however, although technically possible with a multi-line matcher, I think.

Frenzie commented 1 month ago

PS typo in the first commit message: "may brake" (break)

benoit-pierre commented 1 month ago

PS typo in the first commit message: "may brake" (break)

D'oh! /o\

benoit-pierre commented 1 month ago

It does not look like clicking on the annotation link to the workflow log get you to the line that created the annotation (in the PR diff). And there's another 10 max limit there too. ;(

Frenzie commented 1 month ago

I have to say I'm somewhat surprised they'd even add that. But presumably it's different for paying customers.

poire-z commented 1 month ago

I suppose they could still be helpful in time, and in any case the collapsing (and slow search) aren't an issue when running the lint locally. What do you think @poire-z?

I probably won't install and run any lint stuff, so I'll be using Github/CircleCI CIs to check how I did :) The output I see on #582 looks ok to me (a bit long height to scroll to look for the red stuff, but I'll be ok).

Does this mean that ALL our warnings are resolved ?! And any new one shouted by CI will be to solve ? Do all/most warnings get some -- crenginecheck: ignore kind of solution when we don't have a reaol one?

benoit-pierre commented 1 month ago

Previously, the exit codes of clang-tidy / cppcheck were ignored, so the workflow would fail only on linting the hyphenation patterns or CSS files.

Annotations don't fail the workflow, a non-zero exit code by one of the linters does. So this warning in #582 for example would not fail the job.

With cppcheck, some warnings still result in a non-zero exit code, which is the case with the remaining failures. Those will have to be addressed.

It's similar zlib related code in all 3 instances (in crengine/src/pdbfmt.cpp and crengine/src/lvtinydom.cpp).

poire-z commented 1 month ago

Good to go ? Or still working on it?

benoit-pierre commented 1 month ago

This one is ready.

poire-z commented 1 month ago

Or should we wait until the PR that fixes the warnings is ready ? Seeing the CI failure just below?

benoit-pierre commented 1 month ago

I think it's better to merge this now, since that's the whole point: improve linting. And then fix the CI failures in subsequent PR(s).

poire-z commented 1 month ago

You'll be ready soon with your other PR ? Otherwise, we'll keep getting failures, and it will be hard to notice that any other new PR introduce some new ones or bugs because of the noise.

benoit-pierre commented 1 month ago

Let's wait a little then, I want to address your comments about asserts.

benoit-pierre commented 1 month ago

I've added -DUSE_ZSTD=1 to the compilation flags, and have all the necessary fixes ready to pass the lint. Most of #579 is unrelated anyway, since we don't compile. I'll pull the lint related fixes to separate PR(s) (and the uncontroversial stuff too, to move it out of the way).

This can be merged.

poire-z commented 1 month ago

A little git rebase with my date update & sleep trick to update the commits from Jul 23 to 28 svp ? (Less bothering for ci stuff than for sources, but good to get the habit :))

benoit-pierre commented 1 month ago

Done.