pdd 0.20.1 → 0.20.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5fca58ea078cc5bc97f2f17c458fceeb5d3d1b20
4
- data.tar.gz: 3e37cbadfa32e0138cb2645e73a8b9c4274c9860
2
+ SHA256:
3
+ metadata.gz: 94bad35283e2d4e40df39ffa9a643c1352a4674cb500123fb0442af9c3af082d
4
+ data.tar.gz: a451b9e8a979d64fbcae9e5cb279cc6c25c87ba9d7d1618e740083444a37cc12
5
5
  SHA512:
6
- metadata.gz: e85ce3f366f82a024373196bc5833611edd06a97b9df0bf50f60eb740c296ddcb7a31dd8d207d7050be8e9ebb17927a9a43abc16b1589c4ac785762206e4c4b3
7
- data.tar.gz: 9cb534c83838da1b141c260b844ff54270421e60a379dafa8a48bef2c5f355bca321e5083951f522b71601bb6f298b0ee8a16120b33a85205a65ec820ec1f14e
6
+ metadata.gz: b71f4e3eafa987be5233a8f29ec25b8c72bbb6eebd36cf9f9b23b01b1c09767ea4cd395c9c6f369068d87a41bd638dc6a7e5588ebeb7b21f60d6fd5db9e0e043
7
+ data.tar.gz: 075700135e8e66e28c2db6cff9b613d76fdb464529ad164fae32f6c179e840197e2e946622c7ce87419422b3d4029b1c584d59f302a30581febf832b730fadc6
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ Gemfile.lock
5
5
  .bundle/
6
6
  .DS_Store
7
7
  rdoc/
8
+ tmp/
data/.pdd CHANGED
@@ -1,11 +1,20 @@
1
1
  --source=.
2
2
  --verbose
3
+ --exclude .idea/**/*
3
4
  --exclude target/**/*
4
5
  --exclude coverage/**/*
5
- --exclude features/**/*
6
6
  --exclude README.md
7
+ --exclude features/cli.feature
8
+ --exclude features/parsing.feature
9
+ --exclude features/catches_broken_puzzles.feature
10
+ --exclude features/uses_config.feature
11
+ --exclude features/html_output.feature
12
+ --exclude features/avoiding_duplicates.feature
13
+ --exclude features/applies_rules.feature
14
+ --exclude features/unicode.feature
7
15
  --exclude lib/pdd/source.rb
8
16
  --exclude test/test_source.rb
17
+ --exclude test/test_source_todo.rb
9
18
  --exclude test/test_pdd.rb
10
19
  --exclude src/main/resources/images/**/*
11
20
  --rule min-words:20
@@ -1,18 +1,23 @@
1
1
  AllCops:
2
2
  Exclude:
3
- - 'bin/**/*'
4
3
  - 'assets/**/*'
5
4
  DisplayCopNames: true
5
+ TargetRubyVersion: 2.3
6
6
 
7
- Style/EndOfLine:
7
+ Layout/EndOfLine:
8
8
  EnforcedStyle: lf
9
- Style/MethodLength:
9
+ Metrics/ClassLength:
10
+ Max: 300
11
+ Metrics/MethodLength:
10
12
  Max: 30
11
- Style/ClassLength:
12
- Max: 150
13
13
  Metrics/AbcSize:
14
14
  Max: 40
15
15
  Style/MultilineBlockChain:
16
16
  Enabled: false
17
17
  Metrics/BlockLength:
18
18
  Max: 50
19
+ # @todo #123:30m Needs to enable this check and fix all issues.
20
+ # For now, this is out of the scope of this issue.
21
+ # This issue appeared after update TargetRubyVersion to 2.3
22
+ Style/FrozenStringLiteralComment:
23
+ Enabled: false
@@ -1,14 +1,16 @@
1
1
  assets:
2
- rubygems.yml: zerocracy/home#assets/rubygems.yml
3
- s3cfg: zerocracy/home#assets/s3cfg
2
+ rubygems.yml: yegor256/home#assets/rubygems.yml
3
+ s3cfg: yegor256/home#assets/s3cfg
4
4
  install: |
5
- sudo gem install pdd
6
- sudo gem install xcop
5
+ export GEM_HOME=~/.ruby
6
+ export GEM_PATH=$GEM_HOME:$GEM_PATH
7
+ sudo gem install pdd -v 0.20.5
8
+ sudo gem install xcop -v 0.6
9
+ bundle install
7
10
  release:
8
11
  script: |-
