png_conform 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +82 -42
  3. data/Gemfile +2 -0
  4. data/README.adoc +3 -2
  5. data/benchmarks/README.adoc +570 -0
  6. data/benchmarks/config/default.yml +35 -0
  7. data/benchmarks/config/full.yml +32 -0
  8. data/benchmarks/config/quick.yml +32 -0
  9. data/benchmarks/direct_validation.rb +18 -0
  10. data/benchmarks/lib/benchmark_runner.rb +204 -0
  11. data/benchmarks/lib/metrics_collector.rb +193 -0
  12. data/benchmarks/lib/png_conform_runner.rb +68 -0
  13. data/benchmarks/lib/pngcheck_runner.rb +67 -0
  14. data/benchmarks/lib/report_generator.rb +301 -0
  15. data/benchmarks/lib/tool_runner.rb +104 -0
  16. data/benchmarks/profile_loading.rb +12 -0
  17. data/benchmarks/profile_validation.rb +18 -0
  18. data/benchmarks/results/.gitkeep +0 -0
  19. data/benchmarks/run_benchmark.rb +159 -0
  20. data/config/validation_profiles.yml +105 -0
  21. data/docs/CHUNK_TYPES.adoc +42 -0
  22. data/examples/README.md +282 -0
  23. data/lib/png_conform/analyzers/comparison_analyzer.rb +41 -7
  24. data/lib/png_conform/analyzers/metrics_analyzer.rb +6 -9
  25. data/lib/png_conform/analyzers/optimization_analyzer.rb +30 -24
  26. data/lib/png_conform/analyzers/resolution_analyzer.rb +31 -32
  27. data/lib/png_conform/cli.rb +12 -0
  28. data/lib/png_conform/commands/check_command.rb +118 -52
  29. data/lib/png_conform/configuration.rb +147 -0
  30. data/lib/png_conform/container.rb +113 -0
  31. data/lib/png_conform/models/decoded_chunk_data.rb +33 -0
  32. data/lib/png_conform/models/validation_result.rb +30 -4
  33. data/lib/png_conform/pipelines/pipeline_result.rb +39 -0
  34. data/lib/png_conform/pipelines/stages/analysis_stage.rb +35 -0
  35. data/lib/png_conform/pipelines/stages/base_stage.rb +23 -0
  36. data/lib/png_conform/pipelines/stages/chunk_validation_stage.rb +74 -0
  37. data/lib/png_conform/pipelines/stages/sequence_validation_stage.rb +77 -0
  38. data/lib/png_conform/pipelines/stages/signature_validation_stage.rb +41 -0
  39. data/lib/png_conform/pipelines/validation_pipeline.rb +90 -0
  40. data/lib/png_conform/readers/full_load_reader.rb +13 -4
  41. data/lib/png_conform/readers/streaming_reader.rb +27 -2
  42. data/lib/png_conform/reporters/color_reporter.rb +17 -14
  43. data/lib/png_conform/reporters/reporter_factory.rb +18 -11
  44. data/lib/png_conform/reporters/visual_elements.rb +22 -16
  45. data/lib/png_conform/services/analysis_manager.rb +120 -0
  46. data/lib/png_conform/services/chunk_processor.rb +195 -0
  47. data/lib/png_conform/services/file_signature.rb +226 -0
  48. data/lib/png_conform/services/file_strategy.rb +78 -0
  49. data/lib/png_conform/services/lru_cache.rb +170 -0
  50. data/lib/png_conform/services/parallel_validator.rb +118 -0
  51. data/lib/png_conform/services/profile_manager.rb +41 -12
  52. data/lib/png_conform/services/result_builder.rb +299 -0
  53. data/lib/png_conform/services/validation_cache.rb +210 -0
  54. data/lib/png_conform/services/validation_orchestrator.rb +188 -0
  55. data/lib/png_conform/services/validation_service.rb +82 -321
  56. data/lib/png_conform/services/validator_pool.rb +142 -0
  57. data/lib/png_conform/utils/colorizer.rb +149 -0
  58. data/lib/png_conform/validators/ancillary/idot_validator.rb +102 -0
  59. data/lib/png_conform/validators/chunk_registry.rb +143 -128
  60. data/lib/png_conform/validators/streaming_idat_validator.rb +123 -0
  61. data/lib/png_conform/version.rb +1 -1
  62. data/lib/png_conform.rb +7 -46
  63. data/png_conform.gemspec +1 -0
  64. metadata +55 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f127b9ca68b7724b12ee453119e16e27f4c1f3ceebe435d7e02ed58ff6788cda
