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

Add validator spec via code generation #100

Merged
merged 109 commits into from
Jun 1, 2021
Merged

Conversation

schlessera
Copy link
Collaborator

@schlessera schlessera commented Mar 16, 2021

This PR adds an object hierarchy that represents the validator spec.

It downloads the JSON version of the validator spec data and uses code generation to build the object hierarchy as a result. The code generation can be manually retriggered for a refresh via the following command:

php bin/generate-validator-spec.php

The generated validator spec is found under AmpProject\Validator\Spec (in the src/Validator/Spec subfolder), whereas the code generation is found under (the --dev only) AmpProject\Tooling\Validator\SpecGenerator (in the bin/Validator/SpecGenerator subfolder).

@codecov
Copy link

codecov bot commented Mar 16, 2021

Codecov Report

Merging #100 (db0f8be) into main (7d6402e) will decrease coverage by 8.84%.
The diff coverage is 17.78%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #100      +/-   ##
============================================
- Coverage     80.87%   72.03%   -8.85%     
- Complexity      928     1017      +89     
============================================
  Files            48       65      +17     
  Lines          2311     2739     +428     
============================================
+ Hits           1869     1973     +104     
- Misses          442      766     +324     
Flag Coverage Δ Complexity Δ
php 72.03% <17.78%> (-8.85%) 0.00 <74.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
src/Amp.php 93.05% <ø> (ø) 43.00 <0.00> (ø)
src/Exception/InvalidAttributeName.php 0.00% <0.00%> (ø) 1.00 <1.00> (?)
src/Exception/InvalidCssName.php 0.00% <0.00%> (ø) 1.00 <1.00> (?)
src/Exception/InvalidExtension.php 0.00% <0.00%> (ø) 1.00 <1.00> (?)
src/Exception/InvalidFormat.php 0.00% <0.00%> (ø) 1.00 <1.00> (?)
src/Exception/InvalidListName.php 0.00% <0.00%> (ø) 2.00 <2.00> (?)
src/Exception/InvalidSpecName.php 0.00% <0.00%> (ø) 1.00 <1.00> (?)
src/Exception/InvalidSpecRuleName.php 0.00% <0.00%> (ø) 1.00 <1.00> (?)
src/Exception/InvalidTagId.php 0.00% <0.00%> (ø) 1.00 <1.00> (?)
src/Validator/Spec/AttributeList.php 0.00% <0.00%> (ø) 4.00 <4.00> (?)
... and 26 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d6402e...db0f8be. Read the comment docs.

@schlessera schlessera marked this pull request as ready for review May 21, 2021 15:46
@westonruter
Copy link
Member

LGTM ✅

Just kidding. As you noted, I'll have to digest this. Maybe we could step through it next week so I can get a high-level overview before getting into the details?

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

To do full post-merge review as discussed.

@schlessera schlessera added this to the 0.6.0 milestone Jun 1, 2021
Co-authored-by: Weston Ruter <westonruter@google.com>
@schlessera schlessera merged commit 0ceee97 into main Jun 1, 2021
@schlessera schlessera deleted the add/amp-validator-spec branch June 1, 2021 18:19
@westonruter
Copy link
Member

To do full post-merge review as discussed.

See #221.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants