diff --git a/Gemfile.lock b/Gemfile.lock index 919b8a48..1d228a4e 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) @@ -64,7 +64,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) @@ -72,26 +72,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) @@ -101,7 +101,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) @@ -121,7 +121,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) 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/). 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/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/config/settings-production.yml b/config/settings-production.yml index b261e8cb..8d23659c 100644 --- a/config/settings-production.yml +++ b/config/settings-production.yml @@ -47,12 +47,6 @@ buffy: only: editors reminders: only: editors - 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" jose_reviewer_checklist: if: title: "^\\[REVIEW\\]:" @@ -124,6 +118,30 @@ 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 + - 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/jose-papers @@ -157,7 +175,8 @@ buffy: mapping: repository_url: target-repository run_responder: - responder_key: check_references + responder_key: github_action + responder_name: references - accept: if: value_matches: @@ -234,20 +253,30 @@ buffy: if: 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 + - references: + responder_key: github_action + responder_name: references + - 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 + - references: + responder_key: github_action + responder_name: references + - draft-paper: + responder_key: github_action + responder_name: draft_paper - close_other_issues: if: title: "^(?!\\[REVIEW\\]:|\\[PRE REVIEW\\]:)" 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/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 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