4
- data.tar.gz: bae36563ac434efe72bafa500f62988cfc400a87e40aef9e36f01b5b8a87c8b5
3
+ metadata.gz: 8bcefecf4f13700db28e89f3ec81ad93df86ef0d5774057a3366ef9c74121169
4
+ data.tar.gz: bfd053fc3545d3ede27936476e8fce4d483c85e227d5eb5824e9faaa4f7c8872
5
5
  SHA512:
6
- metadata.gz: ae2d37bad772e360d41f97ffdba12e516c671779689d19027c5d6e8f04c5b2c27bdf2c4073207368e885656e37522af748c3a66729203f4af0b873057302247a
7
- data.tar.gz: 98f45aa6247c4e141de83e5e0030dff7f0ea2f2a2bf36914cb28b0cc3824591dc84ee710d14964c84c0354bea54ec9254120c1ca86f0406e464f0b57c3f78677
6
+ metadata.gz: 8b16cfe85d3e17edc7dcdd5c4a7b1b9e416fd91be3825ac758bb2f95de19015cacc3c8c3301aabbac7174dc651e180930862b026a42968959539d4e1520857b6
7
+ data.tar.gz: c966fa4713fc24c7a4439e41ada2382814395d7be7bbe2e782fb388bf59d3f723ee5d36db5cac431c078c02b1dbdd9f517dbfa341ee0132ffee8403208185a69
data/.rubocop_todo.yml CHANGED
@@ -1,55 +1,92 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-11-17 11:51:04 UTC using RuboCop version 1.81.1.
3
+ # on 2026-01-19 08:52:09 UTC using RuboCop version 1.81.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
9
+ # Offense count: 6
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: IndentationWidth.
12
- Layout/AssignmentIndentation:
11
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
12
+ # SupportedStyles: with_first_argument, with_fixed_indentation
13
+ Layout/ArgumentAlignment:
13
14
  Exclude:
14
- - 'lib/png_conform/models/file_analysis.rb'
15
+ - 'lib/png_conform/commands/check_command.rb'
16
+ - 'lib/png_conform/services/chunk_processor.rb'
17
+ - 'lib/png_conform/services/profile_manager.rb'
18
+ - 'lib/png_conform/services/validator_pool.rb'
15
19
 
16
- # Offense count: 2
20
+ # Offense count: 4
17
21
  # This cop supports safe autocorrection (--autocorrect).
18
22
  # Configuration parameters: EnforcedStyleAlignWith.
19
23
  # SupportedStylesAlignWith: either, start_of_block, start_of_line
20
24
  Layout/BlockAlignment:
21
25
  Exclude:
22
- - 'lib/png_conform/models/file_analysis.rb'
23
- - 'lib/png_conform/services/validation_service.rb'
26
+ - 'lib/png_conform/analyzers/comparison_analyzer.rb'
27
+ - 'lib/png_conform/analyzers/optimization_analyzer.rb'
28
+ - 'lib/png_conform/services/file_signature.rb'
29
+ - 'lib/png_conform/services/lru_cache.rb'
24
30
 
25
- # Offense count: 2
31
+ # Offense count: 4
26
32
  # This cop supports safe autocorrection (--autocorrect).
27
33
  Layout/BlockEndNewline:
28
34
  Exclude:
29
- - 'lib/png_conform/models/file_analysis.rb'
30
- - 'lib/png_conform/services/validation_service.rb'
35
+ - 'lib/png_conform/analyzers/comparison_analyzer.rb'
36
+ - 'lib/png_conform/analyzers/optimization_analyzer.rb'
37
+ - 'lib/png_conform/services/file_signature.rb'
38
+ - 'lib/png_conform/services/lru_cache.rb'
31
39
 
32
- # Offense count: 4
40
+ # Offense count: 1
41
+ # This cop supports safe autocorrection (--autocorrect).
42
+ Layout/ElseAlignment:
43
+ Exclude:
44
+ - 'lib/png_conform/services/validation_cache.rb'
45
+
46
+ # Offense count: 1
47
+ # This cop supports safe autocorrection (--autocorrect).
48
+ # Configuration parameters: EnforcedStyleAlignWith, Severity.
49
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
50
+ Layout/EndAlignment:
51
+ Exclude:
52
+ - 'lib/png_conform/services/validation_cache.rb'
53
+
54
+ # Offense count: 2
55
+ # This cop supports safe autocorrection (--autocorrect).
56
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
57
+ # SupportedHashRocketStyles: key, separator, table
58
+ # SupportedColonStyles: key, separator, table
59
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
60
+ Layout/HashAlignment:
61
+ Exclude:
62
+ - 'lib/png_conform/services/validator_pool.rb'
63
+
64
+ # Offense count: 10
33
65
  # This cop supports safe autocorrection (--autocorrect).
