attractor 1.0.2 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +200 -44
- data/Rakefile +0 -3
- data/app/assets/images/attractor_favicon.png +0 -0
- data/app/assets/javascripts/index.js.erb +4 -5
- data/app/assets/javascripts/index.pack.js +6 -6
- data/app/views/index.html.erb +6 -56
- data/attractor.gemspec +7 -1
- data/bin/test +6 -0
- data/lib/attractor.rb +29 -14
- data/lib/attractor/calculators/base_calculator.rb +5 -2
- data/lib/attractor/cli.rb +46 -28
- data/lib/attractor/detectors/base_detector.rb +7 -0
- data/lib/attractor/duration_parser.rb +27 -0
- data/lib/attractor/gem_names.rb +16 -0
- data/lib/attractor/registry_entry.rb +12 -0
- data/lib/attractor/reporters/base_reporter.rb +2 -0
- data/lib/attractor/reporters/console_reporter.rb +12 -5
- data/lib/attractor/reporters/html_reporter.rb +30 -6
- data/lib/attractor/reporters/sinatra_reporter.rb +3 -0
- data/lib/attractor/suggester.rb +1 -1
- data/lib/attractor/version.rb +1 -1
- metadata +50 -7
- data/.github/workflows/ruby.yml +0 -25
- data/.rspec +0 -3
- data/.travis.yml +0 -10
- data/lib/attractor/calculators/js_calculator.rb +0 -17
- data/lib/attractor/calculators/ruby_calculator.rb +0 -21
data/.github/workflows/ruby.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
name: Ruby
|
2
|
-
|
3
|
-
on: [push]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
|
8
|
-
runs-on: ubuntu-latest
|
9
|
-
|
10
|
-
strategy:
|
11
|
-
matrix:
|
12
|
-
ruby-version: [2.4.x, 2.5.x, 2.6.x]
|
13
|
-
|
14
|
-
steps:
|
15
|
-
- uses: actions/checkout@v1
|
16
|
-
- name: Set up Ruby ${{ matrix.ruby-version }}
|
17
|
-
uses: actions/setup-ruby@v1
|
18
|
-
with:
|
19
|
-
ruby-version: ${{ matrix.ruby-version }}
|
20
|
-
- name: Build and test with Rake
|
21
|
-
run: |
|
22
|
-
gem install bundler
|
23
|
-
bundle install --jobs 4 --retry 3
|
24
|
-
bundle exec rspec spec
|
25
|
-
bundle exec cucumber features
|
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Attractor
|
4
|
-
class JsCalculator < BaseCalculator
|
5
|
-
def initialize(file_prefix: '', minimum_churn_count: 3)
|
6
|
-
super(file_prefix: file_prefix, file_extension: '(js|jsx)', minimum_churn_count: minimum_churn_count)
|
7
|
-
end
|
8
|
-
|
9
|
-
def calculate
|
10
|
-
super do |change|
|
11
|
-
complexity, details = JSON.parse(`node #{__dir__}/../../../dist/calculator.bundle.js #{Dir.pwd}/#{change[:file_path]}`)
|
12
|
-
|
13
|
-
[complexity, details]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'flog'
|
4
|
-
|
5
|
-
module Attractor
|
6
|
-
class RubyCalculator < BaseCalculator
|
7
|
-
def initialize(file_prefix: '', minimum_churn_count: 3)
|
8
|
-
super(file_prefix: file_prefix, file_extension: 'rb', minimum_churn_count: minimum_churn_count)
|
9
|
-
end
|
10
|
-
|
11
|
-
def calculate
|
12
|
-
super do |change|
|
13
|
-
flogger = Flog.new(all: true)
|
14
|
-
flogger.flog(change[:file_path])
|
15
|
-
complexity = flogger.total_score
|
16
|
-
details = flogger.totals
|
17
|
-
[complexity, details]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|