xcop 0.5.8 → 0.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
2
  SHA1:
3
- metadata.gz: b8507828b2196d70b9b79df306a31a811b6ca5d9
4
- data.tar.gz: f9f833f991a65de9f701ada5bb1717685ee61d39
3
+ metadata.gz: f312ede8e5eb272be94c148033aabb506fd4a052
4
+ data.tar.gz: dc39ab92781f946af3bf812d3ae8463186dc3bc3
5
5
  SHA512:
6
- metadata.gz: cad68fb87c16b42d337654724d71832390c1ce3c51fd803fe607127afe47f0e4193767c0673cfedd2da096fbd8fdee063fdc6ff351da300aaf9528145f5dc63d
7
- data.tar.gz: 2439e91f98cbc32c3a79782e8ab3875c06155d10aa3021aed650ca9b1c4858c560253083f6e194a1ce2a6f0f62d379bbe67cc6279e23100ef5734b7df637cfe6
6
+ metadata.gz: 73744c9fbbd406013e2050e73037c771dcd3a67b48fff30df38e499d826894aca110465e7a86336ebb0744aecd4826a95d419a80b7296253405e7e543f97849e
7
+ data.tar.gz: 9759bcc9ff33d8c0ee438120adf4ffa3b25a2237a1576ec33c58ec2f1f5e13e702e2c3f28809350f332f488cad3a76192454a52e6c7f57cb38321f0c191b6d12
@@ -0,0 +1,12 @@
1
+ Make sure the title of the issue explains the problem you are having. Also, the description of the issue must clearly explain what is broken, not what you want us to implement. Go through this checklist and make sure you answer "YES" to all points:
2
+
3
+ - You have all pre-requisites listed in README.md installed
4
+ - You are sure that you are not reporting a duplicate (search all issues)
5
+ - You say "is broken" or "doesn't work" in the title
6
+ - You tell us what you are trying to do
7
+ - You explain the results you are getting
8
+ - You suggest an alternative result you would like to see
9
+
10
+ This article will help you understand what we are looking for: http://www.yegor256.com/2014/11/24/principles-of-bug-tracking.html
11
+
12
+ Thank you for your contribution!
@@ -0,0 +1,11 @@
1
+ Many thanks for your contribution, we truly appreciate it. We will appreciate it even more, if you make sure that you can say "YES" to each point in this short checklist:
2
+
3
+ - You made a small amount of changes (less than 100 lines, less than 10 files)
4
+ - You made changes related to only one bug (create separate PRs for separate problems)
5
+ - You are ready to defend your changes (there will be a code review)
6
+ - You don't touch what you don't understand
7
+ - You ran the build locally and it passed
8
+
9
+ This article will help you understand what we are looking for: http://www.yegor256.com/2015/02/09/serious-code-reviewer.html
10
+
11
+ Thank you for your contribution!
@@ -23,7 +23,7 @@ merge:
23
23
  script: |-
24
24
  bundle install
25
25
  rake
26
- pdd
26
+ pdd -f /dev/null
27
27
  deploy:
28
28
  script: |-
29
29
  echo "There is nothing to deploy"
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
- [![Managed by Zerocracy](http://www.0crat.com/badge/C3RFVLU72.svg)](http://www.0crat.com/p/C3RFVLU72)
1
+ [![EO principles respected here](http://www.elegantobjects.org/badge.svg)](http://www.elegantobjects.org)
2
+ [![Managed by Zerocracy](https://www.0crat.com/badge/C3RFVLU72.svg)](https://www.0crat.com/p/C3RFVLU72)
2
3
  [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/xcop)](http://www.rultor.com/p/yegor256/xcop)
3
- [![We recommend RubyMine](http://img.teamed.io/rubymine-recommend.svg)](https://www.jetbrains.com/ruby/)
4
+ [![We recommend RubyMine](http://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
4
5
 
5
6
  [![Build Status](https://travis-ci.org/yegor256/xcop.svg)](https://travis-ci.org/yegor256/xcop)
6
7
  [![Build status](https://ci.appveyor.com/api/projects/status/orvfo2qgmd1d7a2i?svg=true)](https://ci.appveyor.com/project/yegor256/xcop)
data/bin/xcop CHANGED
@@ -36,6 +36,7 @@ opts = Slop.parse(ARGV, strict: true, help: true) do |o|
36
36
  o.bool '-q', '--quiet', 'Don\'t print anything if there are no errors'
37
37
  o.bool '--version', 'Show current version'
38
38
  o.bool '--fix', 'Fix all files instead of reporting their problems'
39
+ o.bool '--nocolor', 'Suppress colored output'
39
40
  o.string '--license', 'File name of the boilerplate head license'
40
41
  end
41
42
 
@@ -60,7 +61,7 @@ if opts.fix?
60
61
  end
61
62
  else
62
63
  begin
63
- Xcop::CLI.new(opts.arguments, license).run do |f|
64
+ Xcop::CLI.new(opts.arguments, license, opts.nocolor?).run do |f|
64
65
  puts "#{f} looks good" unless opts.quiet?
65
66
  end
66
67
  rescue StandardError => e
@@ -30,15 +30,16 @@ require_relative 'xcop/version'
30
30
  module Xcop
31
31
  # Command line interface.
32
32
  class CLI
33
- def initialize(files, license)
33
+ def initialize(files, license, nocolor = false)
34
34
  @files = files
35
35
  @license = license
36
+ @nocolor = nocolor
36
37
  end
37
38
 
38
39
  def run
39
40
  @files.each do |f|
40
41
  doc = Document.new(f)
41
- diff = doc.diff
42
+ diff = doc.diff(@nocolor)
42
43
  unless diff.empty?
43
44
  puts diff
44
45
  raise "Invalid XML formatting in #{f}"
@@ -72,11 +73,11 @@ module Xcop
72
73
  end
73
74
 
74
75
  # Return the difference, if any (empty string if everything is clean).
75
- def diff
76
+ def diff(nocolor = false)
76
77
  xml = Nokogiri::XML(File.open(@path), &:noblanks)
77
78
  ideal = xml.to_xml(indent: 2)
78
79
  now = File.read(@path)
79
- differ(ideal, now)
80
+ differ(ideal, now, nocolor)
80
81
  end
81
82
 
82
83
  # Return the difference for the license.
@@ -103,10 +104,14 @@ module Xcop
103
104
 
104
105
  private
105
106
 
106
- def differ(ideal, fact)
107
+ def differ(ideal, fact, nocolor = false)
107
108
  return '' if ideal == fact
108
- Differ.format = :color
109
- Differ.diff_by_line(schars(ideal), schars(fact)).to_s
109
+ if nocolor
110
+ Differ.diff_by_line(ideal, fact).to_s
111
+ else
112
+ Differ.format = :color
113
+ Differ.diff_by_line(schars(ideal), schars(fact)).to_s
114
+ end
110
115
  end
111
116
 
112
117
  def schars(text)
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2017-2018 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Xcop
26
- VERSION = '0.5.8'.freeze
26
+ VERSION = '0.6'.freeze
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-03 00:00:00.000000000 Z
11
+ date: 2018-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: differ
@@ -189,6 +189,8 @@ extra_rdoc_files:
189
189
  files:
190
190
  - ".0pdd.yml"
191
191
  - ".gitattributes"
192
+ - ".github/ISSUE_TEMPLATE.md"
193
+ - ".github/PULL_REQUEST_TEMPLATE.md"
192
194
  - ".gitignore"
193
195
  - ".pdd"
194
196
  - ".rubocop.yml"