34
66
  # Configuration parameters: Width, AllowedPatterns.
35
67
  Layout/IndentationWidth:
36
68
  Exclude:
37
- - 'lib/png_conform/models/file_analysis.rb'
38
- - 'lib/png_conform/services/validation_service.rb'
69
+ - 'lib/png_conform/analyzers/comparison_analyzer.rb'
70
+ - 'lib/png_conform/analyzers/optimization_analyzer.rb'
71
+ - 'lib/png_conform/services/file_signature.rb'
72
+ - 'lib/png_conform/services/lru_cache.rb'
73
+ - 'lib/png_conform/services/validation_cache.rb'
39
74
 
40
- # Offense count: 194
75
+ # Offense count: 267
41
76
  # This cop supports safe autocorrection (--autocorrect).
42
77
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
43
78
  # URISchemes: http, https
44
79
  Layout/LineLength:
45
80
  Enabled: false
46
81
 
47
- # Offense count: 1
82
+ # Offense count: 3
48
83
  # This cop supports safe autocorrection (--autocorrect).
49
84
  # Configuration parameters: AllowInHeredoc.
50
85
  Layout/TrailingWhitespace:
51
86
  Exclude:
52
- - 'lib/png_conform/models/file_analysis.rb'
87
+ - 'lib/png_conform/commands/check_command.rb'
88
+ - 'lib/png_conform/services/profile_manager.rb'
89
+ - 'lib/png_conform/services/validator_pool.rb'
53
90
 
54
91
  # Offense count: 1
55
92
  Lint/BinaryOperatorWithIdenticalOperands:
@@ -65,29 +102,32 @@ Lint/DuplicateBranch:
65
102
  - 'lib/png_conform/validators/ancillary/sbit_validator.rb'
66
103
  - 'spec/pngsuite/helpers/semantic_validator.rb'
67
104
 
68
- # Offense count: 1
69
- # This cop supports safe autocorrection (--autocorrect).
70
- Lint/UselessAssignment:
105
+ # Offense count: 4
106
+ # Configuration parameters: AllowedParentClasses.
107
+ Lint/MissingSuper:
71
108
  Exclude:
72
- - 'examples/advanced_usage.rb'
109
+ - 'lib/png_conform/pipelines/stages/analysis_stage.rb'
110
+ - 'lib/png_conform/pipelines/stages/chunk_validation_stage.rb'
111
+ - 'lib/png_conform/pipelines/stages/sequence_validation_stage.rb'
112
+ - 'lib/png_conform/pipelines/stages/signature_validation_stage.rb'
73
113
 
74
- # Offense count: 99
114
+ # Offense count: 124
75
115
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
76
116
  Metrics/AbcSize:
77
117
  Enabled: false
78
118
 
79
- # Offense count: 2
119
+ # Offense count: 4
80
120
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
81
121
  # AllowedMethods: refine
82
122
  Metrics/BlockLength:
83
123
  Max: 52
84
124
 
85
- # Offense count: 55
125
+ # Offense count: 62
86
126
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
87
127
  Metrics/CyclomaticComplexity:
88
128
  Enabled: false
89
129
 
90
- # Offense count: 146
130
+ # Offense count: 193
91
131
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
92
132
  Metrics/MethodLength:
93
133
  Max: 66
@@ -97,7 +137,7 @@ Metrics/MethodLength:
97
137
  Metrics/ParameterLists:
98
138
  Max: 10
99
139
 
100
- # Offense count: 42
140
+ # Offense count: 41
101
141
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
102
142
  Metrics/PerceivedComplexity:
103
143
  Enabled: false
@@ -110,25 +150,24 @@ Naming/VariableNumber:
110
150
  Exclude:
111
151
  - 'lib/png_conform/validators/critical/plte_validator.rb'
112
152
 
113
- # Offense count: 10
153
+ # Offense count: 1
114
154
  # Configuration parameters: MinSize.
115
155
  Performance/CollectionLiteralInLoop:
116
156
  Exclude:
117
157
  - 'examples/advanced_usage.rb'
118
- - 'lib/png_conform/validators/chunk_registry.rb'
119
158
 
120
- # Offense count: 68
159
+ # Offense count: 70
121
160
  # Configuration parameters: Prefixes, AllowedPatterns.
122
161
  # Prefixes: when, with, without
123
162
  RSpec/ContextWording:
124
163
  Enabled: false
125
164
 
126
- # Offense count: 19
165
+ # Offense count: 20
127
166
  # Configuration parameters: IgnoredMetadata.
128
167
  RSpec/DescribeClass:
129
168
  Enabled: false
130
169
 
