From 6ca7f25d0e9a1bd5d33c99774a21a250d3a98dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Wed, 13 Mar 2024 12:54:27 +0100 Subject: [PATCH] Remove Node & Gitinspector dependencies --- app/lib/utilities.rb | 5 ----- app/workers/repo_checks_worker.rb | 7 ------- docs/installation.md | 2 -- docs/responders/repo_checks.md | 2 +- package.json | 9 --------- spec/utilities_spec.rb | 18 ------------------ spec/workers/repo_checks_worker_spec.rb | 12 ------------ 7 files changed, 1 insertion(+), 54 deletions(-) delete mode 100644 package.json diff --git a/app/lib/utilities.rb b/app/lib/utilities.rb index 52679e7f..d16271a2 100644 --- a/app/lib/utilities.rb +++ b/app/lib/utilities.rb @@ -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 diff --git a/app/workers/repo_checks_worker.rb b/app/workers/repo_checks_worker.rb index 4532daa2..5f40018c 100644 --- a/app/workers/repo_checks_worker.rb +++ b/app/workers/repo_checks_worker.rb @@ -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) diff --git a/docs/installation.md b/docs/installation.md index 97d86fe0..f073c4e5 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -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 @@ -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: diff --git a/docs/responders/repo_checks.md b/docs/responders/repo_checks.md index 9212a995..5f05b3ac 100644 --- a/docs/responders/repo_checks.md +++ b/docs/responders/repo_checks.md @@ -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. diff --git a/package.json b/package.json deleted file mode 100644 index 9bfa221c..00000000 --- a/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "buffy-dependencies", - "description": "Some dependencies to install on deployment", - "scripts": { - "preinstall": "npm install -g gitinspector" - }, - "author": "Juanjo Bazán", - "license": "MIT" -} diff --git a/spec/utilities_spec.rb b/spec/utilities_spec.rb index 1dd9516c..7a14543f 100644 --- a/spec/utilities_spec.rb +++ b/spec/utilities_spec.rb @@ -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 diff --git a/spec/workers/repo_checks_worker_spec.rb b/spec/workers/repo_checks_worker_spec.rb index 96536f44..3a7eb99b 100644 --- a/spec/workers/repo_checks_worker_spec.rb +++ b/spec/workers/repo_checks_worker_spec.rb @@ -43,7 +43,6 @@ 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 @@ -51,22 +50,11 @@ @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