pdd 0.24.0 → 0.24.1

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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/.0pdd.yml +3 -0
  3. data/.github/workflows/actionlint.yml +25 -0
  4. data/.github/workflows/codecov.yml +12 -6
  5. data/.github/workflows/copyrights.yml +19 -0
  6. data/.github/workflows/markdown-lint.yml +19 -0
  7. data/.github/workflows/pdd.yml +6 -2
  8. data/.github/workflows/rake.yml +10 -5
  9. data/.github/workflows/reuse.yml +19 -0
  10. data/.github/workflows/typos.yml +19 -0
  11. data/.github/workflows/xcop.yml +6 -2
  12. data/.github/workflows/yamllint.yml +19 -0
  13. data/.gitignore +12 -5
  14. data/.markdownlint.yml +6 -0
  15. data/.pdd +0 -1
  16. data/.rubocop.yml +12 -2
  17. data/.rultor.yml +5 -1
  18. data/.simplecov +2 -19
  19. data/Gemfile +15 -30
  20. data/Gemfile.lock +173 -0
  21. data/LICENSE.txt +1 -1
  22. data/LICENSES/MIT.txt +21 -0
  23. data/README.md +76 -62
  24. data/REUSE.toml +43 -0
  25. data/Rakefile +4 -31
  26. data/assets/puzzles.xsd +3 -22
  27. data/assets/puzzles.xsl +3 -22
  28. data/assets/puzzles_json.xsl +4 -23
  29. data/bin/pdd +5 -20
  30. data/cucumber.yml +3 -0
  31. data/features/applies_rules.feature +2 -0
  32. data/features/avoiding_duplicates.feature +2 -0
  33. data/features/catches_broken_puzzles.feature +2 -0
  34. data/features/cli.feature +2 -0
  35. data/features/gem_package.feature +2 -0
  36. data/features/html_output.feature +2 -0
  37. data/features/json_output.feature +2 -0
  38. data/features/parsing.feature +2 -0
  39. data/features/rake.feature +2 -2
  40. data/features/remove.feature +2 -0
  41. data/features/step_definitions/steps.rb +2 -19
  42. data/features/support/env.rb +2 -19
  43. data/features/unicode.feature +2 -0
  44. data/features/uses_config.feature +2 -1
  45. data/lib/pdd/puzzle.rb +2 -19
  46. data/lib/pdd/rake_task.rb +3 -0
  47. data/lib/pdd/rule/duplicates.rb +2 -19
  48. data/lib/pdd/rule/estimates.rb +2 -19
  49. data/lib/pdd/rule/roles.rb +2 -19
  50. data/lib/pdd/rule/text.rb +2 -19
  51. data/lib/pdd/source.rb +2 -19
  52. data/lib/pdd/sources.rb +2 -19
  53. data/lib/pdd/version.rb +4 -21
  54. data/lib/pdd.rb +3 -20
  55. data/pdd.gemspec +8 -24
  56. data/test/test__helper.rb +23 -22
  57. data/test/test_duplicates.rb +5 -22
  58. data/test/test_estimates.rb +5 -22
  59. data/test/test_many.rb +3 -20
  60. data/test/test_pdd.rb +4 -21
  61. data/test/test_rake_task.rb +3 -0
  62. data/test/test_roles.rb +6 -23
  63. data/test/test_source.rb +14 -31
  64. data/test/test_source_todo.rb +3 -20
  65. data/test/test_sources.rb +4 -21
  66. data/test/test_text.rb +4 -21
  67. data/test_assets/aladdin.jpg +0 -0
  68. data/test_assets/elegant-objects.png +0 -0
  69. data/test_assets/puzzles/1-04e35eb3 +1 -1
  70. data/test_assets/puzzles/132-bc1dfafe +1 -1
  71. data/test_assets/puzzles/1425-59819ae3 +5 -5
  72. data/test_assets/puzzles/42-0d933cc0 +1 -1
  73. data/test_assets/puzzles/91-ecb9aa47 +1 -1
  74. data/test_assets/puzzles/93-641fe341 +1 -1
  75. data/utils/glob.rb +2 -19
  76. metadata +31 -11
  77. data/.overcommit.yml +0 -96