9
- env
10
- bundle install
11
- LC_ALL=US-ASCII rake
12
+ pdd -f /dev/null
13
+ LC_ALL=US-ASCII bundle exec rake
12
14
  rm -rf *.gem
13
15
  sed -i "s/1\.0\.snapshot/${tag}/g" lib/pdd/version.rb
14
16
  git add lib/pdd/version.rb
@@ -16,16 +18,15 @@ release:
16
18
  gem build pdd.gemspec
17
19
  chmod 0600 ../rubygems.yml
18
20
  gem push *.gem --config-file ../rubygems.yml
19
- sudo gem install pdd
20
21
  pdd --source=$(pwd) --verbose --file=pdd.xml -e=test/** -e=features/** -e=coverage/**/* -e=README.md
21
22
  s3cmd --no-progress put pdd.xml --config=../s3cfg s3://pdd.teamed.io/pdd.xml
22
23
  s3cmd --no-progress put assets/puzzles.xsd --acl-public --config=../s3cfg s3://pdd-xsd.teamed.io/${tag}.xsd
23
24
  s3cmd --no-progress put assets/puzzles.xsl --acl-public --config=../s3cfg s3://pdd-xsl.teamed.io/${tag}.xsl
24
- commanders:
25
- - yegor256
26
- architect:
27
- - yegor256
28
- - davvd
29
25
  merge:
30
- commanders: []
31
- deploy: {}
26
+ script: |-
27
+ pdd -f /dev/null
28
+ LC_ALL=US-ASCII bundle exec rake
29
+ deploy:
30
+ script: |-
31
+ echo 'Nothing to deploy'
32
+ exit -1
data/.simplecov CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2020 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
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
3
+ - 2.3.0
4
4
  cache: bundler
5
5
  branches:
6
6
  only:
@@ -8,6 +8,6 @@ branches:
8
8
  install:
9
9
  - travis_retry bundle update
10
10
  script:
11
- - rake
11
+ - bundle exec rake
12
12
  after_success:
13
13
  - "bash <(curl -s https://codecov.io/bash)"
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2020 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
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2014-2018 Yegor Bugayenko
3
+ Copyright (c) 2014-2020 Yegor Bugayenko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the 'Software'), to deal
data/README.md CHANGED
@@ -1,29 +1,33 @@
1
1
  <img src="https://avatars2.githubusercontent.com/u/24456188" width="64px" height="64px"/>
2
2
 
