xcop 0.5.5 → 0.6.1

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: fa06bb31a6307eaf1ce56b0795be9724317f602a
4
- data.tar.gz: 626fd201fd723fd081fc112cb40e282f3d972a95
2
+ SHA256:
3
+ metadata.gz: f94025e78c2d5baff1d8ad8e43dc9ccf2daec6f0f408ed1a558e0608db601371
4
+ data.tar.gz: 752298a36ba76dcbd2c216fa3611d7922235a65428b6c453d731e8a86e7c0eec
5
5
  SHA512:
6
- metadata.gz: 8329081d4b7977c9be2afcca650704e5dc77370af182772538dc27bf1c8568e1bd9e29a26a85c5d1ea52af1eb0feeedbb62ebf6ae4bd592b93f8143c11b2637f
7
- data.tar.gz: 1702c751578d7ff9ca5c6ad4b8353d9f21b7c907627d74d0d68980a535527c6481e35ab91333d163660c77c49958d77891dee22dbe24975af179bd82b79ba933
6
+ metadata.gz: 52bf482faa953e3d364836851d50e2c5d1fde84c6ae5cb86a49e9bddecab3ea3afc19dc31b2a020c5b3e71eab7e542c8a641c08616e1290489826be27361e4f9
7
+ data.tar.gz: 786b9f4b6ac31dbf36befc363aecc6dc75d9b7cdc2a00b074754e1edb9ce57950c56f84be3c656b5b4405f7af7395a7368afd33d2d4926237c13d77cc46d162a
data/.0pdd.yml CHANGED
@@ -3,3 +3,7 @@ errors:
3
3
  # alerts:
4
4
  # github:
5
5
  # - yegor256
6
+
7
+ tags:
8
+ - pdd
9
+ - bug
@@ -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!
@@ -3,6 +3,7 @@ AllCops:
3
3
  - 'bin/**/*'
4
4
  - 'assets/**/*'
5
5
  DisplayCopNames: true
6
+ TargetRubyVersion: 2.2
6
7
 
7
8
  Metrics/CyclomaticComplexity:
8
9
  Max: 10
@@ -12,3 +13,5 @@ Style/MultilineMethodCallIndentation:
12
13
  Enabled: false
13
14
  Metrics/AbcSize:
14
15
  Enabled: false
16
+ Metrics/BlockLength:
17
+ Max: 50
@@ -1,13 +1,15 @@
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
4
3
  install: |
4
+ export GEM_HOME=~/.ruby
5
+ export GEM_PATH=$GEM_HOME:$GEM_PATH
5
6
  sudo apt-get -y update
6
- sudo gem install pdd
7
+ sudo gem install pdd -v 0.20.5
8
+ bundle install
7
9
  release:
8
10
  script: |-
9
- bundle install
10
- rake
11
+ bundle exec rake
12
+ pdd -f /dev/null
11
13
  rm -rf *.gem
12
14
  sed -i "s/1\.0\.snapshot/${tag}/g" lib/xcop/version.rb
13
15
  git add lib/xcop/version.rb
@@ -15,15 +17,10 @@ release:
15
17
  gem build xcop.gemspec
16
18
  chmod 0600 ../rubygems.yml
17
19
  gem push *.gem --config-file ../rubygems.yml
18
- commanders:
19
- - yegor256
20
- architect:
21
- - yegor256
22
20
  merge:
23
21
  script: |-
24
- bundle install
25
- rake
26
- pdd
22
+ bundle exec rake
23
+ pdd -f /dev/null
27
24
  deploy:
28
25
  script: |-
29
26
  echo "There is nothing to deploy"