data/README.md CHANGED
@@ -1,79 +1,88 @@
1
- <img alt="pdd logo" src="https://avatars2.githubusercontent.com/u/24456188" width="92px" height="92px"/>
1
+ # Collector of TODO Puzzles in Source Code
2
2
 
3
3
  [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
4
- [![DevOps By Rultor.com](http://www.rultor.com/b/cqfn/pdd)](http://www.rultor.com/p/cqfn/pdd)
4
+ [![DevOps By Rultor.com](https://www.rultor.com/b/cqfn/pdd)](https://www.rultor.com/p/cqfn/pdd)
5
5
  [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
6
6
 
7
7
  [![rake](https://github.com/cqfn/pdd/actions/workflows/rake.yml/badge.svg)](https://github.com/cqfn/pdd/actions/workflows/rake.yml)
8
- [![PDD status](http://www.0pdd.com/svg?name=cqfn/pdd)](http://www.0pdd.com/p?name=cqfn/pdd)
8
+ [![PDD status](https://www.0pdd.com/svg?name=cqfn/pdd)](https://www.0pdd.com/p?name=cqfn/pdd)
9
9
  [![codecov](https://codecov.io/gh/yegor256/pdd/branch/master/graph/badge.svg)](https://codecov.io/gh/yegor/pdd)
10
10
  [![Hits-of-Code](https://hitsofcode.com/github/cqfn/pdd)](https://hitsofcode.com/view/github/cqfn/pdd)
11
11
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/cqfn/pdd/blob/master/LICENSE.txt)
12
- [![Gem Version](https://badge.fury.io/rb/pdd.svg)](http://badge.fury.io/rb/pdd)
12
+ [![Gem Version](https://badge.fury.io/rb/pdd.svg)](https://badge.fury.io/rb/pdd)
13
13
  [![Maintainability](https://api.codeclimate.com/v1/badges/c8e46256fdd8ddc817e5/maintainability)](https://codeclimate.com/github/cqfn/pdd/maintainability)
14
- [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/cqfn/pdd/master/frames)
14
+ [![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/github/cqfn/pdd/master/frames)
15
15
  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/1792d42f96fb45448e8d495ebc4348aa)](https://www.codacy.com/gh/cqfn/pdd/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=cqfn/pdd&amp;utm_campaign=Badge_Grade)
16
16
 
17
17
  Read this article about
18
18
  [_Puzzle Driven Development_](http://www.yegor256.com/2009/03/04/pdd.html).
19
- Check also patent application [US 12/840,306](http://www.google.com/patents/US20120023476)
19
+ Check also patent application
20
+ [US 12/840,306](http://www.google.com/patents/US20120023476)
20
21
 
21
- Also, check [0pdd.com](http://www.0pdd.com): a hosted service,
22
+ Also, check [0pdd.com](https://www.0pdd.com): a hosted service,
22
23
  where this command line tool works for you.
23
24
 
24
25
  Read
25
26
  [_PDD in Action_](http://www.yegor256.com/2017/04/05/pdd-in-action.html)
26
27
  and watch [this webinar](https://www.youtube.com/watch?v=nsYGC2aUwfQ).
27
28
 
28
- First, make sure Ruby 2.6+ and [`libmagic`](#how-to-install-libmagic) are installed. Then, install our gem:
29
+ First, make sure Ruby 2.6+ and [`libmagic`](#how-to-install-libmagic)
30
+ are installed. Then, install our gem:
29
31
 
30
32
  ```bash
31
- $ gem install pdd
33
+ gem install pdd
32
34
  ```
33
35
 
34
36
  Run it locally and read its output:
35
37
 
36
38
  ```bash
37
- $ pdd --help
39
+ pdd --help
38
40
  ```
39
41
 
40
42
  ## Usage
41
43
 
42
- You can exclude & include certain number of files from the search via these options:
44
+ You can exclude & include certain number of files from the search
45
+ via these options:
43
46
 
44
47
  ```bash
45
- $ pdd --exclude glob
48
+ pdd --exclude glob
46
49
  ```
47
50
 
48
- You can skip any file(s) with a name suffix that matches the pattern glob, using wildcard matching;
49
- a name suffix is either the whole path and name, or reg expr, for example:
51
+ You can skip any file(s) with a name suffix that matches the pattern glob,
52
+ using wildcard matching; a name suffix is either the whole
53
+ path and name, or reg expr, for example:
50
54
 
51
55
  ```bash
52
- $ pdd --exclude src/**/*.java --exclude target/**/*
53
- $ pdd --exclude src/**/*.java # exclude .java files in src/
54
- $ pdd --exclude src/**/* # exclude all files in src/
56
+ pdd --exclude src/**/*.java --exclude target/**/*
57
+ pdd --exclude src/**/*.java # exclude .java files in src/
58
+ pdd --exclude src/**/* # exclude all files in src/
55
59
  ```
56
60
 
57
61
  You can include too:
58
62
 
59
63
  ```bash
60
- $ pdd --include glob
64
+ pdd --include glob
61
65
  ```
62
66
 
63
- Search only files whose name matches glob, using wildcard matching as described under ``--exclude``.
64
- If contradictory ``--include`` and ``--exclude`` options are given, the last matching one wins.
65
- If no ``--include`` or ``--exclude`` options are given, all files from working directory are included, example:
67
+ Search only files whose name matches glob, using wildcard matching
68
+ as described under ``--exclude``.
69
+ If contradictory ``--include`` and ``--exclude`` options are given,
70
+ the last matching one wins.
71
+ If no ``--include`` or ``--exclude`` options are given, all files
72
+ from the working directory are included, example:
66
73
 
67
74
  ```bash
68
- $ pdd --include src/**/*.py # include only .py files in src/
69
- $ pdd --include src/**/* # include all files in src/
75
+ pdd --include src/**/*.py # include only .py files in src/
76
+ pdd --include src/**/* # include all files in src/
70
77
  ```
71
78
 
72
79
  Full command format is (all parameters are optional):
80
+
73
81
  ```bash
74
- $ pdd [--verbose] [--quiet] [--remove] [--skip-gitignore] [--skip-errors] \
75
- [--source <project_dir_path>] [--file puzzles_file.xml] [--include src/**/*.py] \
76
- [--format xml|html] [--rule min-words:5] [--exclude src/**/*.java]
82
+ pdd [--verbose] [--quiet] [--remove] [--skip-gitignore] [--skip-errors] \
83
+ [--source <project_dir_path>] [--file puzzles_file.xml] \
84
+ [--include src/**/*.py] \
85
+ [--format xml|html] [--rule min-words:5] [--exclude src/**/*.java]
77
86
  ```
78
87
 
79
88
  | Parameter | Description |
@@ -83,15 +92,15 @@ $ pdd [--verbose] [--quiet] [--remove] [--skip-gitignore] [--skip-errors] \
83
92
  | --remove | Remove all found puzzles from the source code |
84
93
  | --skip-gitignore | Don't look into .gitignore for excludes |
85
94
  | --skip-errors | Suppress error as warning and skip badly formatted puzzles (do not skip broken rules) |
86
- | --source <project-path> | Source directory to parse ("." by default) |
87
- | --file puzzles.xml | File to save report into (xml of html) (displayed in console by default) |
95
+ | --source project-path | Source directory to parse ("." by default) |
96
+ | --file puzzles.xml | File to save report into (xml or html) (displayed in console by default) |
88
97
  | --include *.py | Glob pattern to include (can be used several times) |
89
98
  | --exclude *.java | Glob pattern to exclude (can be used several times) |
90
99
  | --format xml | Format of the report xml or html (xml is default) |
91
100
  | --rule min-words:5 | Rule to apply (can be used several times), described later |
92
101
 
93
102
  :bulb: There is an option to create a .pdd file in your project and save all required parameters in it.
94
- File example you can see in this project.
103
+ You can see a file example in this project.
95
104
 
96
105
  ## How to Format?
97
106
 
@@ -116,17 +125,17 @@ Example:
116
125
  * @todo #234:15m/DEV This is something to do later
117
126
  * in one of the next releases. I can't figure out
118
127
  * how to implement it now, that's why the puzzle.
119
- * The text can be so long, as needed, just use
120
- * the same anount of spaces, as the second line.
121
- * This text will be not a part of the puzzle, as
122
- * it has less spaces.
128
+ * The text can be so long, as needed, just use
129
+ * the same amount of spaces, as the second line.
130
+ * This text will not be a part of the puzzle, as
131
+ * it has less spaces.
123
132
  */
124
133
  void sendEmail() {
125
134
  throw new UnsupportedOperationException();
126
135
  }
127
136
  ```
128
137
 
129
- If you use it in combination with [0pdd](http://www.0pdd.com),
138
+ If you use it in combination with [0pdd](https://www.0pdd.com),
130
139
  after processing this text, the issue titled
131
140
  "File.java:10-13: This is something to do later in one of ..." will be created.
132
141
  The specified markers will be included in the issues body
@@ -140,34 +149,35 @@ There are 3 supported keywords, one of which must precede the mandatory
140
149
  puzzle marker. They are `@todo`, `TODO` and `TODO:`.
141
150
 
142
151
  As an example, it starts with `@todo`, followed by a space and a mandatory
143
- puzzle **marker**. Possible formats of puzzle markers (it doesn't matter what the
144
- line starts with and where it is located,
152
+ puzzle **marker**. Possible formats of puzzle markers
153
+ (it doesn't matter what the line starts with and where it is located,
145
154
  as long as you have one of the 3 supported keywords right in front
146
155
  of the mandatory marker):
147
156
 
148
- ```
157
+ ```text
149
158
  // @todo #224 Puzzle description
150
159
  # @todo #55:45min Puzzle description
151
160
  @todo #67/DES Puzzle description
152
161
  ;; @todo #678:40m/DEV Puzzle description
153
- // TODO: #TEST-21:30min Puzzle description
162
+ // TODO #TEST-21:30min Puzzle description
154
163
  ```
155
164
 
156
- Here `DES` and `DEV` are the roles of people who must fix that puzzles;
165
+ Here `DES` and `DEV` are the roles of people who must fix these puzzles;
157
166
  `45min` and `40m` is the amount of time the puzzle should take;
158
167
  `224`, `55`, `67`, `678` and `TEST-21` are the IDs of the tickets
159
168
  these puzzles are coming from.
160
169
 
161
170
  Markers are absolutely necessary for all puzzles, because they allow
162
171
  us to build a hierarchical dependency tree of all puzzles, like
163
- [this one](http://www.0pdd.com/p?name=yegor256/takes),
172
+ [this one](https://www.0pdd.com/p?name=yegor256/takes),
164
173
  for example. Technically, of course, you can abuse the system
165
174
  and put a dummy `#1` marker everywhere.
166
175
 
167
176
  ### Multiline examples
168
177
 
169
178
  For multiline puzzles there are two important things:
170
- - **prefix** - any optional text followed by space before puzzle keyword (todo).
179
+
180
+ - **prefix** - any optional text followed by space before puzzle keyword (todo).
171
181
  It should be the same for all lines of puzzle description.
172
182
  - \ symbol can be used to logically divide puzzle description.
173
183
  prefix should be presented with it.
@@ -175,24 +185,24 @@ prefix should be presented with it.
175
185
  Examples:
176
186
 
177
187
  ```xml
178
- <!--
179
- ~ if comment should be started and closed by special symbols, then place them in
188
+ <!--
189
+ ~ if comments should be started and closed by special symbols, then place them in
180
190
  ~ a separate lines
181
191
  ~ Any symbol can be used as a prefix, it will be excluded from the text.
182
192
  ~ But do not forget about the space before puzzle keyword.
183
193
  ~
184
194
  ~ @todo #34 Description can be as long as needed.
185
- ~ Just use at least the same amount of the spaces, as on the first line.
195
+ ~ Just use at least the same amount of the spaces, as on the first line.
186
196
  ~ It will be added to description.
187
197
  -->
188
198
  ```
189
199
 
190
200
  ```java
191
201
  /**
192
- * @todo #36 Multiline text can use the same prefix in all lines or the same
202
+ * @todo #36 Multiline text can use the same prefix in all lines or the same
193
203
  * amount of spaces.
194
- * So this will be added to the puzzle description. If you want to divide the
195
- * puzzle logically by empty line, just add a backspace to that line
204
+ * So this will be added to the puzzle description. If you want to divide the
205
+ * puzzle logically by empty line, just add a backspace to that line
196
206
  * \
197
207
  * and continue the text after.
198
208
  *
@@ -207,7 +217,7 @@ You can specify post-parsing rules for your puzzles, in command line,
207
217
  for example:
208
218
 
209
219
  ```bash
210
- $ pdd --rule min-estimate:60 --rule max-estimate:120
220
+ pdd --rule min-estimate:60 --rule max-estimate:120
211
221
  ```
212
222
 
213
223
  These two parameters will add two post-parsing rules `min-estimate`
@@ -233,12 +243,13 @@ Here is a list of rules available now:
233
243
 
234
244
  :bulb: You can put all command line options into `.pdd` file. The options from the
235
245
  file will be used first. Command line options may be added on top of them.
236
- See, how it is done in [yegor256/0pdd](https://github.com/yegor256/0pdd/blob/master/.pdd).
246
+ See, how it is done in
247
+ [yegor256/0pdd](https://github.com/yegor256/0pdd/blob/master/.pdd).
237
248
 
238
249
  ## How to read XML
239
250
 
240
251
  The XML produced will look approximately like this (here is a
241
- [real example](http://www.0pdd.com/snapshot?name=yegor256/takes)):
252
+ [real example](https://www.0pdd.com/snapshot?name=yegor256/takes)):
242
253
 
243
254
  ```xml
244
255
  <puzzles>
@@ -256,6 +267,7 @@ The XML produced will look approximately like this (here is a
256
267
  </puzzle>
257
268
  </puzzles>
258
269
  ```
270
+
259
271
  NOTE: puzzles are saved with utf-8 encoding
260
272
 
261
273
  [XSD Schema](http://pdd-xsd.teamed.io/0.19.4.xsd) is here.
@@ -279,35 +291,37 @@ The most interesting parts of each puzzle are:
279
291
  For Debian/Ubuntu:
280
292
 
281
293
  ```bash
282
- $ apt install libmagic-dev
294
+ apt install libmagic-dev
283
295
  ```
284
296
 
285
- For Mac:
297
+ For macOS:
286
298
 
287
299
  ```bash
288
- $ brew install libmagic
300
+ brew install libmagic
289
301
  ```
290
302
 
291
- Unfortunately, there is no easy way to install on Windows, try to use
292
- [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) or
303
+ Unfortunately, there is no easy way to install on Windows, try to use
304
+ [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) or
293
305
  [Docker](https://www.docker.com/).
294
306
 
295
307
  ## How to contribute
296
308
 
297
309
  Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
298
310
  Make sure your build is green before you contribute
299
- your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.7+ and
311
+ your pull request. You will need to have
312
+ [Ruby](https://www.ruby-lang.org/en/) 2.7+ and
300
313
  [Bundler](https://bundler.io/) installed. Then:
301
314
 
302
315
  ```bash
303
- $ bundle install
304
- $ bundle exec rake
316
+ bundle install
317
+ bundle exec rake
305
318
  ```
306
319
 
307
320
  Next, install and run overcommit to install hooks (required once)
321
+
308
322
  ```bash
309
- $ gem install overcommit -v '=0.58.0'
310
- $ overcommit --install
323
+ gem install overcommit -v '=0.58.0'
324
+ overcommit --install
311
325
  ```
312
326
 
313
327
  If it's clean and you don't see any error messages, submit your pull request.
@@ -315,11 +329,11 @@ If it's clean and you don't see any error messages, submit your pull request.
315
329
  This is how you run the tool locally to test how it works:
316
330
 
317
331
  ```bash
318
- $ ./bin/pdd --help
332
+ ./bin/pdd --help
319
333
  ```
320
334
 
321
335
  To run a single unit test:
322
336
 
323
337
  ```bash
324
- $ bundle exec ruby test/test_many.rb
338
+ bundle exec ruby test/test_many.rb
325
339
  ```
data/REUSE.toml ADDED
@@ -0,0 +1,43 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ version = 1
5
+ [[annotations]]
6
+ path = [
7
+ ".DS_Store",
8
+ ".gitattributes",
9
+ ".gitignore",
10
+ ".overcommit.yml",
11
+ ".pdd",
12
+ "**.ico",
13
+ "**.jpg",
14
+ "**.json",
15
+ "**.md",
16
+ "**.pdf",
17
+ "**.png",
18
+ "**.txt",
19
+ "**.woff",
20
+ "**/.DS_Store",
21
+ "**/.gitignore",
22
+ "**/.pdd",
23
+ "**/*.csv",
24
+ "**/*.jpg",
25
+ "**/*.json",
26
+ "**/*.md",
27
+ "**/*.pdf",
28
+ "**/*.png",
29
+ "**/*.svg",
30
+ "**/*.txt",
31
+ "**/*.vm",
32
+ "**/CITATION.cff",
33
+ "**/CNAME",
34
+ "**/Gemfile.lock",
35
+ "CITATION.cff",
36
+ "Gemfile.lock",
37
+ "README.md",
38
+ "renovate.json",
39
+ "test_assets/puzzles/**",
40
+ ]
41
+ precedence = "override"
42
+ SPDX-FileCopyrightText = "Copyright (c) 2025 Yegor Bugayenko"
43
+ SPDX-License-Identifier = "MIT"
data/Rakefile CHANGED
@@ -1,22 +1,5 @@
1
- # Copyright (c) 2014-2024 Yegor Bugayenko
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the 'Software'), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all
11
- # copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- # SOFTWARE.
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
20
3
 
21
4
  require 'rubygems'
22
5
  require 'rake'
@@ -31,7 +14,7 @@ def version
31
14
  Gem::Specification.load(Dir['*.gemspec'].first).version
32
15
  end
33
16
 
34
- task default: %i[clean test features rubocop xcop copyright]
17
+ task default: %i[clean test features rubocop xcop]
35
18
 
36
19
  require 'rake/testtask'
37
20
  desc 'Run all unit tests'
@@ -55,15 +38,13 @@ require 'rubocop/rake_task'
55
38
  desc 'Run RuboCop on all directories'
56
39
  RuboCop::RakeTask.new(:rubocop) do |task|
57
40
  task.fail_on_error = true
58
- task.requires << 'rubocop-rspec'
59
41
  end
60
42
 
61
43
  require 'xcop/rake_task'
62
44
  desc 'Validate all XML/XSL/XSD/HTML files for formatting'
63
45
  Xcop::RakeTask.new :xcop do |task|
64
- task.license = 'LICENSE.txt'
65
46
  task.includes = ['**/*.xml', '**/*.xsl', '**/*.xsd', '**/*.html']
66
- task.excludes = ['target/**/*', 'coverage/**/*']
47
+ task.excludes = ['target/**/*', 'coverage/**/*', 'vendor/**/*']
67
48
  end
68
49
 
69
50
  require 'pdd/rake_task'
@@ -83,11 +64,3 @@ end
83
64
  Cucumber::Rake::Task.new(:'features:json') do |t|
84
65
  t.profile = 'json_report'
85
66
  end
86
-
87
- task :copyright do
88
- sh "grep -q -r '2014-#{Date.today.strftime('%Y')}' \
89
- --include '*.rb' \
90
- --include '*.txt' \
91
- --include 'Rakefile' \
92
- ."
93
- end
data/assets/puzzles.xsd CHANGED
@@ -1,26 +1,7 @@
1
- <?xml version="1.0"?>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!--
3
- (The MIT License)
4
-
5
- Copyright (c) 2014-2024 Yegor Bugayenko
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the 'Software'), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- SOFTWARE.
3
+ * SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
4
+ * SPDX-License-Identifier: MIT
24
5
  -->
25
6
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
26
7
  <xs:complexType name="puzzle">
data/assets/puzzles.xsl CHANGED
@@ -1,26 +1,7 @@
1
- <?xml version="1.0"?>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!--
3
- (The MIT License)
4
-
5
- Copyright (c) 2014-2024 Yegor Bugayenko
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the 'Software'), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- SOFTWARE.
3
+ * SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
4
+ * SPDX-License-Identifier: MIT
24
5
  -->
25
6
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
26
7
  <xsl:template match="/">
@@ -1,26 +1,7 @@
1
- <?xml version="1.0"?>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!--
3
- (The MIT License)
4
-
5
- Copyright (c) 2014-2024 Yegor Bugayenko
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the 'Software'), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- SOFTWARE.
3
+ * SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
4
+ * SPDX-License-Identifier: MIT
24
5
  -->
25
6
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
26
7
  <xsl:output method="text" omit-xml-declaration="yes"/>
@@ -61,7 +42,7 @@ SOFTWARE.
61
42
  <xsl:text>", </xsl:text>
62
43
  <xsl:text>
63
44
  "body": "</xsl:text>
64
- <xsl:value-of select="translate(body, '&quot;', '&#x201C;')"/>
45
+ <xsl:value-of select="translate(body, '&quot;', '')"/>
65
46
  <xsl:text>", </xsl:text>
66
47
  <xsl:text>
67
48
  "estimate": "</xsl:text>
data/bin/pdd CHANGED
@@ -1,26 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
- # Copyright (c) 2014-2024 Yegor Bugayenko
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the 'Software'), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in all
12
- # copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- # SOFTWARE.
2
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
3
+ # SPDX-License-Identifier: MIT
21
4
 
22
5
  $stdout.sync = true
23
6
 
7
+ require 'backtrace'
24
8
  require 'shellwords'
25
9
  require 'English'
26
10
  require 'find'
@@ -132,7 +116,7 @@ https://github.com/cqfn/pdd/blob/master/README.md"
132
116
  File.write(
133
117
  f,
134
118
  File.readlines(f).reject.each_with_index do |_t, i|
135
- all.any? { |pair| i + 1 >= pair[0] && i + 1 <= pair[1] }
119
+ all.any? { |pair| i + (1.between?(pair[0], pair[1]) ? 1 : 0) }
136
120
  end.join
137
121
  )
138
122
  PDD.log.info "#{all.count} puzzles removed from #{src}"
@@ -153,6 +137,7 @@ more documentation: https://github.com/cqfn/pdd/blob/master/README.md."
153
137
  exit(1)
154
138
  rescue StandardError => e
155
139
  PDD.log.error "#{Rainbow('ERROR').red} (#{e.class.name}): #{e.message}"
140
+ PDD.log.error Backtrace.new(e).to_s
156
141
  PDD.log.info 'Exit code is 255'
157
142
  exit(255)
158
143
  end
data/cucumber.yml CHANGED
@@ -1,3 +1,6 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
3
+ ---
1
4
  default: --format pretty
2
5
  travis: --format progress
3
6
  html_report: --format progress --format html --out=features_report.html
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
1
3
  Feature: Applies Post-Parsing Rules
2
4
  As a source code writer I want to be sure that
3
5
  certain post-parsing rules are applied
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
1
3
  Feature: Avoiding Duplicate Puzzles
2
4
  As a source code writer I want to be sure that
3
5
  XML output doesn't contain any duplicates
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
1
3
  Feature: Catches Broken Puzzles
2
4
  As a source code writer I want to be sure that
3
5
  broken puzzles won't be processed and will
data/features/cli.feature CHANGED
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
1
3
  Feature: Command Line Processing
2
4
  As a source code writer I want to be able to
3
5
  call PDD as a command line tool
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
1
3
  Feature: Gem Package
2
4
  As a source code writer I want to be able to
3
5
  package the Gem into .gem file
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
1
3
  Feature: HTML output
2
4
  As a source code writer I want to be able to
3
5
  call PDD as a command line tool, and retrieve an
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
1
3
  Feature: JSON output
2
4
  As a source code writer I want to be able to
3
5
  call PDD as a command line tool, and retrieve an
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
1
3
  Feature: Parsing
2
4
  As a source code writer I want to be able to
3
5
  collect all puzzles from all my text files and
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
1
3
  Feature: Rake Task
2
4
  As a source code writer I want to be able to
3
5
  run PDD from Rakefile
@@ -17,5 +19,3 @@ Feature: Rake Task
17
19
 
18
20
  When I run bash with "rake pdd"
19
21
  Then Exit code is zero
20
-
21
-
@@ -1,3 +1,5 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2014-2025 Yegor Bugayenko
2
+ # SPDX-License-Identifier: MIT
1
3
  Feature: Removing Puzzles
2
4
  As a source code writer I want to be able to
3
5
  remove PDD puzzles from source code