oscerd opened a new pull request, #3048:
URL: https://github.com/apache/camel-kamelets/pull/3048

   Second half of #1888, after #3046. The eleven checks from `script/validator` 
are ported into `CatalogValidator` and run from `ValidateKameletsMojo`, so 
there is one `validate` goal instead of a Maven plugin plus a Go toolchain. 506 
lines of Go out, 542 of Java in.
   
   Since the checks fold into the existing goal, no pom wiring changes.
   
   ## Verified against the Go implementation
   
   Agreement on a clean catalog proves little, so I compared on deliberately 
broken inputs too:
   
   | input | Go | Java |
   |---|---|---|
   | clean catalog | 0 errors | 0 errors |
   | five phase-one violations | 5 | **identical output** |
   | three phase-two violations | 3 | **identical output** |
   
   Phase one covers file names, Kamelet type and parameters; the Go validator 
stops there if anything fails, and so does this, because the later checks 
assume those passed.
   
   ## Two deliberate differences
   
   **The title capitalization rule.** It used `github.com/bbalet/stopwords`, 
whose English list is much broader than the classic one — it treats `name`, 
`between`, `from` and `now` as stop words, which is why `Cache name`, `Exchange 
name`, `Period between Polls` and `Consume from now` pass today. Rather than 
take a dependency on a Java stop word library for a word list, the classic list 
is embedded and those extra words are kept as an explicit exemption set, so 
nothing that passes today starts failing.
   
   Worth saying plainly: those ~23 titles look like ordinary style slips that 
the broad list has been hiding — 1767 of 1807 property titles are fully 
capitalized. Tightening the rule and fixing them is a separate change, reviewed 
on its own merits.
   
   **A path bug in the Go validator, fixed here.** `verifyUsedParams` keyed its 
exemption list on hardcoded relative paths:
   
   ```go
   if k.FileName != "../../kamelets/azure-storage-blob-source.kamelet.yaml" && 
...
   ```
   
   so the exemptions only applied when it was run as `go run . ../../kamelets/` 
from `script/validator`. Pointed at the *same, unmodified* catalog by any other 
path it reports **13 errors on clean files**:
   
   ```
   GO, unmodified catalog, different path : 13 errors
   GO, same content, ../../kamelets/      :  0 errors
   JAVA, unmodified catalog, any path     :  0 errors
   ```
   
   The port keys on the Kamelet name instead, which is path independent. This 
is also why my first phase-two comparison read 16 against 3 — the Go side 
needed its expected directory layout before the two could be compared fairly.
   
   ## CI and docs
   
   `validate.yaml` builds the bom module instead of installing Go, and the 
`Makefile` `validate` target does the same. The job is slower than a `go run`, 
but it is the same work the `build` job already does.
   
   `script/` now holds only `version/UpdateDepsVersionKamelets.groovy`, so 
`README.md`, `AGENTS.md` and `security-model.adoc` no longer describe it as a 
Go validator, and Go is listed as needed for the `crds/` generator alone.
   
   ## Testing
   
   There is no unit test: the goal runs over all 262 Kamelets on every `mvn 
install`, which is broader coverage than a fixture would give, and a regression 
fails the build directly. Happy to add fixture tests for individual checks if 
you would rather have them.
   
   ---
   _Claude Code on behalf of Andrea Cosentino_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to