3
- [![EO principles respected here](https://cdn.rawgit.com/yegor256/elegantobjects.github.io/master/badge.svg)](http://www.elegantobjects.org)
3
+ [![Donate via Zerocracy](https://www.0crat.com/contrib-badge/C3T46CUJJ.svg)](https://www.0crat.com/contrib/C3T46CUJJ)
4
+
5
+ [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
4
6
  [![Managed by Zerocracy](https://www.0crat.com/badge/C3T46CUJJ.svg)](https://www.0crat.com/p/C3T46CUJJ)
5
7
  [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/pdd)](http://www.rultor.com/p/yegor256/pdd)
6
- [![We recommend RubyMine](http://img.teamed.io/rubymine-recommend.svg)](https://www.jetbrains.com/ruby/)
8
+ [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
7
9
 
8
10
  [![Build Status](https://travis-ci.org/yegor256/pdd.svg)](https://travis-ci.org/yegor256/pdd)
9
11
  [![Build status](https://ci.appveyor.com/api/projects/status/b59sdhuu0gcku15b?svg=true)](https://ci.appveyor.com/project/yegor256/pdd)
10
12
  [![PDD status](http://www.0pdd.com/svg?name=yegor256/pdd)](http://www.0pdd.com/p?name=yegor256/pdd)
11
- [![Gem Version](https://badge.fury.io/rb/pdd.svg)](http://badge.fury.io/rb/pdd)
12
- [![Dependency Status](https://gemnasium.com/yegor256/pdd.svg)](https://gemnasium.com/yegor256/pdd)
13
- [![Code Climate](http://img.shields.io/codeclimate/github/yegor256/pdd.svg)](https://codeclimate.com/github/yegor256/pdd)
14
13
  [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/pdd.svg)](https://codecov.io/github/yegor256/pdd?branch=master)
14
+ [![Hits-of-Code](https://hitsofcode.com/github/yegor256/pdd)](https://hitsofcode.com/view/github/yegor256/pdd)
15
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/pdd/blob/master/LICENSE.txt)
15
16
 
16
- ## What This is for?
17
+ [![Gem Version](https://badge.fury.io/rb/pdd.svg)](http://badge.fury.io/rb/pdd)
18
+ [![Maintainability](https://api.codeclimate.com/v1/badges/c8e46256fdd8ddc817e5/maintainability)](https://codeclimate.com/github/yegor256/pdd/maintainability)
19
+ [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/pdd/master/frames)
17
20
 
18
21
  Read this article about
19
- [Puzzle Driven Development](http://www.yegor256.com/2009/03/04/pdd.html).
22
+ [_Puzzle Driven Development_](http://www.yegor256.com/2009/03/04/pdd.html).
20
23
  Check also patent application [US 12/840,306](http://www.google.com/patents/US20120023476)
21
24
 
22
25
  Also, check [0pdd.com](http://www.0pdd.com): a hosted service,
23
- where this command line tool works for you. Read this first:
24
- [PDD in Action](http://www.yegor256.com/2017/04/05/pdd-in-action.html).
26
+ where this command line tool works for you.
25
27
 
26
- ## How to Install?
28
+ Read
29
+ [_PDD in Action_](http://www.yegor256.com/2017/04/05/pdd-in-action.html)
30
+ and watch [this webinar](https://www.youtube.com/watch?v=nsYGC2aUwfQ).
27
31
 
28
32
  Install it first:
29
33
 
@@ -31,8 +35,6 @@ Install it first:
31
35
  $ gem install pdd
32
36
  ```
33
37
 
34
- ## How to Run?
35
-
36
38
  Run it locally and read its output:
37
39
 
38
40
  ```bash
@@ -52,6 +54,16 @@ pdd --exclude=src/**/* # exclude all files in src/
52
54
  Every puzzle has to be formatted like this (pay attention
53
55
  to the leading space in every consecutive line):
54
56
 
57
+ ```java
58
+ /**
59
+ * @todo #[issue#]<:[time]></[role]> <[description]>
60
+ */
61
+ [related code]
62
+ ```
63
+ \[\] - Replace with apropriate data (see text enclosed in brackets)
64
+ <> - Omitable (enclosed data can be left out)
65
+
66
+ Example:
55
67
  ```java
56
68
  /**
57
69
  * @todo #234:15m/DEV This is something to do later
@@ -167,36 +179,22 @@ The most interesting parts of each puzzle are:
167
179
 
168
180
  * `lines` is where the puzzle is found, inside the file.
169
181
 
170
- ## How to contribute?
182
+ ## How to contribute
171
183
 
172
- Just submit a pull request. Make sure `rake` passes.
184
+ Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
185
+ Make sure you build is green before you contribute
186
+ your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
187
+ [Bundler](https://bundler.io/) installed. Then:
188
+
189
+ ```
190
+ $ bundle update
191
+ $ bundle exec rake
192
+ ```
193
+
194
+ If it's clean and you don't see any error messages, submit your pull request.
173
195
 
174
196
  This is how you run the tool locally to test how it works:
175
197
 
176
198
  ```bash
177
199
  $ ./bin/pdd --help
178
200
  ```
179
-
180
- ## License
181
-
182
- (The MIT License)
183
-
184
- Copyright (c) 2016-2018 Yegor Bugayenko
185
-
186
- Permission is hereby granted, free of charge, to any person obtaining a copy
187
- of this software and associated documentation files (the 'Software'), to deal
188
- in the Software without restriction, including without limitation the rights
189
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
190
- copies of the Software, and to permit persons to whom the Software is
191
- furnished to do so, subject to the following conditions:
192
-
193
- The above copyright notice and this permission notice shall be included in all
194
- copies or substantial portions of the Software.
195
-
196
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
197
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
198
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
199
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
200
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
201
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
202
- SOFTWARE.
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2020 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
@@ -2,7 +2,7 @@
2
2
  <!--
3
3
  (The MIT License)
4
4
 
5
- Copyright (c) 2014-2018 Yegor Bugayenko
5
+ Copyright (c) 2014-2020 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
@@ -2,7 +2,7 @@
2
2
  <!--
3
3
  (The MIT License)
4
4
 
5
- Copyright (c) 2014-2018 Yegor Bugayenko
5
+ Copyright (c) 2014-2020 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-2018 Yegor Bugayenko
2
+ # Copyright (c) 2014-2020 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
@@ -53,7 +53,7 @@ begin
53
53
  o.string '-s', '--source', 'Source directory to parse ("." by default)'
54
54
  o.string '-f', '--file', 'File to save XML into'
55
55
  o.array '-e', '--exclude', 'Glob pattern to exclude, e.g. "**/*.jpg"',
56
- default: []
56
+ default: []
57
57
  o.string '-t', '--format', 'Format of the report (xml|html)'
58
58
  o.array(
59
59
  '-r', '--rule', 'Rule to apply (can be used many times)',
@@ -100,7 +100,7 @@ rescue SystemExit => ex
100
100
  PDD.log.info "Exit code is #{ex.status}"
101
101
  exit(ex.status)
102
102
  rescue PDD::Error => ex
103
- puts "#{Rainbow('ERROR').red}: #{ex.message}. \
103
+ puts "#{Rainbow('ERROR').red}: #{ex.message}
104
104
  If you can't understand the cause of this issue or you don't know \
105
105
  how to fix it, please submit a GitHub issue, we will try to help you: \
106
106
  https://github.com/yegor256/pdd/issues. This tool is still in its beta \
@@ -0,0 +1,19 @@
1
+ Feature: Rake Task
2
+ Scenario: For now we failed if run rake task
3
+ Given It is Unix
4
+ And a file named "Rakefile" with:
5
+ """
6
+ require 'pdd/rake_task'
7
+ PDD::RakeTask.new
8
+ """
9
+ When I run the following commands with `bash`:
10
+ """bash
11
+ rake pdd
12
+ """
13
+ Then the exit status should be 1
14
+ And the stderr should contain:
15
+ """
16
+ NOT IMPLEMENTED
17
+ """
18
+ When I remove a file named "Rakefile" with full force
19
+ Then a file named "Rakefile" does not exist
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2020 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
@@ -111,6 +111,12 @@ When(/^I run bash with$/) do |text|
111
111
  @exitstatus = $CHILD_STATUS.exitstatus
112
112
  end
113
113
 
114
+ When(/^I run bash with "([^"]*)"$/) do |text|
115
+ FileUtils.copy_entry(@cwd, File.join(@dir, 'pdd'))
116
+ @stdout = `#{text}`
117
+ @exitstatus = $CHILD_STATUS.exitstatus
118
+ end
119
+
114
120
  Given(/^It is Unix$/) do
115
121
  pending if Gem.win_platform?
116
122
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2020 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,3 +20,4 @@
20
20
 
21
21
  require 'simplecov'
22
22
  require_relative '../../lib/pdd'
23
+ require 'aruba/cucumber'
data/lib/pdd.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2020 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-2018 Yegor Bugayenko
33
+ # Copyright:: Copyright (c) 2014-2020 Yegor Bugayenko
34
34
  # License:: MIT
35
35
  module PDD
36
36
  # If it breaks.
@@ -87,11 +87,9 @@ module PDD
87
87
  PDD.log.info "Reading #{dir}"
88
88
  require_relative 'pdd/sources'
89
89
  sources = Sources.new(dir)
90
- unless @opts[:exclude].nil?
91
- @opts[:exclude].each do |p|
92
- sources = sources.exclude(p)
93
- PDD.log.info "Excluding #{p}"
94
- end
90
+ @opts[:exclude]&.each do |p|
91
+ sources = sources.exclude(p)
92
+ PDD.log.info "Excluding #{p}"
95
93
  end
96
94
  sanitize(
97
95
  rules(
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2020 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
@@ -0,0 +1,30 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+
4
+ # PDD Rake task
5
+ module PDD
6
+ # Rake task
7
+ class RakeTask < Rake::TaskLib
8
+ attr_accessor :name
9
+ def initialize(*args, &task_block)
10
+ # @todo #125:30m Needs to have more parameters to run this task.
11
+ # For now, we just have a single parameter - the name.
12
+ # Needs more parameters like the xcop rake task has.
13
+ @name = args.shift || :pdd
14
+ desc 'Run PDD' unless ::Rake.application.last_description
15
+ task(name, *args) do |_, task_args|
16
+ RakeFileUtils.send(:verbose, true) do
17
+ yield(*[self, task_args].slice(0, task_block.arity)) if block_given?
18
+ run
19
+ end
20
+ end
21
+ end
22
+
23
+ def run
24
+ # @todo #125:30m need to implement this method.
25
+ # For now, it's just a task,
26
+ # that accepts one parameter and throws a system error.
27
+ abort('NOT IMPLEMENTED')
28
+ end
29
+ end
30
+ end