131
- # Offense count: 294
170
+ # Offense count: 304
132
171
  # Configuration parameters: CountAsOne.
133
172
  RSpec/ExampleLength:
134
173
  Max: 19
@@ -138,7 +177,7 @@ RSpec/MultipleDescribes:
138
177
  Exclude:
139
178
  - 'spec/png_conform/validators/base_validator_spec.rb'
140
179
 
141
- # Offense count: 363
180
+ # Offense count: 378
142
181
  RSpec/MultipleExpectations:
143
182
  Max: 10
144
183
 
@@ -159,7 +198,7 @@ RSpec/SpecFilePathFormat:
159
198
  RSpec/VerifiedDoubles:
160
199
  Enabled: false
161
200
 
162
- # Offense count: 2
201
+ # Offense count: 4
163
202
  # This cop supports safe autocorrection (--autocorrect).
164
203
  # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
165
204
  # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
@@ -168,10 +207,12 @@ RSpec/VerifiedDoubles:
168
207
  # AllowedMethods: lambda, proc, it
169
208
  Style/BlockDelimiters:
170
209
  Exclude:
171
- - 'lib/png_conform/models/file_analysis.rb'
172
- - 'lib/png_conform/services/validation_service.rb'
210
+ - 'lib/png_conform/analyzers/comparison_analyzer.rb'
211
+ - 'lib/png_conform/analyzers/optimization_analyzer.rb'
212
+ - 'lib/png_conform/services/file_signature.rb'
213
+ - 'lib/png_conform/services/lru_cache.rb'
173
214
 
174
- # Offense count: 31
215
+ # Offense count: 41
175
216
  # This cop supports safe autocorrection (--autocorrect).
176
217
  # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
177
218
  # SupportedStyles: annotated, template, unannotated
@@ -185,13 +226,12 @@ Style/MissingRespondToMissing:
185
226
 
186
227
  # Offense count: 1
187
228
  # This cop supports safe autocorrection (--autocorrect).
188
- Style/MultilineIfModifier:
229
+ Style/MultilineTernaryOperator:
189
230
  Exclude:
190
- - 'lib/png_conform/models/file_analysis.rb'
231
+ - 'lib/png_conform/services/validation_cache.rb'
191
232
 
192
233
  # Offense count: 2
193
- # This cop supports unsafe autocorrection (--autocorrect-all).
194
- Style/SlicingWithRange:
234
+ # This cop supports safe autocorrection (--autocorrect).
235
+ Style/RedundantParentheses:
195
236
  Exclude:
196
- - 'examples/advanced_usage.rb'
197
- - 'examples/basic_usage.rb'
237
+ - 'lib/png_conform/services/validation_cache.rb'
data/Gemfile CHANGED
@@ -5,9 +5,11 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in png_conform.gemspec
6
6
  gemspec
7
7
 
8
+ gem "openssl", "~> 3.0"
8
9
  gem "rake"
9
10
  gem "rspec"
10
11
  gem "rubocop"
11
12
  gem "rubocop-performance"
12
13
  gem "rubocop-rake"
13
14
  gem "rubocop-rspec"
15
+ gem "ruby-prof"
data/README.adoc CHANGED
@@ -16,8 +16,9 @@ extensibility and maintainability.
16
16
 
17
17
  == Features
18
18
 
19
- * *46 Chunk Validators*: Complete validation of PNG (24), APNG (3), MNG (16), and JNG (3) chunks
19
+ * *47 Chunk Validators*: Complete validation of PNG (24), APNG (3), MNG (16), JNG (3), and Apple extensions (1) chunks
20
20
  * *PNG 3rd Edition Support*: Includes cICP and mDCv chunks for HDR content
21
+ * *Apple Extensions Support*: Includes iDOT chunk for macOS/iOS display optimization
21
22
  * *MNG/JNG Support*: Full Multiple-image Network Graphics and JPEG Network Graphics validation
22
23
  * *CRC Validation*: CRC-32 checksum verification for all chunks with detailed error reporting
23
24
  * *Chunk Ordering*: Validates proper chunk sequence and dependencies
@@ -35,7 +36,7 @@ extensibility and maintainability.
35
36
  * *Multiple Output Modes*: Summary, verbose, very verbose, quiet, with optional palette/text/color output
36
37
  * *Clean Architecture*: Layered OO design following MECE principles
37
38
  * *CLI Interface*: Thor-based command-line tool with pngcheck-compatible options plus modern analysis features
38
- * *Comprehensive Testing*: Extensive RSpec test suite (936 examples, 100% passing)
39
+ * *Comprehensive Testing*: Extensive RSpec test suite (954 examples, 100% passing)
39
40
 
40
41
  == Architecture
41
42