pdd 0.21.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef027790e2aa528548fcb97f52632e7740f2a28a9ed7180677bf189ba86b504f
4
- data.tar.gz: 2432ac79d70ebb056a6b1338ca52b170e2c7134d14b32d0e8454e34ff86f57ad
3
+ metadata.gz: c76649118dbe4b4884f07d453b611ca05da5845e753357fcb98cd0e6e8324b64
4
+ data.tar.gz: 4b85d7b84b62f8d695d2e8b95a92bc03cb87d5e6acbef283723ac353a43c42cd
5
5
  SHA512:
6
- metadata.gz: 8c91ee447d2b8aefde998e6516fdd1679c845b3a2360f8325a944e0833fe5818f23c7dfb465b0242dabc9828742849220951cbd8e91fc014e9603c78c83e4be8
7
- data.tar.gz: 2910617b72caa5ad9b083fd6e1471fd6dcf8bb9e3ccea0ecf3577c5eaa060e4468f0278798cca1e77ce5ad9b77117486d55e5e3d536308c27931dce9dec0c60d
6
+ metadata.gz: 1a54147d056c4593c20142e9c45497308bc57c0ec34a63e84fc0f025e1722ed406102f9383196cec51a084baffe17d2de4174060c93173328605089410a48dff
7
+ data.tar.gz: 4270c5b9ec6e8b63ca371b2c6c5905b13394d5078943f1c66b8c8ec9ccc30ae25026efd375f3fd2d5bd8c2a1fd29080c86755935d5c91bc6d47baceda89e6edd
data/features/cli.feature CHANGED
@@ -43,8 +43,8 @@ Feature: Command Line Processing
43
43
  """
44
44
  ~~
45
45
  ~~ @todo #44 First
46
- ~~ and second
47
- ~~
46
+ ~~ and
47
+ ~~ second
48
48
  """
49
49
  When I run bin/pdd with "> out.xml"
50
50
  Then Exit code is zero
data/lib/pdd/source.rb CHANGED
@@ -141,12 +141,21 @@ 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)
146
150
  prefix = prefix.rstrip
147
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?(' ')
148
154
  lines
149
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
150
159
  .take_while do |t|
151
160
  # account for carriage return in line endings
152
161
  t_len = t.length - 1
@@ -155,6 +164,7 @@ against the rules explained here: https://github.com/cqfn/pdd#how-to-format"
155
164
  .map { |t| t[prefix.length, t.length] }
156
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/version.rb CHANGED
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2014-2022 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module PDD
26
- VERSION = '0.21.1'.freeze
26
+ VERSION = '0.21.2'.freeze
27
27
  end
data/test/test_source.rb CHANGED
@@ -22,6 +22,7 @@ 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)
@@ -46,8 +47,8 @@ class TestSource < Minitest::Test
46
47
  list = source.puzzles
47
48
  assert_equal 2, list.size
48
49
  puzzle = list.first
49
- assert_equal '2-4', puzzle.props[:lines]
50
- assert_equal 'привет, how are you doing? -something else', \
50
+ assert_equal '2-3', puzzle.props[:lines]
51
+ assert_equal 'привет, how are you doing?', \
51
52
  puzzle.props[:body]
52
53
  assert_equal '44', puzzle.props[:ticket]
53
54
  assert puzzle.props[:author].nil?
@@ -103,6 +104,28 @@ class TestSource < Minitest::Test
103
104
  end
104
105
  end
105
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
+
106
129
  def test_multiple_puzzles_single_comment_block
107
130
  Dir.mktmpdir 'test' do |dir|
108
131
  file = File.join(dir, 'a.txt')
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.21.1
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: 2022-07-11 00:00:00.000000000 Z
11
+ date: 2022-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri