hoc 0.8.1 → 0.10.0

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: 2713e7d60200a7a84de27d7237959a0c4efb8013
4
- data.tar.gz: c72ecfa6f90f566d7c844c73e8adf66faf0c737e
2
+ SHA256:
3
+ metadata.gz: dbe19710315f3c5fb3694392ba6d4ea98af1e7b93c236c06bffbdd6d97fa8ffe
4
+ data.tar.gz: c2952fbe694ec63726ef0f04b9ae1d74c142bd8df31dbd445d03220af9ba7e79
5
5
  SHA512:
6
- metadata.gz: cc6058afcab3abcec28a2b7587a67138a128a0a3803774a5dbd859891dbeab0f6f3cb786ba244d5198315a4679e1fa54f6f8dece8a736978a5c7bccd741c586a
7
- data.tar.gz: d769c392c2ae4d6f6c2857d71a9ebf259ce4d00a0d62dd004a1ee32ec54e6e2ecbb541901dfa0efe01f6fc51dfe5f53de1e837c662575e4db46cb938dd302152
6
+ metadata.gz: 2725602c91b9702b37f5a34c6a891f598d7d5195bd5f301b96197be6cc86bcca58e17c19af61bc62cf613387b0b08a315eb29788ab2ae58fed838f094fe00c82
7
+ data.tar.gz: df30349fd8ced4df84a2fbd9ffefc3b22a6095576e8b36fdabe81b1b72d5d60d278f119d67f0124321f47aa0a853bee5f1f40b20242acc655988235de4eb6f53
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: codecov
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ jobs:
8
+ codecov:
9
+ runs-on: ubuntu-20.04
10
+ steps:
11
+ - uses: actions/checkout@v3
12
+ - uses: actions/setup-ruby@v1
13
+ with:
14
+ ruby-version: 3.0
15
+ - run: sudo apt install -y diffstat
16
+ - run: bundle update
17
+ - run: bundle exec rake
18
+ - uses: codecov/codecov-action@v3
19
+ with:
20
+ file: coverage/.resultset.json
21
+ fail_ci_if_error: true
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: pdd
3
+ "on":
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
10
+ jobs:
11
+ pdd:
12
+ runs-on: ubuntu-20.04
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - uses: g4s8/pdd-action@master
@@ -0,0 +1,25 @@
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-20.04]
16
+ ruby: [3.0, 2.7]
17
+ runs-on: ${{ matrix.os }}
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ - run: sudo apt install -y diffstat
24
+ - run: bundle update
25
+ - run: bundle exec rake
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: xcop
3
+ "on":
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
10
+ jobs:
11
+ xcop:
12
+ runs-on: ubuntu-20.04
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - uses: g4s8/xcop-action@master
16
+ with:
17
+ files: '**/*.xml'
data/.rubocop.yml CHANGED
@@ -1,9 +1,20 @@
1
1
  AllCops:
2
+ Exclude:
3
+ - 'assets/**/*'
2
4
  DisplayCopNames: true
5
+ TargetRubyVersion: 2.2.2
6
+ SuggestExtensions: false
7
+ NewCops: enable
3
8
 
9
+ Layout/EndOfLine:
10
+ EnforcedStyle: lf
4
11
  Metrics/MethodLength:
5
12
  Max: 30
6
13
  Metrics/AbcSize:
7
14
  Max: 30
8
15
  Metrics/CyclomaticComplexity:
9
16
  Max: 10
17
+ Layout/EmptyLineAfterGuardClause:
18
+ Enabled: false
19
+ Metrics/BlockLength:
20
+ Max: 50
data/.rultor.yml CHANGED
@@ -1,23 +1,24 @@
1
+ docker:
2
+ image: yegor256/rultor-image:1.19.0
1
3
  assets:
2
- rubygems.yml: zerocracy/home#assets/rubygems.yml
3
- s3cfg: zerocracy/home#assets/s3cfg
4
+ rubygems.yml: yegor256/home#assets/rubygems.yml
4
5
  install: |
5
- sudo gem install --no-ri --no-rdoc pdd
6
+ pdd -f /dev/null
7
+ sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
8
+ sudo apt-get update --fix-missing
6
9
  sudo apt-get install -y subversion diffstat
7
10
  sudo apt-get install -y software-properties-common
8
11
  sudo add-apt-repository -y ppa:git-core/ppa
9
- sudo apt-get update
12
+ sudo apt-get update --fix-missing
10
13
  sudo apt-get remove -y git
11
14
  sudo apt-get install -y git
12
- deploy:
15
+ merge:
13
16
  script: |
14
- sudo bundle install
15
- rake
17
+ bundle exec rake
16
18
  release:
17
19
  script: |
18
20
  pdd --verbose --file=/dev/null
19
- bundle install
20
- rake
21
+ bundle exec rake
21
22
  rm -rf *.gem
22
23
  sed -i "s/1\.0\.snapshot/${tag}/g" lib/hoc/version.rb
23
24
  git commit -m "${tag}" lib/hoc/version.rb
data/.simplecov CHANGED
@@ -1,7 +1,5 @@
1
- # encoding: utf-8
2
1
  #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
2
+ # Copyright (c) 2014-2023 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
@@ -23,13 +21,13 @@
23
21
 
24
22
  require 'coveralls'
25
23
 
26
- if Gem.win_platform? then
24
+ if Gem.win_platform?
27
25
  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
28
26
  SimpleCov::Formatter::HTMLFormatter
29
27
  ]
30
28
  SimpleCov.start do
31
- add_filter "/test/"
32
- add_filter "/features/"
29
+ add_filter '/test/'
30
+ add_filter '/features/'
33
31
  end
34
32
  else
35
33
  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
@@ -37,8 +35,8 @@ else
37
35
  Coveralls::SimpleCov::Formatter
38
36
  ]
39
37
  SimpleCov.start do
40
- add_filter "/test/"
41
- add_filter "/features/"
38
+ add_filter '/test/'
39
+ add_filter '/features/'
42
40
  minimum_coverage 100
43
41
  end
44
42
  end
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.3
3
+ - 2.6.0
4
4
  cache: bundler
5
5
  branches:
6
6
  only:
data/Gemfile CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -23,3 +20,11 @@
23
20
 
24
21
  source 'https://rubygems.org'
25
22
  gemspec
23
+
24
+ gem 'cucumber', '8.0.0', require: false
25
+ gem 'minitest', '5.18.0', require: false
26
+ gem 'rake', '13.0.6', require: false
27
+ gem 'rdoc', '6.5.0', require: false
28
+ gem 'rubocop', '1.51.0', require: false
29
+ gem 'rubocop-rspec', '2.22.0', require: false
30
+ gem 'simplecov', '0.22.0', require: false
data/LICENSE.txt CHANGED
@@ -1,7 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2014-2018 Teamed.io
4
- Copyright (c) 2014-2018 Yegor Bugayenko
3
+ Copyright (c) 2014-2023 Yegor Bugayenko
5
4
 
6
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
6
  of this software and associated documentation files (the 'Software'), to deal
data/README.md CHANGED
@@ -1,20 +1,22 @@
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)
1
+ [![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)
3
2
  [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/hoc)](http://www.rultor.com/p/yegor256/hoc)
4
- [![We recommend RubyMine](http://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
3
+ [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
5
4
 
6
- [![Build Status](https://travis-ci.org/yegor256/hoc.svg)](https://travis-ci.org/yegor256/hoc)
7
- [![Build status](https://ci.appveyor.com/api/projects/status/yww1brb4xy80jh11?svg=true)](https://ci.appveyor.com/project/yegor256/hoc)
5
+ [![rake](https://github.com/yegor256/hoc/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/hoc/actions/workflows/rake.yml)
8
6
  [![Gem Version](https://badge.fury.io/rb/hoc.svg)](http://badge.fury.io/rb/hoc)
9
- [![Dependency Status](https://gemnasium.com/yegor256/hoc.svg)](https://gemnasium.com/yegor256/hoc)
10
- [![Code Climate](http://img.shields.io/codeclimate/github/yegor256/hoc.svg)](https://codeclimate.com/github/yegor256/hoc)
7
+ [![Maintainability](https://api.codeclimate.com/v1/badges/4302208cf578d101143e/maintainability)](https://codeclimate.com/github/yegor256/hoc/maintainability)
11
8
  [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/hoc.svg)](https://codecov.io/github/yegor256/hoc?branch=master)
9
+ [![Hits-of-Code](https://hitsofcode.com/github/yegor256/hoc)](https://hitsofcode.com/view/github/yegor256/hoc)
12
10
 
13
11
  It is a command line tool to calculate Hits-of-Code metric
14
12
  in a source code repository (at the moment we support Git 2+ and Subversion 1.7+).
15
13
  You can read more about Hits-of-Code metric in this blog post:
16
14
  [Hits-of-Code Instead of SLoC](http://www.yegor256.com/2014/11/14/hits-of-code.html).
17
15
 
16
+ You can also use [hitsofcode.com](https://hitsofcode.com) by
17
+ [Valentin Brandl](https://www.vbrandl.net/), if you want to have a badge
18
+ in your repo.
19
+
18
20
  Install it first:
19
21
 
20
22
  ```bash
@@ -31,23 +33,17 @@ For Subversion statistics you must have
31
33
  [diffstat](http://sourceforge.net/projects/mingw/files/MSYS/Extension/diffstat/)
32
34
  installed.
33
35
 
34
- ## Questions?
35
-
36
- If you have any questions about the tool, or something doesn't work as expected,
37
- please [submit an issue here](https://github.com/yegor256/hoc/issues/new).
38
-
39
- ## How to contribute?
36
+ ## How to contribute
40
37
 
41
- Fork the repository, make changes, submit a pull request.
42
- We promise to review your changes same day and apply to
43
- the `master` branch, if they look correct.
44
-
45
- Please run Rake build before submitting a pull request (make sure you
46
- have [bundler](http://bundler.io/) installed):
38
+ Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
39
+ Make sure you build is green before you contribute
40
+ your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and
41
+ [Bundler](https://bundler.io/) installed. Then:
47
42
 
48
43
  ```
49
- $ bundle install
50
- $ rake
44
+ $ bundle update
45
+ $ bundle exec rake
51
46
  ```
52
47
 
53
- Make sure you're using Ruby 2.0+.
48
+ If it's clean and you don't see any error messages, submit your pull request.
49
+
data/Rakefile CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -33,7 +30,7 @@ def version
33
30
  Gem::Specification.load(Dir['*.gemspec'].first).version
34
31
  end
35
32
 
36
- task default: [:clean, :test, :features, :rubocop, :copyright]
33
+ task default: %i[clean test features rubocop copyright]
37
34
 
38
35
  task :clean do
39
36
  rm_rf 'coverage'
data/bin/hoc CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
3
- #
4
- # Copyright (c) 2014-2018 Teamed.io
5
- # Copyright (c) 2014-2018 Yegor Bugayenko
2
+
3
+ # Copyright (c) 2014-2023 Yegor Bugayenko
6
4
  #
7
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -22,7 +20,7 @@
22
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
21
  # SOFTWARE.
24
22
 
25
- STDOUT.sync = true
23
+ $stdout.sync = true
26
24
 
27
25
  require 'hoc'
28
26
  require 'slop'
@@ -58,6 +56,18 @@ opts = Slop.parse(args, strict: true, help: true) do |o|
58
56
  'Directory to scan',
59
57
  default: '.'
60
58
  )
59
+ o.string(
60
+ '-s',
61
+ '--since',
62
+ 'Set the start date of hoc (YYYY-MM-DD)',
63
+ default: '2000-01-01'
64
+ )
65
+ o.string(
66
+ '-b',
67
+ '--before',
68
+ 'Set the end date of hoc (YYYY-MM-DD)',
69
+ default: Time.now.strftime('%Y-%m-%d')
70
+ )
61
71
  end
62
72
 
63
73
  if opts.help?
@@ -7,7 +7,7 @@ Feature: Git repo processing
7
7
  Given I run bash:
8
8
  """
9
9
  git init --quiet .
10
- git config user.email test@teamed.io
10
+ git config user.email test@zerocracy.com
11
11
  git config user.name test
12
12
  echo 'hello, world!' > test.txt
13
13
  git add test.txt
@@ -7,7 +7,7 @@ Feature: Exclude dirs from Git counting
7
7
  Given I run bash:
8
8
  """
9
9
  git init --quiet .
10
- git config user.email test@teamed.io
10
+ git config user.email test@zerocracy.com
11
11
  git config user.name test
12
12
  mkdir x
13
13
  echo 'hello, world!' > x/invalid.txt
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -29,13 +26,13 @@ require 'English'
29
26
  Before do
30
27
  @cwd = Dir.pwd
31
28
  @dir = Dir.mktmpdir('test')
32
- FileUtils.mkdir_p(@dir) unless File.exist?(@dir)
29
+ FileUtils.mkdir_p(@dir)
33
30
  Dir.chdir(@dir)
34
31
  end
35
32
 
36
33
  After do
37
34
  Dir.chdir(@cwd)
38
- FileUtils.rm_rf(@dir) if File.exist?(@dir)
35
+ FileUtils.rm_rf(@dir)
39
36
  end
40
37
 
41
38
  Given(/^It is Unix$/) do
@@ -51,7 +48,7 @@ Given(/^I run bash:$/) do |script|
51
48
  cmd = script.split("\n").join(' && ')
52
49
  @stdout = `#{cmd}`
53
50
  @exitstatus = $CHILD_STATUS.exitstatus
54
- raise 'non-zero exit code' unless @exitstatus == 0
51
+ raise 'non-zero exit code' unless @exitstatus.zero?
55
52
  end
56
53
 
57
54
  When(%r{^I run bin/hoc with "([^"]*)"$}) do |arg|
@@ -61,18 +58,14 @@ When(%r{^I run bin/hoc with "([^"]*)"$}) do |arg|
61
58
  end
62
59
 
63
60
  Then(/^Stdout contains "([^"]*)"$/) do |txt|
64
- unless @stdout.include?(txt)
65
- raise "STDOUT doesn't contain '#{txt}':\n\n--------\n#{@stdout}\n--------\n"
66
- end
61
+ raise "STDOUT doesn't contain '#{txt}':\n\n--------\n#{@stdout}\n--------\n" unless @stdout.include?(txt)
67
62
  end
68
63
 
69
64
  Then(/^Exit code is zero$/) do
70
- raise "Non-zero exit code #{@exitstatus}" unless @exitstatus == 0
65
+ raise "Non-zero exit code #{@exitstatus}" unless @exitstatus.zero?
71
66
  end
72
67
 
73
68
  Given(/^I have a "([^"]*)" file with content:$/) do |file, text|
74
69
  FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(file)
75
- File.open(file, 'w') do |f|
76
- f.write(text)
77
- end
70
+ File.write(file, text)
78
71
  end
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
data/hoc.gemspec CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -21,17 +18,13 @@
21
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
19
  # SOFTWARE.
23
20
 
24
- lib = File.expand_path('../lib', __FILE__)
21
+ lib = File.expand_path('lib', __dir__)
25
22
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
26
23
  require 'hoc/version'
27
24
 
28
25
  Gem::Specification.new do |s|
29
- s.specification_version = 2 if s.respond_to? :specification_version=
30
- if s.respond_to? :required_rubygems_version=
31
- s.required_rubygems_version = Gem::Requirement.new('>= 0')
32
- end
33
- s.rubygems_version = '2.2.2'
34
- s.required_ruby_version = '>= 1.9.3'
26
+ s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
27
+ s.required_ruby_version = '>= 2.2.2'
35
28
  s.name = 'hoc'
36
29
  s.version = HOC::VERSION
37
30
  s.license = 'MIT'
@@ -42,16 +35,8 @@ Gem::Specification.new do |s|
42
35
  s.homepage = 'http://github.com/teamed/hoc'
43
36
  s.files = `git ls-files`.split($RS)
44
37
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
45
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
46
38
  s.rdoc_options = ['--charset=UTF-8']
47
- s.extra_rdoc_files = %w(README.md LICENSE.txt)
48
- s.add_runtime_dependency 'slop', '~>4.4.1'
49
- s.add_development_dependency 'rake', '12.0.0'
50
- s.add_development_dependency 'codecov', '0.1.10'
51
- s.add_development_dependency 'rdoc', '3.11'
52
- s.add_development_dependency 'cucumber', '1.3.11'
53
- s.add_development_dependency 'minitest', '5.4'
54
- s.add_development_dependency 'rubocop', '0.41.2'
55
- s.add_development_dependency 'rubocop-rspec', '1.5.1'
56
- s.add_development_dependency 'rspec-rails', '2.13'
39
+ s.extra_rdoc_files = %w[README.md LICENSE.txt]
40
+ s.add_runtime_dependency 'slop', '~>4.4'
41
+ s.metadata['rubygems_mfa_required'] = 'true'
57
42
  end
data/lib/hoc/git.rb CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,10 +24,12 @@ require 'hoc/hits'
27
24
  module HOC
28
25
  # Git source code base.
29
26
  class Git
30
- def initialize(dir, exclude, author)
27
+ def initialize(dir, exclude, author, since, before)
31
28
  @dir = dir
32
29
  @exclude = exclude
33
30
  @author = author
31
+ @since = since
32
+ @before = before
34
33
  end
35
34
 
36
35
  def hits
@@ -43,7 +42,10 @@ module HOC
43
42
  '--ignore-space-change', '--ignore-all-space',
44
43
  '--ignore-submodules', '--no-color',
45
44
  '--find-copies-harder', '-M', '--diff-filter=ACDM',
46
- "'--author=#{@author}'", '--', '.',
45
+ "'--author=#{@author}'",
46
+ "'--since=#{@since}'",
47
+ "'--before=#{@before}'",
48
+ '--', '.',
47
49
  @exclude.map { |e| "':(exclude,glob)#{e}'" }.join(' ')
48
50
  ].join(' ')
49
51
  [
data/lib/hoc/hits.rb CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
data/lib/hoc/svn.rb CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
data/lib/hoc/version.rb CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -23,8 +20,8 @@
23
20
 
24
21
  # HOC main module.
25
22
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
26
- # Copyright:: Copyright (c) 2014-2018 Yegor Bugayenko
23
+ # Copyright:: Copyright (c) 2014-2023 Yegor Bugayenko
27
24
  # License:: MIT
28
25
  module HOC
29
- VERSION = '0.8.1'.freeze
26
+ VERSION = '0.10.0'.freeze
30
27
  end
data/lib/hoc.rb CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -26,7 +23,7 @@ require 'hoc/svn'
26
23
 
27
24
  # HOC main module.
28
25
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
- # Copyright:: Copyright (c) 2014-2018 Yegor Bugayenko
26
+ # Copyright:: Copyright (c) 2014-2023 Yegor Bugayenko
30
27
  # License:: MIT
31
28
  module HOC
32
29
  # Code base abstraction
@@ -38,13 +35,15 @@ module HOC
38
35
  @exclude = opts[:exclude] || []
39
36
  @author = opts[:author] || ''
40
37
  @format = opts[:format] || 'int'
38
+ @since = opts[:since] || '2000-01-01'
39
+ @before = opts[:before] || Time.now.strftime('%Y-%m-%d')
41
40
  end
42
41
 
43
42
  # Generate report.
44
43
  def report
45
44
  repo = nil
46
45
  if File.exist?(File.join(@dir, '.git'))
47
- repo = Git.new(@dir, @exclude, @author)
46
+ repo = Git.new(@dir, @exclude, @author, @since, @before)
48
47
  elsif File.exist?(File.join(@dir, '.svn'))
49
48
  repo = Svn.new(@dir)
50
49
  else
data/renovate.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:base"
5
+ ]
6
+ }
data/test/test__helper.rb CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -21,13 +18,9 @@
21
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
19
  # SOFTWARE.
23
20
 
24
- STDOUT.sync = true
21
+ $stdout.sync = true
25
22
 
26
23
  require 'simplecov'
27
24
  SimpleCov.start
28
- if ENV['CI'] == 'true'
29
- require 'codecov'
30
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
31
- end
32
25
 
33
26
  require 'hoc'
data/test/test_git.rb CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,7 +24,7 @@ require 'tmpdir'
27
24
 
28
25
  # Git test.
29
26
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2014-2018 Yegor Bugayenko
27
+ # Copyright:: Copyright (c) 2014-2023 Yegor Bugayenko
31
28
  # License:: MIT
32
29
  class TestGit < Minitest::Test
33
30
  def test_parsing
@@ -35,9 +32,10 @@ class TestGit < Minitest::Test
35
32
  Dir.mktmpdir 'test' do |dir|
36
33
  raise unless system("
37
34
  set -e
35
+ set -x
38
36
  cd '#{dir}'
39
37
  git init --quiet .
40
- git config user.email test@teamed.io
38
+ git config user.email test@zerocracy.com
41
39
  git config user.name test
42
40
  echo 'hello, world!' > test.txt
43
41
  git add test.txt
@@ -45,9 +43,11 @@ class TestGit < Minitest::Test
45
43
  echo 'good bye, world!' > test.txt
46
44
  git commit -qam 'modify line'
47
45
  rm test.txt
46
+ git add test.txt
48
47
  git commit -qam 'delete line'
49
48
  ")
50
- hits = HOC::Git.new(dir, [], '').hits
49
+ hits = HOC::Git.new(dir, [], '', '2000-01-01',
50
+ Time.now.strftime('%Y-%m-%d')).hits
51
51
  assert_equal 1, hits.size
52
52
  assert_equal 4, hits[0].total
53
53
  end
@@ -61,7 +61,8 @@ class TestGit < Minitest::Test
61
61
  cd '#{dir}'
62
62
  git init --quiet .
63
63
  ")
64
- hits = HOC::Git.new(dir, [], '').hits
64
+ hits = HOC::Git.new(dir, [], '', '2000-01-01',
65
+ Time.now.strftime('%Y-%m-%d')).hits
65
66
  assert_equal 1, hits.size
66
67
  assert_equal 0, hits[0].total
67
68
  end
@@ -74,7 +75,7 @@ class TestGit < Minitest::Test
74
75
  set -e
75
76
  cd '#{dir}'
76
77
  git init --quiet .
77
- git config user.email test@teamed.io
78
+ git config user.email test@zerocracy.com
78
79
  git config user.name test
79
80
  dd if=/dev/urandom of=test.dat bs=1 count=65536
80
81
  git add test.dat
@@ -83,7 +84,8 @@ class TestGit < Minitest::Test
83
84
  git add test.dat
84
85
  git commit -qam 'binary file modified'
85
86
  ")
86
- hits = HOC::Git.new(dir, [], '').hits
87
+ hits = HOC::Git.new(dir, [], '', '2000-01-01',
88
+ Time.now.strftime('%Y-%m-%d')).hits
87
89
  assert_equal 1, hits.size
88
90
  assert_equal 0, hits[0].total
89
91
  end
data/test/test_hoc.rb CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -28,7 +25,7 @@ require 'slop'
28
25
 
29
26
  # HOC main module test.
30
27
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
- # Copyright:: Copyright (c) 2014-2018 Yegor Bugayenko
28
+ # Copyright:: Copyright (c) 2014-2023 Yegor Bugayenko
32
29
  # License:: MIT
33
30
  class TestHOC < Minitest::Test
34
31
  def test_basic_git
@@ -38,7 +35,7 @@ class TestHOC < Minitest::Test
38
35
  set -e
39
36
  cd '#{dir}'
40
37
  git init .
41
- git config user.email test@teamed.io
38
+ git config user.email test@zerocracy.com
42
39
  git config user.name test
43
40
  echo 'hello, world!' > test.txt
44
41
  git add test.txt
data/test/test_svn.rb CHANGED
@@ -1,7 +1,4 @@
1
- # encoding: utf-8
2
- #
3
- # Copyright (c) 2014-2018 Teamed.io
4
- # Copyright (c) 2014-2018 Yegor Bugayenko
1
+ # Copyright (c) 2014-2023 Yegor Bugayenko
5
2
  #
6
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
4
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,7 +24,7 @@ require 'tmpdir'
27
24
 
28
25
  # Svn test.
29
26
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2014-2018 Yegor Bugayenko
27
+ # Copyright:: Copyright (c) 2014-2023 Yegor Bugayenko
31
28
  # License:: MIT
32
29
  class TestSvn < Minitest::Test
33
30
  def test_parsing
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.10.0
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-03-20 00:00:00.000000000 Z
11
+ date: 2023-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop
@@ -16,126 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.4.1
19
+ version: '4.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 4.4.1
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 12.0.0
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 12.0.0
41
- - !ruby/object:Gem::Dependency
42
- name: codecov
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 0.1.10
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: 0.1.10
55
- - !ruby/object:Gem::Dependency
56
- name: rdoc
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: '3.11'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '='
67
- - !ruby/object:Gem::Version
68
- version: '3.11'
69
- - !ruby/object:Gem::Dependency
70
- name: cucumber
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '='
74
- - !ruby/object:Gem::Version
75
- version: 1.3.11
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '='
81
- - !ruby/object:Gem::Version
82
- version: 1.3.11
83
- - !ruby/object:Gem::Dependency
84
- name: minitest
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '='
88
- - !ruby/object:Gem::Version
89
- version: '5.4'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '='
95
- - !ruby/object:Gem::Version
96
- version: '5.4'
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '='
102
- - !ruby/object:Gem::Version
103
- version: 0.41.2
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '='
109
- - !ruby/object:Gem::Version
110
- version: 0.41.2
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop-rspec
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - '='
116
- - !ruby/object:Gem::Version
117
- version: 1.5.1
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - '='
123
- - !ruby/object:Gem::Version
124
- version: 1.5.1
125
- - !ruby/object:Gem::Dependency
126
- name: rspec-rails
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - '='
130
- - !ruby/object:Gem::Version
131
- version: '2.13'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - '='
137
- - !ruby/object:Gem::Version
138
- version: '2.13'
26
+ version: '4.4'
139
27
  description: Collects information about hits-of-code
140
28
  email: yegor256@gmail.com
141
29
  executables:
@@ -147,8 +35,10 @@ extra_rdoc_files:
147
35
  files:
148
36
  - ".0pdd.yml"
149
37
  - ".gitattributes"
150
- - ".github/ISSUE_TEMPLATE.md"
151
- - ".github/PULL_REQUEST_TEMPLATE.md"
38
+ - ".github/workflows/codecov.yml"
39
+ - ".github/workflows/pdd.yml"
40
+ - ".github/workflows/rake.yml"
41
+ - ".github/workflows/xcop.yml"
152
42
  - ".gitignore"
153
43
  - ".pdd"
154
44
  - ".rubocop.yml"
@@ -176,6 +66,7 @@ files:
176
66
  - lib/hoc/hits.rb
177
67
  - lib/hoc/svn.rb
178
68
  - lib/hoc/version.rb
69
+ - renovate.json
179
70
  - test/test__helper.rb
180
71
  - test/test_git.rb
181
72
  - test/test_hoc.rb
@@ -183,7 +74,8 @@ files:
183
74
  homepage: http://github.com/teamed/hoc
184
75
  licenses:
185
76
  - MIT
186
- metadata: {}
77
+ metadata:
78
+ rubygems_mfa_required: 'true'
187
79
  post_install_message:
188
80
  rdoc_options:
189
81
  - "--charset=UTF-8"
@@ -193,28 +85,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
85
  requirements:
194
86
  - - ">="
195
87
  - !ruby/object:Gem::Version
196
- version: 1.9.3
88
+ version: 2.2.2
197
89
  required_rubygems_version: !ruby/object:Gem::Requirement
198
90
  requirements:
199
91
  - - ">="
200
92
  - !ruby/object:Gem::Version
201
93
  version: '0'
202
94
  requirements: []
203
- rubyforge_project:
204
- rubygems_version: 2.6.8
95
+ rubygems_version: 3.2.15
205
96
  signing_key:
206
- specification_version: 2
97
+ specification_version: 4
207
98
  summary: Hits Of Code
208
- test_files:
209
- - features/cli.feature
210
- - features/gem_package.feature
211
- - features/git_basics.feature
212
- - features/git_excludes.feature
213
- - features/step_definitions/steps.rb
214
- - features/support/env.rb
215
- - features/svn_basics.feature
216
- - features/uses_config.feature
217
- - test/test__helper.rb
218
- - test/test_git.rb
219
- - test/test_hoc.rb
220
- - test/test_svn.rb
99
+ test_files: []
@@ -1,12 +0,0 @@
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!
@@ -1,11 +0,0 @@
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!