From 1d8316788b64c1956174f851a365ed1c53325d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Thu, 22 Feb 2024 10:46:37 +0100 Subject: [PATCH 1/8] Bundle update --- Gemfile.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e90aefee..330d7bae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,7 +13,7 @@ GEM chronic (0.10.2) concurrent-ruby (1.2.3) connection_pool (2.4.1) - crack (0.4.6) + crack (1.0.0) bigdecimal rexml diff-lcs (1.5.1) @@ -50,7 +50,7 @@ GEM net-http (0.4.1) uri nio4r (2.7.0) - nokogiri (1.16.0) + nokogiri (1.16.2) mini_portile2 (~> 2.8.2) racc (~> 1.4) octokit (8.1.0) @@ -62,7 +62,7 @@ GEM puma (6.4.2) nio4r (~> 2.0) racc (1.7.3) - rack (3.0.9) + rack (3.0.9.1) rack-protection (4.0.0) base64 (>= 0.1.0) rack (>= 3.0.0, < 4) @@ -70,26 +70,26 @@ GEM rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - redis-client (0.19.1) + redis-client (0.20.0) connection_pool reverse_markdown (2.1.1) nokogiri rexml (3.2.6) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.6) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-support (3.12.1) + rspec-support (~> 3.13.0) + rspec-support (3.13.0) ruby2_keywords (0.0.5) - rugged (1.7.1) + rugged (1.7.2) sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) @@ -99,7 +99,7 @@ GEM multi_json (~> 1.15) rexml (~> 3.2, >= 3.2.5) thor (~> 1.2, >= 1.2.1) - sidekiq (7.2.1) + sidekiq (7.2.2) concurrent-ruby (< 2) connection_pool (>= 2.3.0) rack (>= 2.2.4) @@ -119,7 +119,7 @@ GEM thor (1.3.0) tilt (2.3.0) uri (0.13.0) - webmock (3.19.1) + webmock (3.22.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) From 3d816dc9e784c90e846ece3d819743ac6abc53b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Thu, 22 Feb 2024 10:52:25 +0100 Subject: [PATCH 2/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d87ba458..32f6b86d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Buffy -A service to provide a bot helping scientific journals manage submission reviews. +A service to provide a bot helping scientific journals and communities manage submission reviews. Buffy automates common editorial tasks like those needed by [The Journal of Open Source Software](https://joss.theoj.org/) or [rOpenSci](https://ropensci.org/). From 6100860b8b68aee516092424cc8eb0467f8352e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Thu, 29 Feb 2024 16:48:51 +0100 Subject: [PATCH 3/8] Run checks as GitHub action --- config/settings-production.yml | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/config/settings-production.yml b/config/settings-production.yml index f831bba1..5b036504 100644 --- a/config/settings-production.yml +++ b/config/settings-production.yml @@ -53,9 +53,6 @@ buffy: check_references: description: "Check the references of the paper for missing DOIs" example_invocation: "@editorialbot check references" - repo_checks: - description: "Perform checks on the repository" - example_invocation: "@editorialbot check repository" reviewer_checklist_comment: if: title: "^\\[REVIEW\\]:" @@ -129,6 +126,18 @@ buffy: success_msg: Invitation to edit this submission sent! error_msg: "There was a problem inviting the user to edit this submission." github_action: + - checks: + command: check repository + workflow_repo: openjournals/joss-papers + workflow_name: checks.yml + workflow_ref: master + description: "Run checks and provide information on the repository and the paper file" + data_from_issue: + - branch + - target-repository + - issue_id + mapping: + repository_url: target-repository - draft_paper: command: generate pdf workflow_repo: openjournals/joss-papers @@ -241,19 +250,25 @@ buffy: title: "^\\[PRE REVIEW\\]:" template_file: pre-review_welcome.md check_references: true - repo_checks: true run_responder: - responder_key: github_action - responder_name: draft_paper + - checks: + responder_key: github_action + responder_name: checks + - draft-paper: + responder_key: github_action + responder_name: draft_paper - review_issue: if: title: "^\\[REVIEW\\]:" template_file: review_welcome.md check_references: true - repo_checks: true run_responder: - responder_key: github_action - responder_name: draft_paper + - checks: + responder_key: github_action + responder_name: checks + - draft-paper: + responder_key: github_action + responder_name: draft_paper - close_other_issues: if: title: "^(?!\\[REVIEW\\]:|\\[PRE REVIEW\\]:)" From aac9f43d48a5e8bc67c763b9fd42ae2a68933005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Thu, 29 Feb 2024 17:50:48 +0100 Subject: [PATCH 4/8] Fix indentation --- config/settings-production.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/settings-production.yml b/config/settings-production.yml index 5b036504..9d856043 100644 --- a/config/settings-production.yml +++ b/config/settings-production.yml @@ -252,11 +252,11 @@ buffy: check_references: true run_responder: - checks: - responder_key: github_action - responder_name: checks + responder_key: github_action + responder_name: checks - draft-paper: - responder_key: github_action - responder_name: draft_paper + responder_key: github_action + responder_name: draft_paper - review_issue: if: title: "^\\[REVIEW\\]:" From ada194610e93dddfc14a3e1041e3d752da83437e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Thu, 29 Feb 2024 18:11:19 +0100 Subject: [PATCH 5/8] Fix indentation --- config/settings-production.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/settings-production.yml b/config/settings-production.yml index 9d856043..783f600b 100644 --- a/config/settings-production.yml +++ b/config/settings-production.yml @@ -264,11 +264,11 @@ buffy: check_references: true run_responder: - checks: - responder_key: github_action - responder_name: checks + responder_key: github_action + responder_name: checks - draft-paper: - responder_key: github_action - responder_name: draft_paper + responder_key: github_action + responder_name: draft_paper - close_other_issues: if: title: "^(?!\\[REVIEW\\]:|\\[PRE REVIEW\\]:)" From d54c745d98db686689f0f721f32623080e331bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Fri, 1 Mar 2024 13:10:29 +0100 Subject: [PATCH 6/8] Move DOI validation to a GitHub action call --- config/settings-production.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/config/settings-production.yml b/config/settings-production.yml index 783f600b..3a20e444 100644 --- a/config/settings-production.yml +++ b/config/settings-production.yml @@ -50,9 +50,6 @@ buffy: only: editors reminders: only: editors - check_references: - description: "Check the references of the paper for missing DOIs" - example_invocation: "@editorialbot check references" reviewer_checklist_comment: if: title: "^\\[REVIEW\\]:" @@ -138,6 +135,18 @@ buffy: - issue_id mapping: repository_url: target-repository + - references: + command: check references + workflow_repo: openjournals/joss-papers + workflow_name: references.yml + workflow_ref: master + description: "Check the references of the paper for missing DOIs" + data_from_issue: + - branch + - target-repository + - issue_id + mapping: + repository_url: target-repository - draft_paper: command: generate pdf workflow_repo: openjournals/joss-papers @@ -172,7 +181,8 @@ buffy: mapping: repository_url: target-repository run_responder: - responder_key: check_references + responder_key: github_action + responder_name: references - accept: if: value_matches: @@ -249,11 +259,13 @@ buffy: if: title: "^\\[PRE REVIEW\\]:" template_file: pre-review_welcome.md - check_references: true run_responder: - checks: responder_key: github_action responder_name: checks + - references: + responder_key: github_action + responder_name: references - draft-paper: responder_key: github_action responder_name: draft_paper @@ -261,11 +273,13 @@ buffy: if: title: "^\\[REVIEW\\]:" template_file: review_welcome.md - check_references: true run_responder: - checks: responder_key: github_action responder_name: checks + - references: + responder_key: github_action + responder_name: references - draft-paper: responder_key: github_action responder_name: draft_paper From 946effa96e332d81caf28b76273caff8eee64725 Mon Sep 17 00:00:00 2001 From: Jonny Saunders Date: Wed, 6 Mar 2024 01:20:32 -0800 Subject: [PATCH 7/8] Always report bibtex entries in DOI checker (#101) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Ensure an entry is emitted for every item in the bibliography when doing DOI checking * Update spec for new cases * Report on bib entries missing info --------- Co-authored-by: Arfon Smith Co-authored-by: Juanjo Bazán --- app/lib/doi_checker.rb | 10 +++++++--- spec/doi_checker_spec.rb | 19 +++++++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/app/lib/doi_checker.rb b/app/lib/doi_checker.rb index f2fdeac5..cadcca60 100644 --- a/app/lib/doi_checker.rb +++ b/app/lib/doi_checker.rb @@ -19,13 +19,17 @@ def check_dois # If there's no DOI present, check Crossref to see if we can find a candidate DOI for this entry. elsif entry.has_field?('title') candidate_doi = crossref_lookup(entry.title.value) + truncated_title = entry.title.to_s[0,50] + truncated_title += "..." if truncated_title.length < entry.title.to_s.length if candidate_doi == "CROSSREF-ERROR" - truncated_title = entry.title.to_s[0,50] - truncated_title += "..." if truncated_title.length < entry.title.to_s.length doi_summary[:missing].push("Errored finding suggestions for \"#{truncated_title}\", please try later") elsif candidate_doi - doi_summary[:missing].push("#{candidate_doi} may be a valid DOI for title: #{entry.title}") + doi_summary[:missing].push("#{candidate_doi} may be a valid DOI for title: #{truncated_title}") + else + doi_summary[:missing].push("No DOI given, and none found for title: #{truncated_title}") end + else + doi_summary[:missing].push("Entry without DOI or title found") end end end diff --git a/spec/doi_checker_spec.rb b/spec/doi_checker_spec.rb index 5614c5cd..d45b049a 100644 --- a/spec/doi_checker_spec.rb +++ b/spec/doi_checker_spec.rb @@ -82,8 +82,9 @@ expect(doi_summary[:missing][0]).to eq("Errored finding suggestions for \"#{expected_title}\", please try later") end - it "should ignore entries no DOI and no crossref alternative" do - missing_doi = BibTeX::Entry.new({title: "No DOI"}) + it "should report entries with no DOI and no crossref alternative as missing DOIs" do + title = "No DOI" + missing_doi = BibTeX::Entry.new({title: title}) doi_checker = DOIChecker.new([missing_doi]) expect(doi_checker).to receive(:crossref_lookup).with("No DOI").and_return(nil) @@ -92,7 +93,17 @@ expect(doi_summary[:ok]).to be_empty expect(doi_summary[:invalid]).to be_empty - expect(doi_summary[:missing]).to be_empty + expect(doi_summary[:missing][0]).to eq("No DOI given, and none found for title: #{title}") + end + + it "should report entries with no DOI or title as missing both" do + entry = BibTeX::Entry.new(journal: "A Well Respected Journal") + doi_checker = DOIChecker.new([entry]) + + doi_summary = doi_checker.check_dois + expect(doi_summary[:ok]).to be_empty + expect(doi_summary[:invalid]).to be_empty + expect(doi_summary[:missing][0]).to eq("Entry without DOI or title found") end end @@ -203,4 +214,4 @@ end end -end \ No newline at end of file +end 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 8/8] 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