repo_analyzer 1.4.0 → 1.5.0
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 +8 -0
- data/Gemfile.lock +1 -1
- data/app/jobs/repo_analyzer/extract_project_info_job.rb +2 -2
- data/lib/repo_analyzer/version.rb +1 -1
- data/lib/tasks/repo_analyzer_tasks.rake +4 -2
- data/spec/jobs/repo_analyzer/extract_project_info_job_spec.rb +3 -2
- metadata +2 -5
- data/app/extractors/repo_analyzer/fasterer_extractor.rb +0 -34
- data/spec/extractors/fasterer_extractor_spec.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eebe99c02596c84f2083e7bbbc0caacb0261f702ed21421015f6c9d71e0015d
|
4
|
+
data.tar.gz: db9318ec621fbd332662d7211b86ed581fb40a4d9108c2a465181f39d81feb91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c948672842944f02f10a8fafd98628dbf098030fe97b5074e6cbb0ae67d992716c03f5bfe7a306abaf64401cca0b3c6d8dd03fef24824a6ff624c7e454e0525d
|
7
|
+
data.tar.gz: 74a2984c5557c394cfce472533fecff7c5a82a5b6e95b6d2f2074fca9b1ca15004b50a5a4ca6d5e0440717c26968826f50e44fcf760dc03a72cc42c58314a4dd
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
|
+
|
5
|
+
### v1.5.0
|
6
|
+
#### Added
|
7
|
+
|
8
|
+
* Run analyze rake task with custom project path.
|
9
|
+
#### Fixed
|
10
|
+
|
11
|
+
* Remove [fasterer](https://github.com/DamirSvrtan/fasterer) extractor.
|
4
12
|
### v1.4.0
|
5
13
|
#### Added
|
6
14
|
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module RepoAnalyzer
|
2
2
|
class ExtractProjectInfoJob < ApplicationJob
|
3
|
-
def perform(repo_name)
|
3
|
+
def perform(repo_name, project_path)
|
4
4
|
project_info = {}
|
5
|
-
bridge = RepoAnalyzer::ProjectDataBridge.new(repo_name)
|
5
|
+
bridge = RepoAnalyzer::ProjectDataBridge.new(repo_name, project_path)
|
6
6
|
|
7
7
|
for_each_extractor do |extractor|
|
8
8
|
extracted_data = extractor.new(bridge).extract
|
@@ -1,7 +1,9 @@
|
|
1
1
|
namespace :repo_analyzer do
|
2
2
|
desc "Extract repo info and post to defined endpoint"
|
3
|
-
task :analyze, [:repo_name] => :environment do |_t, args|
|
4
|
-
project_info = RepoAnalyzer::ExtractProjectInfoJob.perform_now(
|
3
|
+
task :analyze, [:repo_name, :project_path] => :environment do |_t, args|
|
4
|
+
project_info = RepoAnalyzer::ExtractProjectInfoJob.perform_now(
|
5
|
+
args.repo_name, args.project_path
|
6
|
+
)
|
5
7
|
RepoAnalyzer::PostExtractedInfoJob.perform_now(args.repo_name, project_info)
|
6
8
|
end
|
7
9
|
end
|
@@ -2,6 +2,7 @@ require 'rails_helper'
|
|
2
2
|
|
3
3
|
describe RepoAnalyzer::ExtractProjectInfoJob, type: :job do
|
4
4
|
let(:repo_name) { "platanus/alisur-formulator" }
|
5
|
+
let(:project_path) { "spec/assets/test_project" }
|
5
6
|
|
6
7
|
let(:files_list) do
|
7
8
|
"app/extractors/repo_analyzer/project_versions_extractor.rb"
|
@@ -31,7 +32,7 @@ describe RepoAnalyzer::ExtractProjectInfoJob, type: :job do
|
|
31
32
|
let(:engine_root) { instance_double("Pathname", join: files_list) }
|
32
33
|
|
33
34
|
def perform_now
|
34
|
-
described_class.perform_now(repo_name)
|
35
|
+
described_class.perform_now(repo_name, project_path)
|
35
36
|
end
|
36
37
|
|
37
38
|
before do
|
@@ -44,7 +45,7 @@ describe RepoAnalyzer::ExtractProjectInfoJob, type: :job do
|
|
44
45
|
|
45
46
|
it do
|
46
47
|
perform_now
|
47
|
-
expect(RepoAnalyzer::ProjectDataBridge).to have_received(:new).with(repo_name).once
|
48
|
+
expect(RepoAnalyzer::ProjectDataBridge).to have_received(:new).with(repo_name, project_path).once
|
48
49
|
expect(RepoAnalyzer::ProjectVersionsExtractor).to have_received(:new).with(bridge).once
|
49
50
|
end
|
50
51
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repo_analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Platanus
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler-audit
|
@@ -350,7 +350,6 @@ files:
|
|
350
350
|
- app/extractors/repo_analyzer/bundler_audit_extractor.rb
|
351
351
|
- app/extractors/repo_analyzer/bundler_stats_extractor.rb
|
352
352
|
- app/extractors/repo_analyzer/circleci_extractor.rb
|
353
|
-
- app/extractors/repo_analyzer/fasterer_extractor.rb
|
354
353
|
- app/extractors/repo_analyzer/github_extractor.rb
|
355
354
|
- app/extractors/repo_analyzer/power_types_extractor.rb
|
356
355
|
- app/extractors/repo_analyzer/project_config_extractor.rb
|
@@ -448,7 +447,6 @@ files:
|
|
448
447
|
- spec/extractors/bundler_audit_extractor_spec.rb
|
449
448
|
- spec/extractors/bundler_stats_extractor_spec.rb
|
450
449
|
- spec/extractors/circleci_extractor_spec.rb
|
451
|
-
- spec/extractors/fasterer_extractor_spec.rb
|
452
450
|
- spec/extractors/github_extractor_spec.rb
|
453
451
|
- spec/extractors/power_types_extractor_spec.rb
|
454
452
|
- spec/extractors/project_config_extractor_spec.rb
|
@@ -556,7 +554,6 @@ test_files:
|
|
556
554
|
- spec/extractors/bundler_audit_extractor_spec.rb
|
557
555
|
- spec/extractors/bundler_stats_extractor_spec.rb
|
558
556
|
- spec/extractors/circleci_extractor_spec.rb
|
559
|
-
- spec/extractors/fasterer_extractor_spec.rb
|
560
557
|
- spec/extractors/github_extractor_spec.rb
|
561
558
|
- spec/extractors/power_types_extractor_spec.rb
|
562
559
|
- spec/extractors/project_config_extractor_spec.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require "fasterer/file_traverser"
|
2
|
-
|
3
|
-
module RepoAnalyzer
|
4
|
-
class FastererExtractor < ProjectInfoExtractor
|
5
|
-
private
|
6
|
-
|
7
|
-
def extracted_info
|
8
|
-
{ speedups: fasterer_info }
|
9
|
-
end
|
10
|
-
|
11
|
-
def fasterer_info
|
12
|
-
@fasterer_info ||= fasterer_text.split("\n").inject([]) do |memo, row|
|
13
|
-
next memo if row.blank?
|
14
|
-
|
15
|
-
row_parts = row.split("\e")
|
16
|
-
file_path_and_line = row_parts.second.gsub('[0;31;49m', '')
|
17
|
-
file_path, line = file_path_and_line.split(':')
|
18
|
-
next memo if file_path.include?("files inspected")
|
19
|
-
|
20
|
-
message = row_parts.last.gsub('[0m ', '')
|
21
|
-
memo << {
|
22
|
-
file_path: file_path,
|
23
|
-
line: line,
|
24
|
-
message: message
|
25
|
-
}
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def fasterer_text
|
30
|
-
file_traverser = Fasterer::FileTraverser.new(".")
|
31
|
-
OutputUtils.with_captured_stdout { file_traverser.traverse }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
describe RepoAnalyzer::FastererExtractor, repo_analyzer_extractor_helpers: true do
|
4
|
-
describe "#extract" do
|
5
|
-
let(:fasterer_result_content) do
|
6
|
-
<<~TEXT
|
7
|
-
\e[0;31;49mapp/extractors/repo_analyzer/github_extractor.rb:60\e[0m Don't rescue NoMethodError, rather check with respond_to?.
|
8
|
-
|
9
|
-
\e[0;31;49mapp/jobs/repo_analyzer/extract_project_info_job.rb:17\e[0m Calling blocks with call is slower than yielding.
|
10
|
-
|
11
|
-
\e[0;31;49mspec/dummy/config/puma.rb:14\e[0m Hash#fetch with second argument is slower than Hash#fetch with block.
|
12
|
-
|
13
|
-
\e[0;32;49m75 files inspected\e[0m, \e[0;31;49m3 offenses detected\e[0m
|
14
|
-
TEXT
|
15
|
-
end
|
16
|
-
|
17
|
-
before do
|
18
|
-
allow(OutputUtils).to receive(:with_captured_stdout).and_return(fasterer_result_content)
|
19
|
-
end
|
20
|
-
|
21
|
-
let(:expected) do
|
22
|
-
{
|
23
|
-
speedups: [
|
24
|
-
{
|
25
|
-
file_path: "app/extractors/repo_analyzer/github_extractor.rb",
|
26
|
-
line: "60",
|
27
|
-
message: "Don't rescue NoMethodError, rather check with respond_to?."
|
28
|
-
},
|
29
|
-
{
|
30
|
-
file_path: "app/jobs/repo_analyzer/extract_project_info_job.rb",
|
31
|
-
line: "17",
|
32
|
-
message: "Calling blocks with call is slower than yielding."
|
33
|
-
},
|
34
|
-
{
|
35
|
-
file_path: "spec/dummy/config/puma.rb",
|
36
|
-
line: "14",
|
37
|
-
message: "Hash#fetch with second argument is slower than Hash#fetch with block."
|
38
|
-
}
|
39
|
-
]
|
40
|
-
}.with_indifferent_access
|
41
|
-
end
|
42
|
-
|
43
|
-
it { expect(extract[:fasterer_extractor]).to eq(expected) }
|
44
|
-
end
|
45
|
-
end
|