data/.simplecov CHANGED
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -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,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
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) 2017 Yegor Bugayenko
3
+ Copyright (c) 2017-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,16 +1,19 @@
1
- [![Managed by Zerocracy](http://www.zerocracy.com/badge.svg)](http://www.zerocracy.com)
1
+ <img src="/logo.svg" width="64px"/>
2
+
3
+ [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
4
+ [![Managed by Zerocracy](https://www.0crat.com/badge/C3RFVLU72.svg)](https://www.0crat.com/p/C3RFVLU72)
2
5
  [![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/)
6
+ [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
4
7
 
5
8
  [![Build Status](https://travis-ci.org/yegor256/xcop.svg)](https://travis-ci.org/yegor256/xcop)
6
9
  [![Build status](https://ci.appveyor.com/api/projects/status/orvfo2qgmd1d7a2i?svg=true)](https://ci.appveyor.com/project/yegor256/xcop)
7
10
  [![PDD status](http://www.0pdd.com/svg?name=yegor256/xcop)](http://www.0pdd.com/p?name=yegor256/xcop)
8
11
  [![Gem Version](https://badge.fury.io/rb/xcop.svg)](http://badge.fury.io/rb/xcop)
9
- [![Dependency Status](https://gemnasium.com/yegor256/xcop.svg)](https://gemnasium.com/yegor256/xcop)
10
- [![Code Climate](http://img.shields.io/codeclimate/github/yegor256/xcop.svg)](https://codeclimate.com/github/yegor256/xcop)
11
- [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/xcop.svg)](https://codecov.io/github/yegor256/xcop?branch=master)
12
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/xcop/blob/master/LICENSE.txt)
12
13
 
13
- ## What this is for?
14
+ [![Maintainability](https://api.codeclimate.com/v1/badges/396ec0584e0a84adc723/maintainability)](https://codeclimate.com/github/yegor256/xcop/maintainability)
15
+ [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/xcop.svg)](https://codecov.io/github/yegor256/xcop?branch=master)
16
+ [![Hits-of-Code](https://hitsofcode.com/github/yegor256/xcop)](https://hitsofcode.com/view/github/yegor256/xcop)
14
17
 
15
18
  This command line tool validates your XML files for proper formatting.
16
19
  If they are not formatted correctly, it prints the difference and
@@ -18,16 +21,15 @@ returns with an error. You can use it two ways: 1) to fail your build
18
21
  if any X-like files (XML, XSD, XSL, XHTML) are not formatted correctly,
19
22
  and 2) to format them correctly.
20
23
 
21
- ## How to install?
24
+ Read this blog post of mine first:
25
+ [_XCOP—XML Style Checker_](https://www.yegor256.com/2017/08/29/xcop.html).
22
26
 
23
- Install it first:
27
+ Install it first (read below if you can't install it):
24
28
 
25
29
  ```bash
26
30
  $ gem install xcop
27
31
  ```
28
32
 
29
- ## How to run?
30
-
31
33
  Run it locally and read its output:
32
34
 
33
35
  ```bash
@@ -48,7 +50,8 @@ can ask it to "beautify" them, using `--fix` option:
48
50
  $ xcop --fix broken-file.xml
49
51
  ```
50
52
 
51
- To fix all files in the directory you can do:
53
+ To fix all files in the directory you can do
54
+ ([won't work](https://askubuntu.com/questions/343727/) if your file names contain spaces):
52
55
 
53
56
  ```bash
54
57
  $ xcop --fix $(find . -name '*.xml')
@@ -69,6 +72,36 @@ Xcop::RakeTask.new(:xcop) do |task|
69
72
  end
70
73
  ```
71
74
 
75
+ ## How to use as GitHub action?
76
+
77
+ Create new workflow file in repository under `.github/workflows/xcop.yml`:
78
+ ```yaml
79
+ ---
80
+ name: XCOP
81
+ "on":
82
+ # run on push to master events
83
+ push:
84
+ branches:
85
+ - master
86
+ # run on pull requests to master
87
+ pull_request:
88
+ brranches:
89
+ - master
90
+ jobs:
91
+ build:
92
+ runs-on: ubuntu-latest
93
+ steps:
94
+ - uses: actions/checkout@v2
95
+ - uses: g4s8/xcop-action@master
96
+ ```
97
+ To customize license location or files pattern use action inputs `license` and `files`:
98
+ ```yaml
99
+ - uses: g4s8/xcop-action@master
100
+ with:
101
+ license: MY_LICENSE.txt
102
+ files: "src/*.xml"
103
+ ```
104
+
72
105
  ## How to use in Maven `pom.xml`?
73
106
 
74
107
  You can integrate it with the help of
@@ -134,30 +167,16 @@ Something like this should work:
134
167
  </project>
135
168
  ```
136
169
 
137
- ## How to contribute?
170
+ ## How to contribute
138
171
 
139
- Just submit a pull request. Make sure `rake` passes.
172
+ Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
173
+ Make sure you build is green before you contribute
174
+ your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
175
+ [Bundler](https://bundler.io/) installed. Then:
140
176
 
141
- ## License
142
-
143
- (The MIT License)
144
-
145
- Copyright (c) 2017 Yegor Bugayenko
146
-
147
- Permission is hereby granted, free of charge, to any person obtaining a copy
148
- of this software and associated documentation files (the 'Software'), to deal
149
- in the Software without restriction, including without limitation the rights
150
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
151
- copies of the Software, and to permit persons to whom the Software is
152
- furnished to do so, subject to the following conditions:
153
-
154
- The above copyright notice and this permission notice shall be included in all
155
- copies or substantial portions of the Software.
177
+ ```
178
+ $ bundle update
179
+ $ bundle exec rake
180
+ ```
156
181
 
157
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
158
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
159
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
160
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
161
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
162
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
163
- SOFTWARE.
182
+ If it's clean and you don't see any error messages, submit your pull request.
data/Rakefile CHANGED
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -33,7 +31,7 @@ def version
33
31
  Gem::Specification.load(Dir['*.gemspec'].first).version
34
32
  end
35
33
 
36
- task default: [:clean, :test, :features, :rubocop, :copyright]
34
+ task default: %i[clean test features rubocop copyright]
37
35
 
38
36
  require 'rake/testtask'
39
37
  desc 'Run all unit tests'
@@ -69,7 +67,7 @@ Cucumber::Rake::Task.new(:'features:html') do |t|
69
67
  end
70
68
 
71
69
  task :copyright do
72
- sh "grep -q -r '#{Date.today.strftime('%Y')}' \
70
+ sh "grep -q -r '2017-#{Date.today.strftime('%Y')}' \
73
71
  --include '*.rb' \
74
72
  --include '*.txt' \
75
73
  --include 'Rakefile' \
data/bin/xcop CHANGED
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
3
- #
4
- # Copyright (c) 2017 Yegor Bugayenko
2
+ # Copyright (c) 2017-2020 Yegor Bugayenko
5
3
  #
6
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
5
  # of this software and associated documentation files (the 'Software'), to deal
@@ -28,12 +26,24 @@ require 'nokogiri'
28
26
  require_relative '../lib/xcop'
29
27
  require_relative '../lib/xcop/version'
30
28
 
31
- opts = Slop.parse(ARGV, strict: true, help: true) do |o|
29
+ if Gem::Version.new(Nokogiri::VERSION) < Gem::Version.new('1.8')
30
+ puts "Nokogiri version #{Nokogiri::VERSION} is too old, 1.8+ is required"
31
+ end
32
+
33
+ file_cfg = []
34
+ if File.exist?('.xcop')
35
+ file_cfg += File.open('.xcop').read.gsub(/\s+/, " ").strip.split(/\s/)
36
+ end
37
+
38
+ merged = ARGV + file_cfg
39
+
40
+ opts = Slop.parse(merged, strict: true, help: true) do |o|
32
41
  o.banner = "Usage (#{Xcop::VERSION}): xcop [options] [files...]"
33
42
  o.bool '-h', '--help', 'Show these instructions'
34
43
  o.bool '-q', '--quiet', 'Don\'t print anything if there are no errors'
35
44
  o.bool '--version', 'Show current version'
36
45
  o.bool '--fix', 'Fix all files instead of reporting their problems'
46
+ o.bool '--nocolor', 'Suppress colored output'
37
47
  o.string '--license', 'File name of the boilerplate head license'
38
48
  end
39
49
 
@@ -58,7 +68,7 @@ if opts.fix?
58
68
  end
59
69
  else
60
70
  begin
61
- Xcop::CLI.new(opts.arguments, license).run do |f|
71
+ Xcop::CLI.new(opts.arguments, license, opts.nocolor?).run do |f|
62
72
  puts "#{f} looks good" unless opts.quiet?
63
73
  end
64
74
  rescue StandardError => e
@@ -8,7 +8,7 @@ Feature: Rake tasks
8
8
  """
9
9
  require 'xcop/rake_task'
10
10
  Xcop::RakeTask.new(:xcop) do |task|
11
- task.includes = ['**/*.xml']
11
+ task.includes = ['good.xml']
12
12
  end
13
13
  """
14
14
  And I have a "good.xml" file with content:
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -66,11 +64,11 @@ Then(/^Stdout is empty$/) do
66
64
  end
67
65
 
68
66
  Then(/^Exit code is zero$/) do
69
- raise "Non-zero exit code #{@exitstatus}" unless @exitstatus == 0
67
+ raise "Non-zero exit #{@exitstatus}:\n#{@stdout}" unless @exitstatus.zero?
70
68
  end
71
69
 
72
70
  Then(/^Exit code is not zero$/) do
73
- raise 'Zero exit code' if @exitstatus == 0
71
+ raise 'Zero exit code' if @exitstatus.zero?
74
72
  end
75
73
 
76
74
  When(/^I run bash with "([^"]*)"$/) do |text|
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,20 +25,21 @@ require_relative 'xcop/version'
27
25
 
28
26
  # Xcop main module.
29
27
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2017 Yegor Bugayenko
28
+ # Copyright:: Copyright (c) 2017-2020 Yegor Bugayenko
31
29
  # License:: MIT
32
30
  module Xcop
33
31
  # Command line interface.
34
32
  class CLI
35
- def initialize(files, license)
33
+ def initialize(files, license, nocolor = false)
36
34
  @files = files
37
35
  @license = license
36
+ @nocolor = nocolor
38
37
  end
39
38
 
40
39
  def run
41
40
  @files.each do |f|
42
41
  doc = Document.new(f)
43
- diff = doc.diff
42
+ diff = doc.diff(@nocolor)
44
43
  unless diff.empty?
45
44
  puts diff
46
45
  raise "Invalid XML formatting in #{f}"
@@ -74,13 +73,11 @@ module Xcop
74
73
  end
75
74
 
76
75
  # Return the difference, if any (empty string if everything is clean).
77
- def diff
76
+ def diff(nocolor = false)
78
77
  xml = Nokogiri::XML(File.open(@path), &:noblanks)
79
78
  ideal = xml.to_xml(indent: 2)
80
79
  now = File.read(@path)
81
- Differ.format = :color
82
- return Differ.diff_by_line(ideal, now).to_s unless now == ideal
83
- ''
80
+ differ(ideal, now, nocolor)
84
81
  end
85
82
 
86
83
  # Return the difference for the license.
@@ -89,9 +86,7 @@ module Xcop
89
86
  comment = xml.xpath('/comment()')[0]
90
87
  now = comment.nil? ? '' : comment.text.to_s.strip
91
88
  ideal = license.strip
92
- Differ.format = :color
93
- return Differ.diff_by_line(ideal, now).to_s unless now == ideal
94
- ''
89
+ differ(ideal, now)
95
90
  end
96
91
 
97
92
  # Fixes the document.
@@ -106,5 +101,21 @@ module Xcop
106
101
  ideal = xml.to_xml(indent: 2)
107
102
  File.write(@path, ideal)
108
103
  end
104
+
105
+ private
106
+
107
+ def differ(ideal, fact, nocolor = false)
108
+ return '' if ideal == fact
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
115
+ end
116
+
117
+ def schars(text)
118
+ text.gsub(/\n/, "\\n\n")
119
+ end
109
120
  end
110
121
  end
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -26,7 +24,7 @@ require_relative '../xcop'
26
24
 
27
25
  # Xcop rake task.
28
26
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
- # Copyright:: Copyright (c) 2017 Yegor Bugayenko
27
+ # Copyright:: Copyright (c) 2017-2020 Yegor Bugayenko
30
28
  # License:: MIT
31
29
  module Xcop
32
30
  # Rake task.
@@ -40,7 +38,7 @@ module Xcop
40
38
 
41
39
  def initialize(*args, &task_block)
42
40
  @name = args.shift || :xcop
43
- @includes = %w(xml xsd xhtml xsl html).map { |e| "**/*.#{e}" }
41
+ @includes = %w[xml xsd xhtml xsl html].map { |e| "**/*.#{e}" }
44
42
  @excludes = []
45
43
  @license = nil
46
44
  @quiet = false
@@ -68,8 +66,9 @@ module Xcop
68
66
  rescue StandardError => e
69
67
  abort(e.message)
70
68
  end
69
+ return if @quiet
71
70
  puts "\n#{pluralize(good.length, 'file')} checked, \
72
- everything looks #{Rainbow('pretty').green}" unless @quiet
71
+ everything looks #{Rainbow('pretty').green}"
73
72
  end
74
73
 
75
74
  def pluralize(num, text)
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -22,8 +20,8 @@
22
20
 
23
21
  # Xcop main module.
24
22
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
25
- # Copyright:: Copyright (c) 2017 Yegor Bugayenko
23
+ # Copyright:: Copyright (c) 2017-2020 Yegor Bugayenko
26
24
  # License:: MIT
27
25
  module Xcop
28
- VERSION = '0.5.5'.freeze
26
+ VERSION = '0.6.1'.freeze
29
27
  end
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="314px" height="314px" viewBox="0 0 314 314" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
4
+ <title>Group 2</title>
5
+ <desc>Created with Sketch.</desc>
6
+ <defs></defs>
7
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
8
+ <g id="Group-2">
9
+ <g id="Group">
10
+ <circle id="Oval" fill="#053C5E" cx="157" cy="157" r="157"></circle>
11
+ <rect id="Rectangle" fill="#2B2B2B" x="0" y="233" width="184" height="69"></rect>
12
+ <text id="xcop" font-family="CourierNewPS-BoldMT, Courier New" font-size="60" font-weight="bold" fill="#FFFFFF">
13
+ <tspan x="20.4882812" y="281">xcop</tspan>
14
+ </text>
15
+ <path d="M135.676765,111.215287 C135.211714,113.540467 132.770932,120.688823 130.252813,127.100603 C127.734621,133.512383 125.2898,140.431445 124.819828,142.476214 C123.6868,147.405663 121.517836,147.185477 119.69487,141.95608 C116.899865,133.938362 105.171362,111.043501 103.859129,111.043501 C100.420089,111.043501 101.508757,114.986149 109.1771,130.30227 C113.739327,139.414532 118.032086,147.448041 118.716515,148.15443 C120.694817,150.196115 120.172626,154.319657 117.358599,158.877992 C113.567467,165.019055 107.570942,183.721189 108.054206,187.896804 C108.804956,194.383204 112.436054,192.210274 113.355359,184.724515 C114.48376,175.535577 120.945556,159.641154 124.897459,156.333653 C127.109021,154.482778 128.268636,151.905536 128.573284,148.163978 C128.818001,145.157747 131.906711,135.560972 135.437115,126.837819 C138.96752,118.114666 141.511492,110.079835 141.090434,108.982574 C139.755727,105.504315 136.554941,106.824333 135.676765,111.215287 M174.714659,126.841564 C169.37392,129.699438 169.197653,130.049915 167.452978,141.283475 C165.577352,153.360398 165.225112,168.513913 166.548289,180.203784 L167.566817,189.202501 L161.346213,191.9541 C154.601949,194.937416 150.91195,200.302465 153.156708,203.861146 C155.104824,206.949562 157.09025,206.70198 157.571826,203.310532 C158.083734,199.706169 166.097413,193.204052 170.29418,192.987978 C172.116999,192.894116 173.522874,191.717021 173.97823,189.903529 C174.383277,188.290613 177.740353,184.944554 181.438431,182.467858 C188.546172,177.707551 194.317883,170.450278 194.317883,166.273341 C194.317883,162.684548 189.493165,158.361603 185.487795,158.361603 C180.701636,158.361603 180.027195,155.239403 183.731222,150.229385 C188.308065,144.038966 188.284856,130.867646 183.690534,127.147387 C179.896537,124.075276 179.885006,124.074836 174.714659,126.841564 M182.67318,134.240439 C184.752542,140.153164 174.808961,161.185104 171.588639,157.68562 C169.868715,155.81653 172.863122,135.012708 175.266374,132.134564 C177.872553,129.013319 181.163896,129.949075 182.67318,134.240439 M184.854262,162.269586 C190.589839,163.855621 189.673839,167.881335 181.645765,176.371155 C177.281618,180.986262 173.904933,183.573859 173.371946,182.711474 C172.876636,181.91012 172.127869,176.711937 171.707987,171.159972 L170.944531,161.065463 L176.209475,161.200234 C179.105172,161.274339 182.995308,161.755548 184.854262,162.269586 M132.642184,172.492256 C131.593837,175.224098 133.152917,177.288844 136.264027,177.288844 C139.014965,177.288844 139.431396,176.221769 138.067531,172.667568 C137.039234,169.987871 133.645289,169.878218 132.642184,172.492256 M203.781503,185.840798 C203.781503,187.657595 209.264724,193.512152 210.966361,193.512152 C212.534035,193.512152 211.991059,187.391138 210.270768,185.670847 C208.092403,183.492409 203.781503,183.605293 203.781503,185.840798" id="Fill-6" fill="#427B8A" fill-rule="nonzero"></path>
16
+ </g>
17
+ </g>
18
+ </g>
19
+ </svg>
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,7 +25,7 @@ require_relative '../lib/xcop/rake_task'
27
25
 
28
26
  # Xcop rake task.
29
27
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2017 Yegor Bugayenko
28
+ # Copyright:: Copyright (c) 2017-2020 Yegor Bugayenko
31
29
  # License:: MIT
32
30
  class TestRakeTask < Minitest::Test
33
31
  def test_basic
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -28,7 +26,7 @@ require_relative '../lib/xcop'
28
26
 
29
27
  # Xcop main module test.
30
28
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
- # Copyright:: Copyright (c) 2017 Yegor Bugayenko
29
+ # Copyright:: Copyright (c) 2017-2020 Yegor Bugayenko
32
30
  # License:: MIT
33
31
  class TestXcop < Minitest::Test
34
32
  def test_basic
@@ -39,17 +37,25 @@ class TestXcop < Minitest::Test
39
37
  end
40
38
  end
41
39
 
40
+ def test_file_without_tail_eol
41
+ Dir.mktmpdir 'test9' do |dir|
42
+ f = File.join(dir, 'no-eol.xml')
43
+ File.write(f, "<?xml version=\"1.0\"?>\n<x/>")
44
+ assert(Xcop::Document.new(f).diff != '')
45
+ end
46
+ end
47
+
42
48
  def test_license_presence
43
49
  Dir.mktmpdir 'test2' do |dir|
44
50
  f = File.join(dir, 'a.xml')
45
- license = "Copyright (c) All Good People\nDon't touch it!\n\n"
51
+ license = " Copyright (c) All Good People\n Don't touch it!\n\n"
46
52
  File.write(
47
53
  f,
48
54
  [
49
55
  '<?xml version="1.0"?>',
50
56
  '<!--',
51
- 'Copyright (c) All Good People',
52
- 'Don\'t touch it!',
57
+ ' Copyright (c) All Good People',
58
+ ' Don\'t touch it!',
53
59
  '-->',
54
60
  '<hello>Dude!</hello>',
55
61
  ''
@@ -78,7 +84,7 @@ class TestXcop < Minitest::Test
78
84
  def test_fixes_document
79
85
  Dir.mktmpdir 'test3' do |dir|
80
86
  f = File.join(dir, 'bad.xml')
81
- license = "Copyright (c) Me, Myself, and I\nLike it?\n\n"
87
+ license = " Copyright (c) Me, Myself, and I\n Like it?\n\n"
82
88
  File.write(f, '<hello>My friend!</hello>')
83
89
  Xcop::Document.new(f).fix(license)
84
90
  assert_equal(Xcop::Document.new(f).diff, '')
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2017 Yegor Bugayenko
1
+ # Copyright (c) 2017-2020 Yegor Bugayenko
4
2
  #
5
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -31,8 +29,8 @@ Gem::Specification.new do |s|
31
29
  if s.respond_to? :required_rubygems_version=
32
30
  s.required_rubygems_version = Gem::Requirement.new('>= 0')
33
31
  end
34
- s.rubygems_version = '2.2.2'
35
- s.required_ruby_version = '>= 1.9.3'
32
+ s.rubygems_version = '2.2'
33
+ s.required_ruby_version = '>= 2.2'
36
34
  s.name = 'xcop'
37
35
  s.version = Xcop::VERSION
38
36
  s.license = 'MIT'
@@ -46,16 +44,15 @@ Gem::Specification.new do |s|
46
44
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
47
45
  s.rdoc_options = ['--charset=UTF-8']
48
46
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
49
- s.add_runtime_dependency 'nokogiri', '~>1.8'
50
47
  s.add_runtime_dependency 'differ', '~>0.1.2'
48
+ s.add_runtime_dependency 'nokogiri', '~>1.10.9'
49
+ s.add_runtime_dependency 'rainbow', '~>3.0'
51
50
  s.add_runtime_dependency 'slop', '~>4.4'
52
- s.add_runtime_dependency 'rainbow', '~>2.2'
53
- s.add_development_dependency 'rake', '12.0.0'
54
51
  s.add_development_dependency 'codecov', '0.1.10'
55
- s.add_development_dependency 'rdoc', '4.2.0'
56
52
  s.add_development_dependency 'cucumber', '1.3.17'
57
53
  s.add_development_dependency 'minitest', '5.5.0'
58
- s.add_development_dependency 'rubocop', '0.41.2'
54
+ s.add_development_dependency 'rake', '12.3.3'
55
+ s.add_development_dependency 'rdoc', '4.2.0'
56
+ s.add_development_dependency 'rubocop', '0.52.0'
59
57
  s.add_development_dependency 'rubocop-rspec', '1.5.1'
60
- s.add_development_dependency 'rspec-rails', '3.1.0'
61
58
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-14 00:00:00.000000000 Z
11
+ date: 2020-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: nokogiri
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.8'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.8'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: differ
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -39,47 +25,47 @@ dependencies:
39
25
  - !ruby/object:Gem::Version
40
26
  version: 0.1.2
41
27
  - !ruby/object:Gem::Dependency
42
- name: slop
28
+ name: nokogiri
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: '4.4'
33
+ version: 1.10.9
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: '4.4'
40
+ version: 1.10.9
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rainbow
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: '2.2'
47
+ version: '3.0'
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: '2.2'
54
+ version: '3.0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: rake
56
+ name: slop
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - '='
59
+ - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: 12.0.0
76
- type: :development
61
+ version: '4.4'
62
+ type: :runtime
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - '='
66
+ - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: 12.0.0
68
+ version: '4.4'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: codecov
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -95,89 +81,89 @@ dependencies:
95
81
  - !ruby/object:Gem::Version
96
82
  version: 0.1.10
97
83
  - !ruby/object:Gem::Dependency
98
- name: rdoc
84
+ name: cucumber
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - '='
102
88
  - !ruby/object:Gem::Version
103
- version: 4.2.0
89
+ version: 1.3.17
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - '='
109
95
  - !ruby/object:Gem::Version
110
- version: 4.2.0
96
+ version: 1.3.17
111
97
  - !ruby/object:Gem::Dependency
112
- name: cucumber
98
+ name: minitest
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - '='
116
102
  - !ruby/object:Gem::Version
117
- version: 1.3.17
103
+ version: 5.5.0
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - '='
123
109
  - !ruby/object:Gem::Version
124
- version: 1.3.17
110
+ version: 5.5.0
125
111
  - !ruby/object:Gem::Dependency
126
- name: minitest
112
+ name: rake
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - '='
130
116
  - !ruby/object:Gem::Version
131
- version: 5.5.0
117
+ version: 12.3.3
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - '='
137
123
  - !ruby/object:Gem::Version
138
- version: 5.5.0
124
+ version: 12.3.3
139
125
  - !ruby/object:Gem::Dependency
140
- name: rubocop
126
+ name: rdoc
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - '='
144
130
  - !ruby/object:Gem::Version
145
- version: 0.41.2
131
+ version: 4.2.0
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - '='
151
137
  - !ruby/object:Gem::Version
152
- version: 0.41.2
138
+ version: 4.2.0
153
139
  - !ruby/object:Gem::Dependency
154
- name: rubocop-rspec
140
+ name: rubocop
155
141
  requirement: !ruby/object:Gem::Requirement
156
142
  requirements:
157
143
  - - '='
158
144
  - !ruby/object:Gem::Version
159
- version: 1.5.1
145
+ version: 0.52.0
160
146
  type: :development
161
147
  prerelease: false
162
148
  version_requirements: !ruby/object:Gem::Requirement
163
149
  requirements:
164
150
  - - '='
165
151
  - !ruby/object:Gem::Version
166
- version: 1.5.1
152
+ version: 0.52.0
167
153
  - !ruby/object:Gem::Dependency
168
- name: rspec-rails
154
+ name: rubocop-rspec
169
155
  requirement: !ruby/object:Gem::Requirement
170
156
  requirements:
171
157
  - - '='
172
158
  - !ruby/object:Gem::Version
173
- version: 3.1.0
159
+ version: 1.5.1
174
160
  type: :development
175
161
  prerelease: false
176
162
  version_requirements: !ruby/object:Gem::Requirement
177
163
  requirements:
178
164
  - - '='
179
165
  - !ruby/object:Gem::Version
180
- version: 3.1.0
166
+ version: 1.5.1
181
167
  description: Validates XML-like documents for proper formatting
182
168
  email: yegor256@gmail.com
183
169
  executables:
@@ -189,6 +175,8 @@ extra_rdoc_files:
189
175
  files:
190
176
  - ".0pdd.yml"
191
177
  - ".gitattributes"
178
+ - ".github/ISSUE_TEMPLATE.md"
179
+ - ".github/PULL_REQUEST_TEMPLATE.md"
192
180
  - ".gitignore"
193
181
  - ".pdd"
194
182
  - ".rubocop.yml"
@@ -210,6 +198,7 @@ files:
210
198
  - lib/xcop.rb
211
199
  - lib/xcop/rake_task.rb
212
200
  - lib/xcop/version.rb
201
+ - logo.svg
213
202
  - test/test__helper.rb
214
203
  - test/test_rake_task.rb
215
204
  - test/test_xcop.rb
@@ -227,15 +216,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
227
216
  requirements:
228
217
  - - ">="
229
218
  - !ruby/object:Gem::Version
230
- version: 1.9.3
219
+ version: '2.2'
231
220
  required_rubygems_version: !ruby/object:Gem::Requirement
232
221
  requirements:
233
222
  - - ">="
234
223
  - !ruby/object:Gem::Version
235
224
  version: '0'
236
225
  requirements: []
237
- rubyforge_project:
238
- rubygems_version: 2.6.8
226
+ rubygems_version: 3.0.1
239
227
  signing_key:
240
228
  specification_version: 2
241
229
  summary: XML Formatting Static Validator