Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Node & Gitinspector dependencies #102

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions app/lib/utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,4 @@ def run_cloc(local_path)
status.success? ? result : nil
end

def run_gitinspector(local_path)
result, stderr, status = Open3.capture3("PYTHONIOENCODING=utf-8 gitinspector -f** #{local_path}")
status.success? ? result : nil
end

end
7 changes: 0 additions & 7 deletions app/workers/repo_checks_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,13 @@ def repo_summary
message = "```\nSoftware report:\n"

cloc_result = run_cloc(path)
gitinspector_result = run_gitinspector(path)

if cloc_result
message << "#{cloc_result}"
else
message << "cloc failed to run analysis of the source code"
end
message << "\n\n"

if gitinspector_result
message << "#{gitinspector_result}"
else
message << "gitinspector failed to run statistical information for the repository"
end
message << "\n```"

respond(message)
Expand Down
2 changes: 0 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ This will be the "user" responding to the commands issued from a reviews reposit
Some applications and services must be available to use by Buffy:

- **[Redis](https://redis.io/)**: To process background jobs Buffy needs `redis` installed.
- **[Gitinspector](https://github.com/ejwa/gitinspector)**: The *Respository Checks Responder* performs a statistical analysis using it.
- **[cloc](https://github.com/AlDanial/cloc)**: The *Respository Checks Responder* can analyze source code, to run this check `cloc` is used.

#### Deployment
Expand All @@ -47,7 +46,6 @@ As an example, we will use [Heroku](https://www.heroku.com) to deploy Buffy. How

- To process background jobs, Buffy needs a `redis` add-on, such as Heroku Redis or RedisGreen etc.
- You can use [this Heroku buildpack](https://github.com/openjournals/heroku-buildpack-cloc) to install the `cloc` dependency.
- You can install Gitinspector using npm by following the instructions [here](https://www.npmjs.com/package/gitinspector). If you plan to deploy to Heroku, you can add the `heroku/nodejs` buildpack to your app.

**2.** In the app settings add the following Config Vars:

Expand Down
2 changes: 1 addition & 1 deletion docs/responders/repo_checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The body of the issue should have the url of the repository marked with HTML com

The following values are valid for the `:checks` list:

* `repo summary`: This check performs an analysis of the source code and list authorship, contributions and file types information.
* `repo summary`: This check performs an analysis of the source code and list file types information.
* `languages`: This will detect the languages used in the repository and tagged the issue with the top three used languages.
* `wordcount`: This will count the number of words in the paper file.
* `license`: This will look for an Open Source License in the target repo and reply an error message if no license is found.
Expand Down
9 changes: 0 additions & 9 deletions package.json

This file was deleted.

18 changes: 0 additions & 18 deletions spec/utilities_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,4 @@ class TestingUtilities
end
end

describe "#run_gitinspector" do
it "should run cloc return true" do
expect(Open3).to receive(:capture3).
with("PYTHONIOENCODING=utf-8 gitinspector -f** tmp/543/repo").
and_return(["OK", "", OpenStruct.new(success?: true)])

expect(subject.run_gitinspector("tmp/543/repo")).to be_truthy
end

it "should return nil if command fails" do
expect(Open3).to receive(:capture3).
with("PYTHONIOENCODING=utf-8 gitinspector -f** tmp/543/repo").
and_return(["", "stats failed", OpenStruct.new(success?: false)])

expect(subject.run_gitinspector("tmp/543/repo")).to be_falsy
end
end

end
12 changes: 0 additions & 12 deletions spec/workers/repo_checks_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,18 @@
describe "#repo_summary" do
before do
allow(@worker).to receive(:run_cloc).and_return("Ruby 50%, Julia 50%")
allow(@worker).to receive(:run_gitinspector).and_return("Author: Buffy Summers")
end

it "should include cloc report" do
expect(@worker).to receive(:respond).with(/Ruby 50%, Julia 50%/)
@worker.repo_summary
end

it "should include gitinspector report" do
expect(@worker).to receive(:respond).with(/Author: Buffy Summers/)
@worker.repo_summary
end

it "should include error message if cloc fails" do
expect(@worker).to receive(:run_cloc).and_return(nil)
expect(@worker).to receive(:respond).with(/cloc failed to run/)
@worker.repo_summary
end

it "should include gitinspector report" do
expect(@worker).to receive(:run_gitinspector).and_return(nil)
expect(@worker).to receive(:respond).with(/gitinspector failed to run/)
@worker.repo_summary
end
end

describe "#detect_languages" do
Expand Down