pdd 0.20.8 → 0.21.2
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 +4 -4
- data/.github/workflows/codecov.yml +20 -0
- data/.github/workflows/rake.yml +24 -0
- data/.pdd +1 -3
- data/.rubocop.yml +5 -3
- data/.rultor.yml +8 -15
- data/.simplecov +1 -1
- data/CITATION.cff +25 -0
- data/Gemfile +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +26 -20
- data/Rakefile +1 -1
- data/assets/puzzles.xsd +1 -1
- data/assets/puzzles.xsl +1 -1
- data/bin/pdd +3 -1
- data/features/catches_broken_puzzles.feature +2 -20
- data/features/cli.feature +2 -2
- data/features/parsing.feature +31 -1
- data/features/step_definitions/steps.rb +3 -7
- data/features/support/env.rb +1 -1
- data/lib/pdd/puzzle.rb +1 -1
- data/lib/pdd/rake_task.rb +0 -10
- data/lib/pdd/rule/duplicates.rb +1 -1
- data/lib/pdd/rule/estimates.rb +1 -1
- data/lib/pdd/rule/roles.rb +1 -1
- data/lib/pdd/rule/text.rb +1 -1
- data/lib/pdd/source.rb +46 -36
- data/lib/pdd/sources.rb +10 -10
- data/lib/pdd/version.rb +3 -3
- data/lib/pdd.rb +2 -2
- data/pdd.gemspec +2 -1
- data/test/test__helper.rb +1 -1
- data/test/test_duplicates.rb +2 -2
- data/test/test_estimates.rb +2 -2
- data/test/test_pdd.rb +2 -2
- data/test/test_roles.rb +2 -2
- data/test/test_source.rb +72 -15
- data/test/test_source_todo.rb +3 -21
- data/test/test_sources.rb +2 -3
- data/test/test_text.rb +2 -2
- data/utils/glob.rb +1 -3
- metadata +19 -4
- data/.travis.yml +0 -13
- data/appveyor.yml +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c76649118dbe4b4884f07d453b611ca05da5845e753357fcb98cd0e6e8324b64
|
|
4
|
+
data.tar.gz: 4b85d7b84b62f8d695d2e8b95a92bc03cb87d5e6acbef283723ac353a43c42cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a54147d056c4593c20142e9c45497308bc57c0ec34a63e84fc0f025e1722ed406102f9383196cec51a084baffe17d2de4174060c93173328605089410a48dff
|
|
7
|
+
data.tar.gz: 4270c5b9ec6e8b63ca371b2c6c5905b13394d5078943f1c66b8c8ec9ccc30ae25026efd375f3fd2d5bd8c2a1fd29080c86755935d5c91bc6d47baceda89e6edd
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codecov
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
jobs:
|
|
8
|
+
codecov:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v2
|
|
12
|
+
- uses: actions/setup-ruby@v1
|
|
13
|
+
with:
|
|
14
|
+
ruby-version: 2.7
|
|
15
|
+
- run: bundle update
|
|
16
|
+
- run: bundle exec rake
|
|
17
|
+
- uses: codecov/codecov-action@v1
|
|
18
|
+
with:
|
|
19
|
+
file: coverage/.resultset.json
|
|
20
|
+
fail_ci_if_error: true
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rake
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- master
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
name: test
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
os: [ubuntu-latest]
|
|
16
|
+
ruby: [2.7]
|
|
17
|
+
runs-on: ${{ matrix.os }}
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v2
|
|
20
|
+
- uses: actions/setup-ruby@v1
|
|
21
|
+
with:
|
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
|
23
|
+
- run: bundle update
|
|
24
|
+
- run: bundle exec rake
|
data/.pdd
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
--source=.
|
|
2
2
|
--verbose
|
|
3
|
-
--skip-errors
|
|
4
|
-
--skip-gitignore
|
|
5
|
-
--include lib/pdd/sources.rb
|
|
6
3
|
--exclude .idea/**/*
|
|
7
4
|
--exclude .bundle/**/*
|
|
8
5
|
--exclude target/**/*
|
|
@@ -25,3 +22,4 @@
|
|
|
25
22
|
--rule min-words:20
|
|
26
23
|
--rule min-estimate:15
|
|
27
24
|
--rule max-estimate:90
|
|
25
|
+
|
data/.rubocop.yml
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
AllCops:
|
|
2
2
|
Exclude:
|
|
3
|
-
-
|
|
3
|
+
- "assets/**/*"
|
|
4
4
|
DisplayCopNames: true
|
|
5
5
|
TargetRubyVersion: 2.3
|
|
6
6
|
|
|
7
7
|
Layout/EndOfLine:
|
|
8
8
|
EnforcedStyle: lf
|
|
9
9
|
Metrics/ClassLength:
|
|
10
|
-
Max:
|
|
10
|
+
Max: 360
|
|
11
|
+
Metrics/LineLength:
|
|
12
|
+
Max: 90
|
|
11
13
|
Metrics/MethodLength:
|
|
12
|
-
Max:
|
|
14
|
+
Max: 35
|
|
13
15
|
Metrics/AbcSize:
|
|
14
16
|
Max: 40
|
|
15
17
|
Style/MultilineBlockChain:
|
data/.rultor.yml
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
|
+
docker:
|
|
2
|
+
image: yegor256/rultor-image:1.9.0
|
|
1
3
|
assets:
|
|
2
4
|
rubygems.yml: yegor256/home#assets/rubygems.yml
|
|
3
|
-
s3cfg: yegor256/home#assets/s3cfg
|
|
4
5
|
install: |
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
sudo gem install pdd -v 0.20.5
|
|
8
|
-
sudo gem install xcop -v 0.6
|
|
9
|
-
bundle install
|
|
6
|
+
pdd -f /dev/null
|
|
7
|
+
sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
|
|
10
8
|
release:
|
|
11
9
|
script: |-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
|
|
11
|
+
bundle exec rake
|
|
14
12
|
rm -rf *.gem
|
|
15
|
-
sed -i "s/
|
|
13
|
+
sed -i "s/0\.0\.0/${tag}/g" lib/pdd/version.rb
|
|
16
14
|
git add lib/pdd/version.rb
|
|
17
15
|
git commit -m "version set to ${tag}"
|
|
18
16
|
gem build pdd.gemspec
|
|
19
17
|
chmod 0600 ../rubygems.yml
|
|
20
18
|
gem push *.gem --config-file ../rubygems.yml
|
|
21
|
-
pdd --source=$(pwd) --verbose --file=pdd.xml -e=test/** -e=features/** -e=coverage/**/* -e=README.md
|
|
22
|
-
s3cmd --no-progress put pdd.xml --config=../s3cfg s3://pdd.teamed.io/pdd.xml
|
|
23
|
-
s3cmd --no-progress put assets/puzzles.xsd --acl-public --config=../s3cfg s3://pdd-xsd.teamed.io/${tag}.xsd
|
|
24
|
-
s3cmd --no-progress put assets/puzzles.xsl --acl-public --config=../s3cfg s3://pdd-xsl.teamed.io/${tag}.xsl
|
|
25
19
|
merge:
|
|
26
20
|
script: |-
|
|
27
|
-
pdd -f /dev/null
|
|
28
21
|
LC_ALL=US-ASCII bundle exec rake
|
|
29
22
|
deploy:
|
|
30
23
|
script: |-
|
|
31
|
-
echo
|
|
24
|
+
echo "There is nothing to deploy"
|
|
32
25
|
exit -1
|
data/.simplecov
CHANGED
data/CITATION.cff
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use this software, please cite it as below."
|
|
3
|
+
authors:
|
|
4
|
+
- family-names: "Bugayenko"
|
|
5
|
+
given-names: "Yegor"
|
|
6
|
+
orcid: "https://orcid.org/0000-0001-6370-0678"
|
|
7
|
+
- family-names: "Bakare"
|
|
8
|
+
given-names: "Ayomide"
|
|
9
|
+
- family-names: "Cheverda"
|
|
10
|
+
given-names: "Arina"
|
|
11
|
+
- family-names: "Farina"
|
|
12
|
+
given-names: "Mirko"
|
|
13
|
+
- family-names: "Kruglov"
|
|
14
|
+
given-names: "Artem"
|
|
15
|
+
- family-names: "Plaksin"
|
|
16
|
+
given-names: "Yaroslav"
|
|
17
|
+
- family-names: "Succi"
|
|
18
|
+
given-names: "Giancarlo"
|
|
19
|
+
- family-names: "Pedrycz"
|
|
20
|
+
given-names: "Witold"
|
|
21
|
+
title: "Automatically Prioritizing and Assigning Tasks from Code Repositories in Puzzle Driven Development"
|
|
22
|
+
version: 0.21.0
|
|
23
|
+
doi: 10.1145/3524842.3528512
|
|
24
|
+
date-released: 2022-05-09
|
|
25
|
+
url: "https://github.com/cqfn/pdd"
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
<img src="https://avatars2.githubusercontent.com/u/24456188" width="
|
|
2
|
-
|
|
3
|
-
[](https://www.0crat.com/contrib/C3T46CUJJ)
|
|
1
|
+
<img alt="pdd logo" src="https://avatars2.githubusercontent.com/u/24456188" width="92px" height="92px"/>
|
|
4
2
|
|
|
5
3
|
[](https://www.elegantobjects.org)
|
|
6
|
-
[](https://www.0crat.com/p/C3T46CUJJ)
|
|
7
4
|
[](http://www.rultor.com/p/cqfn/pdd)
|
|
8
5
|
[](https://www.jetbrains.com/ruby/)
|
|
9
6
|
|
|
10
|
-
[](https://travis-ci.org/cqfn/pdd)
|
|
11
|
-
[](https://ci.appveyor.com/project/cqfn/pdd)
|
|
12
7
|
[](http://www.0pdd.com/p?name=cqfn/pdd)
|
|
13
|
-
[](https://codecov.io/gh/cqfn/pdd)
|
|
9
|
+

|
|
14
10
|
[](https://hitsofcode.com/view/github/cqfn/pdd)
|
|
15
11
|
[](https://github.com/cqfn/pdd/blob/master/LICENSE.txt)
|
|
16
12
|
|
|
@@ -29,7 +25,8 @@ Read
|
|
|
29
25
|
[_PDD in Action_](http://www.yegor256.com/2017/04/05/pdd-in-action.html)
|
|
30
26
|
and watch [this webinar](https://www.youtube.com/watch?v=nsYGC2aUwfQ).
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
You should have [Ruby installed](https://www.ruby-lang.org/en/documentation/installation/).
|
|
29
|
+
Then, install our gem:
|
|
33
30
|
|
|
34
31
|
```bash
|
|
35
32
|
$ gem install pdd
|
|
@@ -41,29 +38,34 @@ Run it locally and read its output:
|
|
|
41
38
|
$ pdd --help
|
|
42
39
|
```
|
|
43
40
|
|
|
44
|
-
### File and Directory Selection
|
|
45
41
|
You can exclude & include certain number of files from the search via these options:
|
|
46
42
|
|
|
47
|
-
|
|
43
|
+
```
|
|
44
|
+
$ pdd --exclude=glob
|
|
45
|
+
```
|
|
48
46
|
|
|
49
47
|
You can skip any file(s) with a name suffix that matches the pattern glob, using wildcard matching;
|
|
50
48
|
a name suffix is either the whole path and name, or reg expr, for example:
|
|
51
49
|
|
|
52
50
|
```bash
|
|
53
|
-
pdd --exclude=src/**/*.java --exclude=target/**/*
|
|
54
|
-
pdd --exclude=src/**/*.java # exclude .java files in src/
|
|
55
|
-
pdd --exclude=src/**/* # exclude all files in src/
|
|
51
|
+
$ pdd --exclude=src/**/*.java --exclude=target/**/*
|
|
52
|
+
$ pdd --exclude=src/**/*.java # exclude .java files in src/
|
|
53
|
+
$ pdd --exclude=src/**/* # exclude all files in src/
|
|
56
54
|
```
|
|
57
55
|
|
|
58
|
-
|
|
56
|
+
You can include too:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
$ pdd --include=glob
|
|
60
|
+
```
|
|
59
61
|
|
|
60
62
|
Search only files whose name matches glob, using wildcard matching as described under ``--exclude``.
|
|
61
63
|
If contradictory ``--include`` and ``--exclude`` options are given, the last matching one wins.
|
|
62
64
|
If no ``--include`` or ``--exclude`` options are given, all files from working directory are included, example:
|
|
63
|
-
|
|
65
|
+
|
|
64
66
|
```bash
|
|
65
|
-
pdd --include=src/**/*.py # include only .py files in src/
|
|
66
|
-
pdd --include=src/**/* # include all files in src/
|
|
67
|
+
$ pdd --include=src/**/*.py # include only .py files in src/
|
|
68
|
+
$ pdd --include=src/**/* # include all files in src/
|
|
67
69
|
```
|
|
68
70
|
|
|
69
71
|
## How to Format?
|
|
@@ -78,8 +80,9 @@ to the leading space in every consecutive line):
|
|
|
78
80
|
[related code]
|
|
79
81
|
```
|
|
80
82
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
`[]` - Replace with apropriate data (see text enclosed in brackets)
|
|
84
|
+
|
|
85
|
+
`<>` - Omitable (enclosed data can be left out)
|
|
83
86
|
|
|
84
87
|
Example:
|
|
85
88
|
|
|
@@ -101,6 +104,9 @@ The specified markers will be included in the issues body
|
|
|
101
104
|
along with some predefined text. If your comment is longer
|
|
102
105
|
than 40 characters, it will be truncated in the title.
|
|
103
106
|
|
|
107
|
+
Note: if you create several puzzle duplicates (same text after puzzle keyword),
|
|
108
|
+
pdd will fail to parse puzzles and produce an error with duplicates list.
|
|
109
|
+
|
|
104
110
|
There are 3 supported keywords, one of which must precede the mandatory
|
|
105
111
|
puzzle marker. They are `@todo`, `TODO` and `TODO:`.
|
|
106
112
|
|
|
@@ -212,7 +218,7 @@ your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2
|
|
|
212
218
|
[Bundler](https://bundler.io/) installed. Then:
|
|
213
219
|
|
|
214
220
|
```
|
|
215
|
-
$ bundle install
|
|
221
|
+
$ bundle install
|
|
216
222
|
$ bundle exec rake
|
|
217
223
|
```
|
|
218
224
|
|
data/Rakefile
CHANGED
data/assets/puzzles.xsd
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<!--
|
|
3
3
|
(The MIT License)
|
|
4
4
|
|
|
5
|
-
Copyright (c) 2014-
|
|
5
|
+
Copyright (c) 2014-2022 Yegor Bugayenko
|
|
6
6
|
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
8
|
of this software and associated documentation files (the 'Software'), to deal
|
data/assets/puzzles.xsl
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<!--
|
|
3
3
|
(The MIT License)
|
|
4
4
|
|
|
5
|
-
Copyright (c) 2014-
|
|
5
|
+
Copyright (c) 2014-2022 Yegor Bugayenko
|
|
6
6
|
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
8
|
of this software and associated documentation files (the 'Software'), to deal
|
data/bin/pdd
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
# Copyright (c) 2014-
|
|
2
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
3
3
|
#
|
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -31,6 +31,8 @@ require_relative '../lib/pdd'
|
|
|
31
31
|
require_relative '../lib/pdd/version'
|
|
32
32
|
require_relative '../lib/pdd/source'
|
|
33
33
|
|
|
34
|
+
Rainbow.enabled = ENV['PDD_ENV'] == 'development'
|
|
35
|
+
|
|
34
36
|
begin
|
|
35
37
|
args = []
|
|
36
38
|
if File.exist?('.pdd')
|
|
@@ -11,30 +11,12 @@ Feature: Catches Broken Puzzles
|
|
|
11
11
|
* Some other documentation
|
|
12
12
|
* text that is not relevant to
|
|
13
13
|
* the puzzle below.
|
|
14
|
-
* @todo
|
|
15
|
-
* because it doesn't
|
|
16
|
-
* the second and the third lines
|
|
14
|
+
* @todo This puzzle has an incorrect format
|
|
15
|
+
* because it doesn't have a ticket number
|
|
17
16
|
*/
|
|
18
17
|
public void main(String[] args) {
|
|
19
18
|
// later
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
"""
|
|
23
|
-
When I run pdd it fails with "Space expected"
|
|
24
22
|
When I run pdd it fails with "Sample.java:6"
|
|
25
|
-
|
|
26
|
-
Scenario: Throwing exception on yet another broken puzzle
|
|
27
|
-
Given I have a "Sample.java" file with content:
|
|
28
|
-
"""
|
|
29
|
-
public class Main {
|
|
30
|
-
//
|
|
31
|
-
// @todo #13 This puzzle has an incorrect format
|
|
32
|
-
// because there is no space character in the
|
|
33
|
-
// second and third lines
|
|
34
|
-
//
|
|
35
|
-
public void main(String[] args) {
|
|
36
|
-
// later
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
"""
|
|
40
|
-
When I run pdd it fails with "Space expected"
|
data/features/cli.feature
CHANGED
data/features/parsing.feature
CHANGED
|
@@ -25,6 +25,32 @@ Feature: Parsing
|
|
|
25
25
|
And XML matches "//puzzle[role='DEV']"
|
|
26
26
|
And XML matches "//puzzle[estimate='0']"
|
|
27
27
|
|
|
28
|
+
Scenario: Simple puzzle within comment block
|
|
29
|
+
Given I have a "test/a/b/Sample.java" file with content:
|
|
30
|
+
"""
|
|
31
|
+
public class Main {
|
|
32
|
+
/**
|
|
33
|
+
* Some other documentation
|
|
34
|
+
* text that is not relevant to
|
|
35
|
+
* the puzzle below.
|
|
36
|
+
* @todo #13 This puzzle has a correct format
|
|
37
|
+
* It doesn't start with a space on
|
|
38
|
+
* the second and the third lines
|
|
39
|
+
*/
|
|
40
|
+
public void main(String[] args) {
|
|
41
|
+
// later
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
"""
|
|
45
|
+
When I run pdd
|
|
46
|
+
Then XML matches "/puzzles[count(puzzle)=1]"
|
|
47
|
+
And XML matches "//puzzle[file='test/a/b/Sample.java']"
|
|
48
|
+
And XML matches "//puzzle[ticket='13']"
|
|
49
|
+
And XML matches "//puzzle[lines='6-8']"
|
|
50
|
+
And XML matches "//puzzle[starts-with(body,'This')]"
|
|
51
|
+
And XML matches "//puzzle[role='DEV']"
|
|
52
|
+
And XML matches "//puzzle[estimate='0']"
|
|
53
|
+
|
|
28
54
|
Scenario: Multiple puzzles in one file
|
|
29
55
|
Given I have a "test/a/b/c/Sample.java" file with content:
|
|
30
56
|
"""
|
|
@@ -34,6 +60,9 @@ Feature: Parsing
|
|
|
34
60
|
* @todo #ABC-67:15min And this one ever later
|
|
35
61
|
* @todo #F-78-3:2h/DEV This is for a developer
|
|
36
62
|
* who will join us later
|
|
63
|
+
* @todo #44 This puzzle has a correct format
|
|
64
|
+
* even though it doesn't start with a space on
|
|
65
|
+
* the second and the third lines
|
|
37
66
|
*/
|
|
38
67
|
public void main(String[] args) {
|
|
39
68
|
// later
|
|
@@ -41,10 +70,11 @@ Feature: Parsing
|
|
|
41
70
|
}
|
|
42
71
|
"""
|
|
43
72
|
When I run pdd
|
|
44
|
-
Then XML matches "/puzzles[count(puzzle)=
|
|
73
|
+
Then XML matches "/puzzles[count(puzzle)=4]"
|
|
45
74
|
And XML matches "//puzzle[ticket='13' and lines='3-3']"
|
|
46
75
|
And XML matches "//puzzle[ticket='13' and body='This one later']"
|
|
47
76
|
And XML matches "//puzzle[ticket='ABC-67' and lines='4-4']"
|
|
48
77
|
And XML matches "//puzzle[ticket='F-78-3' and lines='5-6']"
|
|
49
78
|
And XML matches "//puzzle[ticket='ABC-67' and estimate='15']"
|
|
50
79
|
And XML matches "//puzzle[ticket='F-78-3' and estimate='120']"
|
|
80
|
+
And XML matches "//puzzle[ticket='44' and lines='7-9']"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -79,9 +79,7 @@ When(%r{^I run bin/pdd with "([^"]*)"$}) do |arg|
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
Then(/^Stdout contains "([^"]*)"$/) do |txt|
|
|
82
|
-
unless @stdout.include?(txt)
|
|
83
|
-
raise "STDOUT doesn't contain '#{txt}':\n#{@stdout}"
|
|
84
|
-
end
|
|
82
|
+
raise "STDOUT doesn't contain '#{txt}':\n#{@stdout}" unless @stdout.include?(txt)
|
|
85
83
|
end
|
|
86
84
|
|
|
87
85
|
Then(/^Stdout is empty$/) do
|
|
@@ -93,9 +91,7 @@ Then(/^XML file "([^"]+)" matches "([^"]+)"$/) do |file, xpath|
|
|
|
93
91
|
|
|
94
92
|
xml = Nokogiri::XML.parse(File.read(file))
|
|
95
93
|
xml.remove_namespaces!
|
|
96
|
-
if xml.xpath(xpath).empty?
|
|
97
|
-
raise "XML file #{file} doesn't match \"#{xpath}\":\n#{xml}"
|
|
98
|
-
end
|
|
94
|
+
raise "XML file #{file} doesn't match \"#{xpath}\":\n#{xml}" if xml.xpath(xpath).empty?
|
|
99
95
|
end
|
|
100
96
|
|
|
101
97
|
Then(/^Exit code is zero$/) do
|
data/features/support/env.rb
CHANGED
data/lib/pdd/puzzle.rb
CHANGED
data/lib/pdd/rake_task.rb
CHANGED
|
@@ -22,18 +22,8 @@ module PDD
|
|
|
22
22
|
task(name, *args) do |_, task_args|
|
|
23
23
|
RakeFileUtils.send(:verbose, true) do
|
|
24
24
|
yield(*[self, task_args].slice(0, task_block.arity)) if block_given?
|
|
25
|
-
run
|
|
26
25
|
end
|
|
27
26
|
end
|
|
28
27
|
end
|
|
29
|
-
|
|
30
|
-
private
|
|
31
|
-
|
|
32
|
-
def run
|
|
33
|
-
# @todo #125:30m need to implement this method.
|
|
34
|
-
# For now, it's just a task,
|
|
35
|
-
# that prints a simple Running pdd... message to user
|
|
36
|
-
puts 'Running pdd...' unless @quiet
|
|
37
|
-
end
|
|
38
28
|
end
|
|
39
29
|
end
|
data/lib/pdd/rule/duplicates.rb
CHANGED
data/lib/pdd/rule/estimates.rb
CHANGED
data/lib/pdd/rule/roles.rb
CHANGED
data/lib/pdd/rule/text.rb
CHANGED
data/lib/pdd/source.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -37,10 +37,31 @@ module PDD
|
|
|
37
37
|
@path = path
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
def match_markers(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
def match_markers(l)
|
|
41
|
+
if l.downcase.include? 'todo'
|
|
42
|
+
/[^\s]\x40todo/.match(l) do |_|
|
|
43
|
+
raise Error, get_no_leading_space_error("\x40todo")
|
|
44
|
+
end
|
|
45
|
+
/\x40todo(?!\s+#)/.match(l) do |_|
|
|
46
|
+
raise Error, get_no_puzzle_marker_error("\x40todo")
|
|
47
|
+
end
|
|
48
|
+
/\x40todo\s+#\s/.match(l) do |_|
|
|
49
|
+
raise Error, get_space_after_hash_error("\x40todo")
|
|
50
|
+
end
|
|
51
|
+
/[^\s]TODO:?/.match(l) do |_|
|
|
52
|
+
raise Error, get_no_leading_space_error('TODO')
|
|
53
|
+
end
|
|
54
|
+
/TODO(?!:?\s+#)/.match(l) do |_|
|
|
55
|
+
raise Error, get_no_puzzle_marker_error('TODO')
|
|
56
|
+
end
|
|
57
|
+
/TODO:?\s+#\s/.match(l) do |_|
|
|
58
|
+
raise Error, get_space_after_hash_error('TODO')
|
|
59
|
+
end
|
|
60
|
+
a = [%r{(.*(?:^|\s))(?:\x40todo|TODO:|TODO)\s+#([\w\-.:/]+)\s+(.+)}.match(l)]
|
|
61
|
+
a.compact
|
|
62
|
+
else
|
|
63
|
+
[]
|
|
64
|
+
end
|
|
44
65
|
end
|
|
45
66
|
|
|
46
67
|
# Fetch all puzzles.
|
|
@@ -50,7 +71,6 @@ module PDD
|
|
|
50
71
|
lines = File.readlines(@file, encoding: 'UTF-8')
|
|
51
72
|
lines.each_with_index do |line, idx|
|
|
52
73
|
begin
|
|
53
|
-
check_rules(line)
|
|
54
74
|
match_markers(line).each do |m|
|
|
55
75
|
puzzles << puzzle(lines.drop(idx + 1), m, idx)
|
|
56
76
|
end
|
|
@@ -82,30 +102,10 @@ after the hash sign, it should not be there, \
|
|
|
82
102
|
see https://github.com/cqfn/pdd#how-to-format"
|
|
83
103
|
end
|
|
84
104
|
|
|
85
|
-
def check_rules(line)
|
|
86
|
-
/[^\s]\x40todo/.match(line) do |_|
|
|
87
|
-
raise Error, get_no_leading_space_error("\x40todo")
|
|
88
|
-
end
|
|
89
|
-
/\x40todo(?!\s+#)/.match(line) do |_|
|
|
90
|
-
raise Error, get_no_puzzle_marker_error("\x40todo")
|
|
91
|
-
end
|
|
92
|
-
/\x40todo\s+#\s/.match(line) do |_|
|
|
93
|
-
raise Error, get_space_after_hash_error("\x40todo")
|
|
94
|
-
end
|
|
95
|
-
/[^\s]TODO:?/.match(line) do |_|
|
|
96
|
-
raise Error, get_no_leading_space_error('TODO')
|
|
97
|
-
end
|
|
98
|
-
/TODO(?!:?\s+#)/.match(line) do |_|
|
|
99
|
-
raise Error, get_no_puzzle_marker_error('TODO')
|
|
100
|
-
end
|
|
101
|
-
/TODO:?\s+#\s/.match(line) do |_|
|
|
102
|
-
raise Error, get_space_after_hash_error('TODO')
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
105
|
# Fetch puzzle
|
|
107
106
|
def puzzle(lines, match, idx)
|
|
108
|
-
|
|
107
|
+
col_idx = match[0].length - match[0].lstrip.length
|
|
108
|
+
tail = tail(lines, match[1], col_idx)
|
|
109
109
|
body = "#{match[3]} #{tail.join(' ')}".gsub(/\s+/, ' ').strip
|
|
110
110
|
body = body.chomp('*/-->').strip
|
|
111
111
|
marker = marker(match[2])
|
|
@@ -141,20 +141,30 @@ against the rules explained here: https://github.com/cqfn/pdd#how-to-format"
|
|
|
141
141
|
min
|
|
142
142
|
end
|
|
143
143
|
|
|
144
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
|
145
|
+
# @todo #209:30min temporarily disabled cyclomatic complexity for the method.
|
|
146
|
+
# below. Please fix soon.
|
|
147
|
+
#
|
|
144
148
|
# Fetch puzzle tail (all lines after the first one)
|
|
145
149
|
def tail(lines, prefix, start)
|
|
150
|
+
prefix = prefix.rstrip
|
|
151
|
+
prefix = " #{' ' * start}" if prefix.empty? # fallback to space indentation
|
|
152
|
+
line = lines[0][prefix.length + 1, lines[0].length] if lines[0]
|
|
153
|
+
is_indented = line&.start_with?(' ')
|
|
146
154
|
lines
|
|
147
155
|
.take_while { |t| match_markers(t).none? && t.start_with?(prefix) }
|
|
156
|
+
.take_while do |t|
|
|
157
|
+
!is_indented || t[prefix.length + 1, t.length].start_with?(' ')
|
|
158
|
+
end
|
|
159
|
+
.take_while do |t|
|
|
160
|
+
# account for carriage return in line endings
|
|
161
|
+
t_len = t.length - 1
|
|
162
|
+
t_len <= prefix.length || t_len > prefix.length + 2
|
|
163
|
+
end
|
|
148
164
|
.map { |t| t[prefix.length, t.length] }
|
|
149
|
-
.
|
|
150
|
-
.each_with_index do |t, i|
|
|
151
|
-
next if t.start_with?(' ')
|
|
152
|
-
|
|
153
|
-
raise Error, "Space expected at #{start + i + 2}:#{prefix.length}; \
|
|
154
|
-
make sure all lines in the puzzle body have a single leading space."
|
|
155
|
-
end
|
|
156
|
-
.map { |t| t[1, t.length] }
|
|
165
|
+
.map { |t| t.start_with?(' ') ? t[1, t.length] : t }
|
|
157
166
|
end
|
|
167
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
|
158
168
|
|
|
159
169
|
# @todo #75:30min Let's make it possible to fetch Subversion data
|
|
160
170
|
# in a similar way as we are doing with Git. We should also just
|
data/lib/pdd/sources.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
# SOFTWARE.
|
|
20
20
|
|
|
21
21
|
require 'rainbow'
|
|
22
|
-
require 'shellwords'
|
|
23
22
|
require 'English'
|
|
23
|
+
require 'filemagic'
|
|
24
24
|
require_relative 'source'
|
|
25
25
|
require_relative '../../utils/glob'
|
|
26
26
|
|
|
@@ -77,20 +77,20 @@ module PDD
|
|
|
77
77
|
|
|
78
78
|
private
|
|
79
79
|
|
|
80
|
-
# @todo #98:30min Change the implementation of this method
|
|
81
|
-
# to also work in Windows machines. Investigate the possibility
|
|
82
|
-
# of use a gem for this. After that, remove the skip of the test
|
|
83
|
-
# `test_ignores_binary_files` in `test_sources.rb`.
|
|
84
80
|
def binary?(file)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
`grep -qI '.' #{Shellwords.escape(file)}`
|
|
88
|
-
if $CHILD_STATUS.success?
|
|
81
|
+
if text_file?(file)
|
|
89
82
|
false
|
|
90
83
|
else
|
|
91
84
|
PDD.log.info "#{file} is a binary file (#{File.size(file)} bytes)"
|
|
92
85
|
true
|
|
93
86
|
end
|
|
94
87
|
end
|
|
88
|
+
|
|
89
|
+
def text_file?(file)
|
|
90
|
+
fm = FileMagic.new(FileMagic::MAGIC_MIME)
|
|
91
|
+
fm.file(file) =~ %r{^text/}
|
|
92
|
+
ensure
|
|
93
|
+
fm.close
|
|
94
|
+
end
|
|
95
95
|
end
|
|
96
96
|
end
|
data/lib/pdd/version.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
|
|
21
21
|
# PDD main module.
|
|
22
22
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
23
|
-
# Copyright:: Copyright (c) 2014-
|
|
23
|
+
# Copyright:: Copyright (c) 2014-2022 Yegor Bugayenko
|
|
24
24
|
# License:: MIT
|
|
25
25
|
module PDD
|
|
26
|
-
VERSION = '0.
|
|
26
|
+
VERSION = '0.21.2'.freeze
|
|
27
27
|
end
|
data/lib/pdd.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -30,7 +30,7 @@ require_relative 'pdd/rule/roles'
|
|
|
30
30
|
|
|
31
31
|
# PDD main module.
|
|
32
32
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
33
|
-
# Copyright:: Copyright (c) 2014-
|
|
33
|
+
# Copyright:: Copyright (c) 2014-2022 Yegor Bugayenko
|
|
34
34
|
# License:: MIT
|
|
35
35
|
module PDD
|
|
36
36
|
# If it breaks.
|
data/pdd.gemspec
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -47,6 +47,7 @@ Gem::Specification.new do |s|
|
|
|
47
47
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
|
48
48
|
s.add_runtime_dependency 'nokogiri', '~> 1.10'
|
|
49
49
|
s.add_runtime_dependency 'rainbow', '~> 3.0'
|
|
50
|
+
s.add_runtime_dependency 'ruby-filemagic', '~> 0.7.2'
|
|
50
51
|
s.add_runtime_dependency 'slop', '~> 4.6'
|
|
51
52
|
s.add_development_dependency 'aruba', '~> 0.14.1'
|
|
52
53
|
s.add_development_dependency 'codecov', '0.2.12'
|
data/test/test__helper.rb
CHANGED
data/test/test_duplicates.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -24,7 +24,7 @@ require_relative '../lib/pdd/rule/duplicates'
|
|
|
24
24
|
|
|
25
25
|
# PDD::Rule::MaxDuplicates class test.
|
|
26
26
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
27
|
-
# Copyright:: Copyright (c) 2014-
|
|
27
|
+
# Copyright:: Copyright (c) 2014-2022 Yegor Bugayenko
|
|
28
28
|
# License:: MIT
|
|
29
29
|
class TestMaxDuplicates < Minitest::Test
|
|
30
30
|
def test_max_duplicates
|
data/test/test_estimates.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -24,7 +24,7 @@ require_relative '../lib/pdd/rule/estimates'
|
|
|
24
24
|
|
|
25
25
|
# PDD::Rule::Estimate module tests.
|
|
26
26
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
27
|
-
# Copyright:: Copyright (c) 2014-
|
|
27
|
+
# Copyright:: Copyright (c) 2014-2022 Yegor Bugayenko
|
|
28
28
|
# License:: MIT
|
|
29
29
|
class TestEstimates < Minitest::Test
|
|
30
30
|
def test_min
|
data/test/test_pdd.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -26,7 +26,7 @@ require_relative '../lib/pdd'
|
|
|
26
26
|
|
|
27
27
|
# PDD main module test.
|
|
28
28
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
29
|
-
# Copyright:: Copyright (c) 2014-
|
|
29
|
+
# Copyright:: Copyright (c) 2014-2022 Yegor Bugayenko
|
|
30
30
|
# License:: MIT
|
|
31
31
|
class TestPDD < Minitest::Test
|
|
32
32
|
def test_basic
|
data/test/test_roles.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -24,7 +24,7 @@ require_relative '../lib/pdd/rule/roles'
|
|
|
24
24
|
|
|
25
25
|
# PDD::Rule::Role module tests.
|
|
26
26
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
27
|
-
# Copyright:: Copyright (c) 2014-
|
|
27
|
+
# Copyright:: Copyright (c) 2014-2022 Yegor Bugayenko
|
|
28
28
|
# License:: MIT
|
|
29
29
|
class TestRoles < Minitest::Test
|
|
30
30
|
def test_incorrect_role
|
data/test/test_source.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -22,10 +22,11 @@ require 'minitest/autorun'
|
|
|
22
22
|
require 'tmpdir'
|
|
23
23
|
require_relative '../lib/pdd'
|
|
24
24
|
require_relative '../lib/pdd/sources'
|
|
25
|
+
require_relative 'test__helper'
|
|
25
26
|
|
|
26
27
|
# Source test.
|
|
27
28
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
28
|
-
# Copyright:: Copyright (c) 2014-
|
|
29
|
+
# Copyright:: Copyright (c) 2014-2022 Yegor Bugayenko
|
|
29
30
|
# License:: MIT
|
|
30
31
|
class TestSource < Minitest::Test
|
|
31
32
|
def test_parsing
|
|
@@ -47,7 +48,8 @@ class TestSource < Minitest::Test
|
|
|
47
48
|
assert_equal 2, list.size
|
|
48
49
|
puzzle = list.first
|
|
49
50
|
assert_equal '2-3', puzzle.props[:lines]
|
|
50
|
-
assert_equal 'привет, how are you doing?',
|
|
51
|
+
assert_equal 'привет, how are you doing?', \
|
|
52
|
+
puzzle.props[:body]
|
|
51
53
|
assert_equal '44', puzzle.props[:ticket]
|
|
52
54
|
assert puzzle.props[:author].nil?
|
|
53
55
|
assert puzzle.props[:email].nil?
|
|
@@ -78,20 +80,74 @@ class TestSource < Minitest::Test
|
|
|
78
80
|
end
|
|
79
81
|
end
|
|
80
82
|
|
|
81
|
-
def
|
|
83
|
+
def test_no_prefix_multiline_puzzle_block
|
|
82
84
|
Dir.mktmpdir 'test' do |dir|
|
|
83
85
|
file = File.join(dir, 'a.txt')
|
|
84
86
|
File.write(
|
|
85
87
|
file,
|
|
86
88
|
"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
<!--
|
|
90
|
+
\x40todo #01:30min correctly formatted multi-line puzzle, with no
|
|
91
|
+
comment prefix before todo marker
|
|
92
|
+
-->
|
|
89
93
|
"
|
|
90
94
|
)
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
stub_source_find_github_user(file, 'hey') do |source|
|
|
96
|
+
PDD.opts = nil
|
|
97
|
+
assert_equal 1, source.puzzles.size
|
|
98
|
+
puzzle = source.puzzles.last
|
|
99
|
+
assert_equal '3-4', puzzle.props[:lines]
|
|
100
|
+
assert_equal 'correctly formatted multi-line puzzle, with no ' \
|
|
101
|
+
'comment prefix before todo marker', puzzle.props[:body]
|
|
102
|
+
assert_equal '01', puzzle.props[:ticket]
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def test_space_indented_multiline_puzzle_block
|
|
108
|
+
Dir.mktmpdir 'test' do |dir|
|
|
109
|
+
file = File.join(dir, 'a.txt')
|
|
110
|
+
File.write(
|
|
111
|
+
file,
|
|
112
|
+
"
|
|
113
|
+
# \x40todo #99:30min hello
|
|
114
|
+
# good bye
|
|
115
|
+
# hello again
|
|
116
|
+
"
|
|
117
|
+
)
|
|
118
|
+
stub_source_find_github_user(file, 'hey') do |source|
|
|
119
|
+
PDD.opts = nil
|
|
120
|
+
assert_equal 1, source.puzzles.size
|
|
121
|
+
puzzle = source.puzzles.last
|
|
122
|
+
assert_equal '2-3', puzzle.props[:lines]
|
|
123
|
+
assert_equal 'hello good bye', puzzle.props[:body]
|
|
124
|
+
assert_equal '99', puzzle.props[:ticket]
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def test_multiple_puzzles_single_comment_block
|
|
130
|
+
Dir.mktmpdir 'test' do |dir|
|
|
131
|
+
file = File.join(dir, 'a.txt')
|
|
132
|
+
File.write(
|
|
133
|
+
file,
|
|
134
|
+
"
|
|
135
|
+
/*
|
|
136
|
+
* \x40todo #1 First one with
|
|
137
|
+
* a few lines
|
|
138
|
+
* \x40todo #1 Second one also
|
|
139
|
+
* with a few lines
|
|
140
|
+
*/
|
|
141
|
+
"
|
|
142
|
+
)
|
|
143
|
+
stub_source_find_github_user(file, 'hey') do |source|
|
|
144
|
+
PDD.opts = nil
|
|
145
|
+
assert_equal 2, source.puzzles.size
|
|
146
|
+
puzzle = source.puzzles.last
|
|
147
|
+
assert_equal '5-6', puzzle.props[:lines]
|
|
148
|
+
assert_equal 'Second one also with a few lines', puzzle.props[:body]
|
|
149
|
+
assert_equal '1', puzzle.props[:ticket]
|
|
93
150
|
end
|
|
94
|
-
assert !error.message.index('Space expected').nil?
|
|
95
151
|
end
|
|
96
152
|
end
|
|
97
153
|
|
|
@@ -101,10 +157,10 @@ class TestSource < Minitest::Test
|
|
|
101
157
|
File.write(
|
|
102
158
|
file,
|
|
103
159
|
"
|
|
104
|
-
* \x40todo #44 this is
|
|
160
|
+
* \x40todo #44 this is a correctly formatted puzzle,
|
|
105
161
|
* with a second line without a leading space
|
|
106
162
|
Another badly formatted puzzle
|
|
107
|
-
* \x40todo this puzzle misses ticket name/number
|
|
163
|
+
* \x40todo this bad puzzle misses ticket name/number
|
|
108
164
|
Something else
|
|
109
165
|
* \x40todo #123 This puzzle is correctly formatted
|
|
110
166
|
"
|
|
@@ -113,11 +169,12 @@ class TestSource < Minitest::Test
|
|
|
113
169
|
stub_source_find_github_user(file, 'hey') do |source|
|
|
114
170
|
list = source.puzzles
|
|
115
171
|
PDD.opts = nil
|
|
116
|
-
assert_equal
|
|
172
|
+
assert_equal 2, list.size
|
|
117
173
|
puzzle = list.first
|
|
118
|
-
assert_equal '
|
|
119
|
-
assert_equal '
|
|
120
|
-
|
|
174
|
+
assert_equal '2-3', puzzle.props[:lines]
|
|
175
|
+
assert_equal 'this is a correctly formatted puzzle, with a second ' \
|
|
176
|
+
'line without a leading space', puzzle.props[:body]
|
|
177
|
+
assert_equal '44', puzzle.props[:ticket]
|
|
121
178
|
end
|
|
122
179
|
end
|
|
123
180
|
end
|
data/test/test_source_todo.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -53,7 +53,7 @@ class TestSourceTodo < Minitest::Test
|
|
|
53
53
|
def test_todo_parsing
|
|
54
54
|
check_valid_puzzle(
|
|
55
55
|
"
|
|
56
|
-
//
|
|
56
|
+
// @todo #45 task description
|
|
57
57
|
",
|
|
58
58
|
'2-2',
|
|
59
59
|
'task description',
|
|
@@ -64,7 +64,7 @@ class TestSourceTodo < Minitest::Test
|
|
|
64
64
|
def test_todo_parsing_multi_line
|
|
65
65
|
check_valid_puzzle(
|
|
66
66
|
"
|
|
67
|
-
//
|
|
67
|
+
// @todo #45 task description
|
|
68
68
|
// second line
|
|
69
69
|
",
|
|
70
70
|
'2-3',
|
|
@@ -121,24 +121,6 @@ class TestSourceTodo < Minitest::Test
|
|
|
121
121
|
)
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
-
def test_todo_failing_no_space_on_second_line
|
|
125
|
-
check_invalid_puzzle(
|
|
126
|
-
"
|
|
127
|
-
* TODO #45 this puzzle
|
|
128
|
-
* has not space on second line",
|
|
129
|
-
'Space expected'
|
|
130
|
-
)
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
def test_todo_colon_failing_no_space_on_second_line
|
|
134
|
-
check_invalid_puzzle(
|
|
135
|
-
"
|
|
136
|
-
* TODO: #45 this puzzle
|
|
137
|
-
* has not space on second line",
|
|
138
|
-
'Space expected'
|
|
139
|
-
)
|
|
140
|
-
end
|
|
141
|
-
|
|
142
124
|
def test_todo_failing_no_ticket
|
|
143
125
|
check_invalid_puzzle(
|
|
144
126
|
"
|
data/test/test_sources.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -26,7 +26,7 @@ require_relative '../lib/pdd/sources'
|
|
|
26
26
|
|
|
27
27
|
# Sources test.
|
|
28
28
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
29
|
-
# Copyright:: Copyright (c) 2014-
|
|
29
|
+
# Copyright:: Copyright (c) 2014-2022 Yegor Bugayenko
|
|
30
30
|
# License:: MIT
|
|
31
31
|
class TestSources < Minitest::Test
|
|
32
32
|
def test_iterator
|
|
@@ -37,7 +37,6 @@ class TestSources < Minitest::Test
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def test_ignores_binary_files
|
|
40
|
-
skip if Gem.win_platform?
|
|
41
40
|
in_temp([]) do |dir|
|
|
42
41
|
[
|
|
43
42
|
'README.md',
|
data/test/test_text.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -24,7 +24,7 @@ require_relative '../lib/pdd/rule/text'
|
|
|
24
24
|
|
|
25
25
|
# PDD::Rule::Text module tests.
|
|
26
26
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
27
|
-
# Copyright:: Copyright (c) 2014-
|
|
27
|
+
# Copyright:: Copyright (c) 2014-2022 Yegor Bugayenko
|
|
28
28
|
# License:: MIT
|
|
29
29
|
class TestText < Minitest::Test
|
|
30
30
|
def test_min_words
|
data/utils/glob.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2014-
|
|
1
|
+
# Copyright (c) 2014-2022 Yegor Bugayenko
|
|
2
2
|
#
|
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
4
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -27,7 +27,6 @@ class Glob
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# rubocop:disable Metrics/CyclomaticComplexity
|
|
30
|
-
# rubocop:disable Metrics/MethodLength
|
|
31
30
|
def to_regexp
|
|
32
31
|
chars = @glob_string.gsub(%r{(\*\*\/\*)|(\*\*)}, '*').split('')
|
|
33
32
|
in_curlies = 0, escaping = false
|
|
@@ -63,5 +62,4 @@ class Glob
|
|
|
63
62
|
end.join
|
|
64
63
|
end
|
|
65
64
|
# rubocop:enable Metrics/CyclomaticComplexity
|
|
66
|
-
# rubocop:enable Metrics/MethodLength
|
|
67
65
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pdd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.21.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|
|
@@ -38,6 +38,20 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '3.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: ruby-filemagic
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 0.7.2
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 0.7.2
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
56
|
name: slop
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -219,18 +233,19 @@ files:
|
|
|
219
233
|
- ".gitattributes"
|
|
220
234
|
- ".github/ISSUE_TEMPLATE.md"
|
|
221
235
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
|
236
|
+
- ".github/workflows/codecov.yml"
|
|
237
|
+
- ".github/workflows/rake.yml"
|
|
222
238
|
- ".gitignore"
|
|
223
239
|
- ".overcommit.yml"
|
|
224
240
|
- ".pdd"
|
|
225
241
|
- ".rubocop.yml"
|
|
226
242
|
- ".rultor.yml"
|
|
227
243
|
- ".simplecov"
|
|
228
|
-
-
|
|
244
|
+
- CITATION.cff
|
|
229
245
|
- Gemfile
|
|
230
246
|
- LICENSE.txt
|
|
231
247
|
- README.md
|
|
232
248
|
- Rakefile
|
|
233
|
-
- appveyor.yml
|
|
234
249
|
- assets/puzzles.xsd
|
|
235
250
|
- assets/puzzles.xsl
|
|
236
251
|
- bin/pdd
|
data/.travis.yml
DELETED
data/appveyor.yml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
version: '{build}'
|
|
2
|
-
skip_tags: true
|
|
3
|
-
clone_depth: 10
|
|
4
|
-
branches:
|
|
5
|
-
only:
|
|
6
|
-
- master
|
|
7
|
-
except:
|
|
8
|
-
- gh-pages
|
|
9
|
-
os: Windows Server 2012
|
|
10
|
-
install:
|
|
11
|
-
- cmd: SET PATH=C:\Ruby23-x64\bin;%PATH%
|
|
12
|
-
- cmd: ruby --version
|
|
13
|
-
- cmd: git --version
|
|
14
|
-
build_script:
|
|
15
|
-
- bundle update
|
|
16
|
-
- bundle install
|
|
17
|
-
test_script:
|
|
18
|
-
- rake
|
|
19
|
-
cache:
|
|
20
|
-
- C:\Ruby200\bin -> pdd.gemspec
|
|
21
|
-
- C:\Ruby200\lib\ruby\gems\2.0.0 -> pdd.gemspec
|