png_conform 0.1.0
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.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +19 -0
- data/.rubocop_todo.yml +197 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/CONTRIBUTING.md +323 -0
- data/Gemfile +13 -0
- data/LICENSE +43 -0
- data/README.adoc +859 -0
- data/Rakefile +10 -0
- data/SECURITY.md +147 -0
- data/docs/ARCHITECTURE.adoc +681 -0
- data/docs/CHUNK_TYPES.adoc +450 -0
- data/docs/CLI_OPTIONS.adoc +913 -0
- data/docs/COMPATIBILITY.adoc +616 -0
- data/examples/README.adoc +398 -0
- data/examples/advanced_usage.rb +304 -0
- data/examples/basic_usage.rb +210 -0
- data/exe/png_conform +6 -0
- data/lib/png_conform/analyzers/comparison_analyzer.rb +230 -0
- data/lib/png_conform/analyzers/metrics_analyzer.rb +176 -0
- data/lib/png_conform/analyzers/optimization_analyzer.rb +190 -0
- data/lib/png_conform/analyzers/resolution_analyzer.rb +274 -0
- data/lib/png_conform/bindata/chunk_structure.rb +153 -0
- data/lib/png_conform/bindata/jng_file.rb +79 -0
- data/lib/png_conform/bindata/mng_file.rb +97 -0
- data/lib/png_conform/bindata/png_file.rb +162 -0
- data/lib/png_conform/cli.rb +116 -0
- data/lib/png_conform/commands/check_command.rb +323 -0
- data/lib/png_conform/commands/list_command.rb +67 -0
- data/lib/png_conform/models/chunk.rb +84 -0
- data/lib/png_conform/models/chunk_info.rb +71 -0
- data/lib/png_conform/models/compression_info.rb +49 -0
- data/lib/png_conform/models/decoded_chunk_data.rb +143 -0
- data/lib/png_conform/models/file_analysis.rb +181 -0
- data/lib/png_conform/models/file_info.rb +91 -0
- data/lib/png_conform/models/image_info.rb +52 -0
- data/lib/png_conform/models/validation_error.rb +89 -0
- data/lib/png_conform/models/validation_result.rb +137 -0
- data/lib/png_conform/readers/full_load_reader.rb +113 -0
- data/lib/png_conform/readers/streaming_reader.rb +180 -0
- data/lib/png_conform/reporters/base_reporter.rb +53 -0
- data/lib/png_conform/reporters/color_reporter.rb +65 -0
- data/lib/png_conform/reporters/json_reporter.rb +18 -0
- data/lib/png_conform/reporters/palette_reporter.rb +48 -0
- data/lib/png_conform/reporters/quiet_reporter.rb +18 -0
- data/lib/png_conform/reporters/reporter_factory.rb +108 -0
- data/lib/png_conform/reporters/summary_reporter.rb +65 -0
- data/lib/png_conform/reporters/text_reporter.rb +66 -0
- data/lib/png_conform/reporters/verbose_reporter.rb +87 -0
- data/lib/png_conform/reporters/very_verbose_reporter.rb +33 -0
- data/lib/png_conform/reporters/visual_elements.rb +66 -0
- data/lib/png_conform/reporters/yaml_reporter.rb +18 -0
- data/lib/png_conform/services/profile_manager.rb +242 -0
- data/lib/png_conform/services/validation_service.rb +457 -0
- data/lib/png_conform/services/zlib_validator.rb +270 -0
- data/lib/png_conform/validators/ancillary/bkgd_validator.rb +140 -0
- data/lib/png_conform/validators/ancillary/chrm_validator.rb +178 -0
- data/lib/png_conform/validators/ancillary/cicp_validator.rb +202 -0
- data/lib/png_conform/validators/ancillary/gama_validator.rb +105 -0
- data/lib/png_conform/validators/ancillary/hist_validator.rb +147 -0
- data/lib/png_conform/validators/ancillary/iccp_validator.rb +243 -0
- data/lib/png_conform/validators/ancillary/itxt_validator.rb +280 -0
- data/lib/png_conform/validators/ancillary/mdcv_validator.rb +201 -0
- data/lib/png_conform/validators/ancillary/offs_validator.rb +132 -0
- data/lib/png_conform/validators/ancillary/pcal_validator.rb +289 -0
- data/lib/png_conform/validators/ancillary/phys_validator.rb +107 -0
- data/lib/png_conform/validators/ancillary/sbit_validator.rb +176 -0
- data/lib/png_conform/validators/ancillary/scal_validator.rb +180 -0
- data/lib/png_conform/validators/ancillary/splt_validator.rb +223 -0
- data/lib/png_conform/validators/ancillary/srgb_validator.rb +117 -0
- data/lib/png_conform/validators/ancillary/ster_validator.rb +111 -0
- data/lib/png_conform/validators/ancillary/text_validator.rb +129 -0
- data/lib/png_conform/validators/ancillary/time_validator.rb +132 -0
- data/lib/png_conform/validators/ancillary/trns_validator.rb +154 -0
- data/lib/png_conform/validators/ancillary/ztxt_validator.rb +173 -0
- data/lib/png_conform/validators/apng/actl_validator.rb +81 -0
- data/lib/png_conform/validators/apng/fctl_validator.rb +155 -0
- data/lib/png_conform/validators/apng/fdat_validator.rb +117 -0
- data/lib/png_conform/validators/base_validator.rb +241 -0
- data/lib/png_conform/validators/chunk_registry.rb +219 -0
- data/lib/png_conform/validators/critical/idat_validator.rb +77 -0
- data/lib/png_conform/validators/critical/iend_validator.rb +68 -0
- data/lib/png_conform/validators/critical/ihdr_validator.rb +160 -0
- data/lib/png_conform/validators/critical/plte_validator.rb +120 -0
- data/lib/png_conform/validators/jng/jdat_validator.rb +66 -0
- data/lib/png_conform/validators/jng/jhdr_validator.rb +116 -0
- data/lib/png_conform/validators/jng/jsep_validator.rb +66 -0
- data/lib/png_conform/validators/mng/back_validator.rb +87 -0
- data/lib/png_conform/validators/mng/clip_validator.rb +65 -0
- data/lib/png_conform/validators/mng/clon_validator.rb +45 -0
- data/lib/png_conform/validators/mng/defi_validator.rb +104 -0
- data/lib/png_conform/validators/mng/dhdr_validator.rb +104 -0
- data/lib/png_conform/validators/mng/disc_validator.rb +44 -0
- data/lib/png_conform/validators/mng/endl_validator.rb +65 -0
- data/lib/png_conform/validators/mng/fram_validator.rb +91 -0
- data/lib/png_conform/validators/mng/loop_validator.rb +75 -0
- data/lib/png_conform/validators/mng/mend_validator.rb +31 -0
- data/lib/png_conform/validators/mng/mhdr_validator.rb +69 -0
- data/lib/png_conform/validators/mng/move_validator.rb +61 -0
- data/lib/png_conform/validators/mng/save_validator.rb +39 -0
- data/lib/png_conform/validators/mng/seek_validator.rb +42 -0
- data/lib/png_conform/validators/mng/show_validator.rb +52 -0
- data/lib/png_conform/validators/mng/term_validator.rb +84 -0
- data/lib/png_conform/version.rb +5 -0
- data/lib/png_conform.rb +101 -0
- data/png_conform.gemspec +43 -0
- metadata +201 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f04021d7929787c975ea7a73dd7265754a6e33ed54bf27ecd85221dd820104c9
|
|
4
|
+
data.tar.gz: 4435b4bbb7419ab1f94e37210f19a3ba9fb8fb929578aa56dc28b2cc9b5782e9
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: bf874e6d45f148881ee330c67be8f0ec835ad6b7c0effc7406ae4e1e1c8ad2e6973f065a28fad08c46cb334c64614cf81419f4b228ade34739bfaff792143f42
|
|
7
|
+
data.tar.gz: 59f6957a6629e0b88c3a1a6b2a2e7950cdac2c851fa37748d3ddb781d6a74ef898a9da0f5b2195373433a2b5f6c32825c7a5ca5b9e3a92813cd77cef3df7dc5b
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
inherit_from:
|
|
4
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
|
|
5
|
+
- .rubocop_todo.yml
|
|
6
|
+
|
|
7
|
+
inherit_mode:
|
|
8
|
+
merge:
|
|
9
|
+
- Exclude
|
|
10
|
+
|
|
11
|
+
# local repo-specific modifications
|
|
12
|
+
# ...
|
|
13
|
+
plugins:
|
|
14
|
+
- rubocop-rspec
|
|
15
|
+
- rubocop-performance
|
|
16
|
+
- rubocop-rake
|
|
17
|
+
|
|
18
|
+
AllCops:
|
|
19
|
+
TargetRubyVersion: 3.0
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2025-11-17 11:51:04 UTC using RuboCop version 1.81.1.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 1
|
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
+
# Configuration parameters: IndentationWidth.
|
|
12
|
+
Layout/AssignmentIndentation:
|
|
13
|
+
Exclude:
|
|
14
|
+
- 'lib/png_conform/models/file_analysis.rb'
|
|
15
|
+
|
|
16
|
+
# Offense count: 2
|
|
17
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
18
|
+
# Configuration parameters: EnforcedStyleAlignWith.
|
|
19
|
+
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
20
|
+
Layout/BlockAlignment:
|
|
21
|
+
Exclude:
|
|
22
|
+
- 'lib/png_conform/models/file_analysis.rb'
|
|
23
|
+
- 'lib/png_conform/services/validation_service.rb'
|
|
24
|
+
|
|
25
|
+
# Offense count: 2
|
|
26
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
27
|
+
Layout/BlockEndNewline:
|
|
28
|
+
Exclude:
|
|
29
|
+
- 'lib/png_conform/models/file_analysis.rb'
|
|
30
|
+
- 'lib/png_conform/services/validation_service.rb'
|
|
31
|
+
|
|
32
|
+
# Offense count: 4
|
|
33
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
34
|
+
# Configuration parameters: Width, AllowedPatterns.
|
|
35
|
+
Layout/IndentationWidth:
|
|
36
|
+
Exclude:
|
|
37
|
+
- 'lib/png_conform/models/file_analysis.rb'
|
|
38
|
+
- 'lib/png_conform/services/validation_service.rb'
|
|
39
|
+
|
|
40
|
+
# Offense count: 194
|
|
41
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
42
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
|
43
|
+
# URISchemes: http, https
|
|
44
|
+
Layout/LineLength:
|
|
45
|
+
Enabled: false
|
|
46
|
+
|
|
47
|
+
# Offense count: 1
|
|
48
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
49
|
+
# Configuration parameters: AllowInHeredoc.
|
|
50
|
+
Layout/TrailingWhitespace:
|
|
51
|
+
Exclude:
|
|
52
|
+
- 'lib/png_conform/models/file_analysis.rb'
|
|
53
|
+
|
|
54
|
+
# Offense count: 1
|
|
55
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
|
56
|
+
Exclude:
|
|
57
|
+
- 'lib/png_conform/validators/ancillary/itxt_validator.rb'
|
|
58
|
+
|
|
59
|
+
# Offense count: 7
|
|
60
|
+
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
61
|
+
Lint/DuplicateBranch:
|
|
62
|
+
Exclude:
|
|
63
|
+
- 'lib/png_conform/reporters/reporter_factory.rb'
|
|
64
|
+
- 'lib/png_conform/services/zlib_validator.rb'
|
|
65
|
+
- 'lib/png_conform/validators/ancillary/sbit_validator.rb'
|
|
66
|
+
- 'spec/pngsuite/helpers/semantic_validator.rb'
|
|
67
|
+
|
|
68
|
+
# Offense count: 1
|
|
69
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
70
|
+
Lint/UselessAssignment:
|
|
71
|
+
Exclude:
|
|
72
|
+
- 'examples/advanced_usage.rb'
|
|
73
|
+
|
|
74
|
+
# Offense count: 99
|
|
75
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
76
|
+
Metrics/AbcSize:
|
|
77
|
+
Enabled: false
|
|
78
|
+
|
|
79
|
+
# Offense count: 2
|
|
80
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
|
|
81
|
+
# AllowedMethods: refine
|
|
82
|
+
Metrics/BlockLength:
|
|
83
|
+
Max: 52
|
|
84
|
+
|
|
85
|
+
# Offense count: 55
|
|
86
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
87
|
+
Metrics/CyclomaticComplexity:
|
|
88
|
+
Enabled: false
|
|
89
|
+
|
|
90
|
+
# Offense count: 146
|
|
91
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
92
|
+
Metrics/MethodLength:
|
|
93
|
+
Max: 66
|
|
94
|
+
|
|
95
|
+
# Offense count: 3
|
|
96
|
+
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
97
|
+
Metrics/ParameterLists:
|
|
98
|
+
Max: 10
|
|
99
|
+
|
|
100
|
+
# Offense count: 42
|
|
101
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
102
|
+
Metrics/PerceivedComplexity:
|
|
103
|
+
Enabled: false
|
|
104
|
+
|
|
105
|
+
# Offense count: 1
|
|
106
|
+
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
|
107
|
+
# SupportedStyles: snake_case, normalcase, non_integer
|
|
108
|
+
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
|
109
|
+
Naming/VariableNumber:
|
|
110
|
+
Exclude:
|
|
111
|
+
- 'lib/png_conform/validators/critical/plte_validator.rb'
|
|
112
|
+
|
|
113
|
+
# Offense count: 10
|
|
114
|
+
# Configuration parameters: MinSize.
|
|
115
|
+
Performance/CollectionLiteralInLoop:
|
|
116
|
+
Exclude:
|
|
117
|
+
- 'examples/advanced_usage.rb'
|
|
118
|
+
- 'lib/png_conform/validators/chunk_registry.rb'
|
|
119
|
+
|
|
120
|
+
# Offense count: 68
|
|
121
|
+
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
122
|
+
# Prefixes: when, with, without
|
|
123
|
+
RSpec/ContextWording:
|
|
124
|
+
Enabled: false
|
|
125
|
+
|
|
126
|
+
# Offense count: 19
|
|
127
|
+
# Configuration parameters: IgnoredMetadata.
|
|
128
|
+
RSpec/DescribeClass:
|
|
129
|
+
Enabled: false
|
|
130
|
+
|
|
131
|
+
# Offense count: 294
|
|
132
|
+
# Configuration parameters: CountAsOne.
|
|
133
|
+
RSpec/ExampleLength:
|
|
134
|
+
Max: 19
|
|
135
|
+
|
|
136
|
+
# Offense count: 1
|
|
137
|
+
RSpec/MultipleDescribes:
|
|
138
|
+
Exclude:
|
|
139
|
+
- 'spec/png_conform/validators/base_validator_spec.rb'
|
|
140
|
+
|
|
141
|
+
# Offense count: 363
|
|
142
|
+
RSpec/MultipleExpectations:
|
|
143
|
+
Max: 10
|
|
144
|
+
|
|
145
|
+
# Offense count: 1
|
|
146
|
+
# Configuration parameters: AllowSubject.
|
|
147
|
+
RSpec/MultipleMemoizedHelpers:
|
|
148
|
+
Max: 6
|
|
149
|
+
|
|
150
|
+
# Offense count: 2
|
|
151
|
+
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata.
|
|
152
|
+
RSpec/SpecFilePathFormat:
|
|
153
|
+
Exclude:
|
|
154
|
+
- 'spec/png_conform/bindata/chunk_structure_spec.rb'
|
|
155
|
+
- 'spec/png_conform/bindata/png_file_spec.rb'
|
|
156
|
+
|
|
157
|
+
# Offense count: 45
|
|
158
|
+
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
|
159
|
+
RSpec/VerifiedDoubles:
|
|
160
|
+
Enabled: false
|
|
161
|
+
|
|
162
|
+
# Offense count: 2
|
|
163
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
164
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
|
165
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
|
166
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
|
167
|
+
# FunctionalMethods: let, let!, subject, watch
|
|
168
|
+
# AllowedMethods: lambda, proc, it
|
|
169
|
+
Style/BlockDelimiters:
|
|
170
|
+
Exclude:
|
|
171
|
+
- 'lib/png_conform/models/file_analysis.rb'
|
|
172
|
+
- 'lib/png_conform/services/validation_service.rb'
|
|
173
|
+
|
|
174
|
+
# Offense count: 31
|
|
175
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
176
|
+
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
|
|
177
|
+
# SupportedStyles: annotated, template, unannotated
|
|
178
|
+
Style/FormatStringToken:
|
|
179
|
+
EnforcedStyle: unannotated
|
|
180
|
+
|
|
181
|
+
# Offense count: 1
|
|
182
|
+
Style/MissingRespondToMissing:
|
|
183
|
+
Exclude:
|
|
184
|
+
- 'lib/png_conform/cli.rb'
|
|
185
|
+
|
|
186
|
+
# Offense count: 1
|
|
187
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
188
|
+
Style/MultilineIfModifier:
|
|
189
|
+
Exclude:
|
|
190
|
+
- 'lib/png_conform/models/file_analysis.rb'
|
|
191
|
+
|
|
192
|
+
# Offense count: 2
|
|
193
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
194
|
+
Style/SlicingWithRange:
|
|
195
|
+
Exclude:
|
|
196
|
+
- 'examples/advanced_usage.rb'
|
|
197
|
+
- 'examples/basic_usage.rb'
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
+
|
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
22
|
+
advances of any kind
|
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
+
* Public or private harassment
|
|
25
|
+
* Publishing others' private information, such as a physical or email
|
|
26
|
+
address, without their explicit permission
|
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
28
|
+
professional setting
|
|
29
|
+
|
|
30
|
+
## Enforcement Responsibilities
|
|
31
|
+
|
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
33
|
+
|
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
35
|
+
|
|
36
|
+
## Scope
|
|
37
|
+
|
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
39
|
+
|
|
40
|
+
## Enforcement
|
|
41
|
+
|
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at ronald.tse@ribose.com. All complaints will be reviewed and investigated promptly and fairly.
|
|
43
|
+
|
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
45
|
+
|
|
46
|
+
## Enforcement Guidelines
|
|
47
|
+
|
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
49
|
+
|
|
50
|
+
### 1. Correction
|
|
51
|
+
|
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
53
|
+
|
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
55
|
+
|
|
56
|
+
### 2. Warning
|
|
57
|
+
|
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
59
|
+
|
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
61
|
+
|
|
62
|
+
### 3. Temporary Ban
|
|
63
|
+
|
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
65
|
+
|
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
67
|
+
|
|
68
|
+
### 4. Permanent Ban
|
|
69
|
+
|
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
71
|
+
|
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
73
|
+
|
|
74
|
+
## Attribution
|
|
75
|
+
|
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
78
|
+
|
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
|
80
|
+
|
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
|
82
|
+
|
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# Contributing to PngConform
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to PngConform! This document provides guidelines and instructions for contributing to the project.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Code of Conduct](#code-of-conduct)
|
|
8
|
+
- [Getting Started](#getting-started)
|
|
9
|
+
- [Development Setup](#development-setup)
|
|
10
|
+
- [Making Changes](#making-changes)
|
|
11
|
+
- [Testing](#testing)
|
|
12
|
+
- [Code Style](#code-style)
|
|
13
|
+
- [Submitting Changes](#submitting-changes)
|
|
14
|
+
- [Reporting Issues](#reporting-issues)
|
|
15
|
+
|
|
16
|
+
## Code of Conduct
|
|
17
|
+
|
|
18
|
+
This project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
|
|
19
|
+
|
|
20
|
+
## Getting Started
|
|
21
|
+
|
|
22
|
+
1. Fork the repository on GitHub
|
|
23
|
+
2. Clone your fork locally
|
|
24
|
+
3. Set up your development environment
|
|
25
|
+
4. Create a topic branch for your changes
|
|
26
|
+
5. Make your changes
|
|
27
|
+
6. Test your changes
|
|
28
|
+
7. Submit a pull request
|
|
29
|
+
|
|
30
|
+
## Development Setup
|
|
31
|
+
|
|
32
|
+
### Prerequisites
|
|
33
|
+
|
|
34
|
+
- Ruby 3.0 or higher
|
|
35
|
+
- Bundler gem
|
|
36
|
+
|
|
37
|
+
### Setup Steps
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Clone your fork
|
|
41
|
+
git clone https://github.com/YOUR_USERNAME/png_conform.git
|
|
42
|
+
cd png_conform
|
|
43
|
+
|
|
44
|
+
# Install dependencies
|
|
45
|
+
bundle install
|
|
46
|
+
|
|
47
|
+
# Run tests to verify setup
|
|
48
|
+
bundle exec rake spec
|
|
49
|
+
|
|
50
|
+
# Run linter
|
|
51
|
+
bundle exec rubocop
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Making Changes
|
|
55
|
+
|
|
56
|
+
### Architecture Principles
|
|
57
|
+
|
|
58
|
+
PngConform follows strict architectural principles:
|
|
59
|
+
|
|
60
|
+
1. **Object-Oriented Design**: Use proper encapsulation, inheritance, and polymorphism
|
|
61
|
+
2. **MECE (Mutually Exclusive, Collectively Exhaustive)**: Each component should have exactly one responsibility
|
|
62
|
+
3. **Separation of Concerns**: Maintain clear boundaries between layers
|
|
63
|
+
4. **Model-Driven**: Prioritize model-to-model interaction over procedural code
|
|
64
|
+
|
|
65
|
+
### Directory Structure
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
lib/png_conform/
|
|
69
|
+
├── bindata/ # Binary parsing structures (BinData)
|
|
70
|
+
├── models/ # Domain models (Lutaml::Model)
|
|
71
|
+
├── validators/ # Validation logic
|
|
72
|
+
│ ├── critical/ # PNG critical chunks
|
|
73
|
+
│ ├── ancillary/ # PNG ancillary chunks
|
|
74
|
+
│ ├── apng/ # APNG chunks
|
|
75
|
+
│ ├── mng/ # MNG chunks
|
|
76
|
+
│ └── jng/ # JNG chunks
|
|
77
|
+
├── services/ # Orchestration and business logic
|
|
78
|
+
├── readers/ # File reading strategies
|
|
79
|
+
├── reporters/ # Output formatting
|
|
80
|
+
└── commands/ # CLI commands
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Adding a New Chunk Validator
|
|
84
|
+
|
|
85
|
+
1. Create the validator class in the appropriate directory:
|
|
86
|
+
```ruby
|
|
87
|
+
# lib/png_conform/validators/ancillary/example_validator.rb
|
|
88
|
+
module PngConform
|
|
89
|
+
module Validators
|
|
90
|
+
module Ancillary
|
|
91
|
+
class ExampleValidator < BaseValidator
|
|
92
|
+
def validate
|
|
93
|
+
# Validation logic here
|
|
94
|
+
check_length(expected_length)
|
|
95
|
+
check_crc
|
|
96
|
+
# Add errors/warnings/info as needed
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
2. Register the validator in `lib/png_conform/validators/chunk_registry.rb`:
|
|
105
|
+
```ruby
|
|
106
|
+
register("eXmP", Ancillary::ExampleValidator)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
3. Add the require statement in `lib/png_conform.rb`:
|
|
110
|
+
```ruby
|
|
111
|
+
require_relative "png_conform/validators/ancillary/example_validator"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
4. Write comprehensive tests in `spec/png_conform/validators/ancillary/example_validator_spec.rb`
|
|
115
|
+
|
|
116
|
+
### Adding a New Validation Profile
|
|
117
|
+
|
|
118
|
+
1. Add profile definition in `lib/png_conform/services/profile_manager.rb`:
|
|
119
|
+
```ruby
|
|
120
|
+
def example_profile
|
|
121
|
+
Profile.new(
|
|
122
|
+
name: "example",
|
|
123
|
+
description: "Example profile for specific use case",
|
|
124
|
+
required_chunks: %w[IHDR IDAT IEND],
|
|
125
|
+
optional_chunks: %w[...],
|
|
126
|
+
prohibited_chunks: %w[...]
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
2. Update documentation in `README.adoc`
|
|
132
|
+
|
|
133
|
+
3. Add tests for the new profile
|
|
134
|
+
|
|
135
|
+
## Testing
|
|
136
|
+
|
|
137
|
+
### Running Tests
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Run all tests
|
|
141
|
+
bundle exec rake spec
|
|
142
|
+
|
|
143
|
+
# Run specific test file
|
|
144
|
+
bundle exec rspec spec/path/to/spec_file.rb
|
|
145
|
+
|
|
146
|
+
# Run tests with coverage (if configured)
|
|
147
|
+
COVERAGE=true bundle exec rake spec
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Writing Tests
|
|
151
|
+
|
|
152
|
+
Follow these principles:
|
|
153
|
+
|
|
154
|
+
1. **One Test, One Behavior**: Each test should validate exactly one behavior
|
|
155
|
+
2. **Descriptive Names**: Use clear, descriptive test names
|
|
156
|
+
3. **Arrange-Act-Assert**: Structure tests with clear setup, execution, and assertion phases
|
|
157
|
+
4. **Use Doubles**: Prefer test doubles over real objects for isolation
|
|
158
|
+
5. **No Mocks for Models**: Don't mock domain model classes
|
|
159
|
+
|
|
160
|
+
Example test structure:
|
|
161
|
+
|
|
162
|
+
```ruby
|
|
163
|
+
RSpec.describe PngConform::Validators::Ancillary::ExampleValidator do
|
|
164
|
+
describe "#validate" do
|
|
165
|
+
let(:chunk) { create_chunk("eXmP", data) }
|
|
166
|
+
let(:context) { PngConform::Validators::ValidationContext.new }
|
|
167
|
+
subject(:validator) { described_class.new(chunk, context) }
|
|
168
|
+
|
|
169
|
+
context "with valid data" do
|
|
170
|
+
let(:data) { "\x00\x01\x02\x03" }
|
|
171
|
+
|
|
172
|
+
it "does not add errors" do
|
|
173
|
+
validator.validate
|
|
174
|
+
expect(context.errors).to be_empty
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
context "with invalid length" do
|
|
179
|
+
let(:data) { "\x00\x01" }
|
|
180
|
+
|
|
181
|
+
it "adds length error" do
|
|
182
|
+
validator.validate
|
|
183
|
+
expect(context.errors).to include(
|
|
184
|
+
hash_including(message: /invalid length/)
|
|
185
|
+
)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Test Coverage Requirements
|
|
193
|
+
|
|
194
|
+
- All new code must have corresponding tests
|
|
195
|
+
- Aim for 100% coverage of new functionality
|
|
196
|
+
- Tests must pass on all supported Ruby versions (3.0, 3.1, 3.2, 3.3)
|
|
197
|
+
|
|
198
|
+
## Code Style
|
|
199
|
+
|
|
200
|
+
### RuboCop
|
|
201
|
+
|
|
202
|
+
All code must pass RuboCop checks:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
bundle exec rubocop
|
|
206
|
+
|
|
207
|
+
# Auto-fix issues where possible
|
|
208
|
+
bundle exec rubocop -A
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Ruby Style Guidelines
|
|
212
|
+
|
|
213
|
+
1. **Frozen String Literals**: Always use `# frozen_string_literal: true`
|
|
214
|
+
2. **Line Length**: Maximum 80 characters (exceptions allowed for readability)
|
|
215
|
+
3. **Method Length**: Keep methods focused and under 50 lines
|
|
216
|
+
4. **Class Length**: Keep classes under 700 lines (refactor if larger)
|
|
217
|
+
5. **No Hardcoding**: Use constants, configuration, or model properties
|
|
218
|
+
|
|
219
|
+
### Documentation
|
|
220
|
+
|
|
221
|
+
1. Use YARD-style comments for public APIs
|
|
222
|
+
2. Include examples in documentation
|
|
223
|
+
3. Update README.adoc for user-facing features
|
|
224
|
+
4. Update ARCHITECTURE.md for design changes
|
|
225
|
+
|
|
226
|
+
## Submitting Changes
|
|
227
|
+
|
|
228
|
+
### Pull Request Process
|
|
229
|
+
|
|
230
|
+
1. **Update Documentation**: Ensure README, CHANGELOG, and inline docs are updated
|
|
231
|
+
2. **Write Tests**: All new features must have comprehensive tests
|
|
232
|
+
3. **Run Quality Checks**:
|
|
233
|
+
```bash
|
|
234
|
+
bundle exec rake spec # All tests must pass
|
|
235
|
+
bundle exec rubocop # 0 offenses required
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
4. **Commit Messages**: Use semantic commit messages:
|
|
239
|
+
```
|
|
240
|
+
feat(validators): add support for eXmP chunk
|
|
241
|
+
fix(cli): correct argument parsing for --profile option
|
|
242
|
+
docs(readme): update installation instructions
|
|
243
|
+
test(validators): add tests for edge cases
|
|
244
|
+
refactor(models): extract common validation logic
|
|
245
|
+
chore(deps): update bindata to 2.5.1
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
5. **Create Pull Request**:
|
|
249
|
+
- Provide clear description of changes
|
|
250
|
+
- Reference any related issues
|
|
251
|
+
- Include screenshots for UI changes
|
|
252
|
+
- Ensure CI passes
|
|
253
|
+
|
|
254
|
+
### Pull Request Template
|
|
255
|
+
|
|
256
|
+
```markdown
|
|
257
|
+
## Description
|
|
258
|
+
Brief description of changes
|
|
259
|
+
|
|
260
|
+
## Motivation and Context
|
|
261
|
+
Why is this change required? What problem does it solve?
|
|
262
|
+
|
|
263
|
+
## Type of Change
|
|
264
|
+
- [ ] Bug fix (non-breaking change fixing an issue)
|
|
265
|
+
- [ ] New feature (non-breaking change adding functionality)
|
|
266
|
+
- [ ] Breaking change (fix or feature causing existing functionality to change)
|
|
267
|
+
- [ ] Documentation update
|
|
268
|
+
|
|
269
|
+
## How Has This Been Tested?
|
|
270
|
+
Describe tests added or methodology used
|
|
271
|
+
|
|
272
|
+
## Checklist
|
|
273
|
+
- [ ] Code follows project style guidelines
|
|
274
|
+
- [ ] Self-review of code completed
|
|
275
|
+
- [ ] Code comments added where needed
|
|
276
|
+
- [ ] Documentation updated
|
|
277
|
+
- [ ] Tests added/updated
|
|
278
|
+
- [ ] All tests pass
|
|
279
|
+
- [ ] RuboCop passes with 0 offenses
|
|
280
|
+
- [ ] CHANGELOG.md updated
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Reporting Issues
|
|
284
|
+
|
|
285
|
+
### Bug Reports
|
|
286
|
+
|
|
287
|
+
When reporting bugs, please include:
|
|
288
|
+
|
|
289
|
+
1. **Ruby Version**: Output of `ruby -v`
|
|
290
|
+
2. **Gem Version**: Output of `png_conform version`
|
|
291
|
+
3. **Operating System**: OS and version
|
|
292
|
+
4. **Steps to Reproduce**: Minimal example to reproduce the issue
|
|
293
|
+
5. **Expected Behavior**: What you expected to happen
|
|
294
|
+
6. **Actual Behavior**: What actually happened
|
|
295
|
+
7. **Additional Context**: Any other relevant information
|
|
296
|
+
|
|
297
|
+
### Feature Requests
|
|
298
|
+
|
|
299
|
+
When requesting features, please include:
|
|
300
|
+
|
|
301
|
+
1. **Use Case**: Describe the problem this feature would solve
|
|
302
|
+
2. **Proposed Solution**: How you envision this feature working
|
|
303
|
+
3. **Alternatives**: Other approaches you've considered
|
|
304
|
+
4. **Additional Context**: Any other relevant information
|
|
305
|
+
|
|
306
|
+
## Development Resources
|
|
307
|
+
|
|
308
|
+
- [PNG Specification](https://www.w3.org/TR/PNG/)
|
|
309
|
+
- [MNG Specification](http://www.libpng.org/pub/mng/spec/)
|
|
310
|
+
- [APNG Specification](https://wiki.mozilla.org/APNG_Specification)
|
|
311
|
+
- [BinData Documentation](https://github.com/dmendel/bindata/wiki)
|
|
312
|
+
- [Lutaml Model Documentation](https://github.com/lutaml/lutaml-model)
|
|
313
|
+
- [Thor Documentation](http://whatisthor.com/)
|
|
314
|
+
|
|
315
|
+
## Questions?
|
|
316
|
+
|
|
317
|
+
If you have questions about contributing, please:
|
|
318
|
+
|
|
319
|
+
1. Check existing documentation (README, ARCHITECTURE)
|
|
320
|
+
2. Search existing issues and pull requests
|
|
321
|
+
3. Open a new issue with the "question" label
|
|
322
|
+
|
|
323
|
+
Thank you for contributing to PngConform!
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
BSD 2-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Ribose Inc.
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
17
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
18
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
20
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
21
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
22
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
23
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
24
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
25
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
This project is a Ruby port of pngcheck, which is:
|
|
30
|
+
|
|
31
|
+
Copyright 1995-2020 by Alexander Lehmann <lehmann@usa.net>,
|
|
32
|
+
Andreas Dilger <adilger@enel.ucalgary.ca>,
|
|
33
|
+
Glenn Randers-Pehrson <randeg@alum.rpi.edu>,
|
|
34
|
+
Greg Roelofs <newt@pobox.com>,
|
|
35
|
+
John Bowler <jbowler@acm.org>,
|
|
36
|
+
Tom Lane <tgl@sss.pgh.pa.us>
|
|
37
|
+
|
|
38
|
+
Permission to use, copy, modify, and distribute this software and its
|
|
39
|
+
documentation for any purpose and without fee is hereby granted, provided
|
|
40
|
+
that the above copyright notice appear in all copies and that both that
|
|
41
|
+
copyright notice and this permission notice appear in supporting
|
|
42
|
+
documentation. This software is provided "as is" without express or
|
|
43
|
+
implied warranty.
|