Open lloydwatkin opened 4 years ago
@lloydwatkin Weird. What version of rubycritic
are you using?
Latest 2.4.3
@lloydwatkin Could you share your Gemfile.lock
and .rubycritic.yml
? I can't reproduce this issue without more information.
# frozen_string_literal: true
if defined?(Rails) && (Rails.env.development? || Rails.env.test?)
require "rubycritic/rake_task"
RubyCritic::RakeTask.new do |task|
task.name = 'rubycritic'
task.options = '--mode-ci --format json --no-browser'
task.verbose = true
task.paths = FileList[
'app/errors',
'app/jobs',
'app/serializers',
'app/tasks',
'app/assets',
'app/exceptions',
'app/mailers',
'app/services',
'app/uploaders',
'app/controllers',
'app/helpers',
'app/models',
'app/states',
'app/views',
]
end
end
I am getting the same error, latest version, and I am using the command line.
bundle exec rubycritic --no-browser --mode-ci --minimum-score=95
UPDATE
I tested this a number of ways, and it is only occurring on my github actions CI setup when I include the --mode-ci
flag.
It does not occur with this setup below.
name: Build and Test Application
on:
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v1
# ----------------------------------------------------Postgres
- name: Install Postgres Dependencies
run: sudo apt-get install libpq-dev
# ----------------------------------------------------Ruby
- name: Install Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7.x
- name: Ruby Version
run: |
ruby -v
- name: Setup Ruby Dependencies
run: |
gem update bundler
bundle install --jobs 4 --retry 3
# ----------------------------------------------------Postgres
- name: Setup Database
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
RAILS_ENV: continuous_integration
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
run: |
export RUBYOPT='-W:no-deprecated -W:no-experimental'
echo 'Running: bundle exec rake db:create db:structure:load'
bundle exec rake db:create db:structure:load
# ----------------------------------------------------Rubocop
- name: Rubocop Quality Checks
run: |
echo 'Running: bundle exec rubocop'
bundle exec rubocop
# ----------------------------------------------------Brakeman
- name: Brakeman Quality Checks
run: |
echo 'Running: bundle exec brakeman'
bundle exec brakeman
# ----------------------------------------------------RubyCritic
- name: RubyCritic Quality Checks
run: |
export RUBYOPT='-W:no-deprecated -W:no-experimental'
echo 'Running: bundle exec rubycritic --no-browser --minimum-score=95'
bundle exec rubycritic --no-browser --minimum-score=95
# ----------------------------------------------------Rspec
- name: Rspec Automated Tests
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
RAILS_ENV: continuous_integration
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
run: |
export RUBYOPT='-W:no-deprecated -W:no-experimental'
echo 'Running: bundle exec rspec --format=documentation'
bundle exec rspec --format=documentation
Hi! I'm having exactly the same issue trying to run the ci mode en a gitlab CI runner.
I've realised (it seems) that when the error appears, the switch from master to the current branch to compare doesn't occur, this can also be seen in the first comment of this issue (the log line saying 'Switched to branch ...' is not there).
Note that I'm not even using bundler or the project Gemfile to run rubycritic (just to speed up the pipeline), just checking out the code and installing rubycritic alone, all other modes look ok, just having issues on this specific case using ci mode.
I faced the same issue with GitHub Actions. It's a problem that is happened if nothing is a branch.
When using the following code,
- name: Rubycritic
run: |
git branch
gem install rubycritic
rubycritic
git branch
command outputs * (HEAD detached at pull/69/merge)
.
The error happen in this situation.
I resolved it just to check out an appropriate branch.
- name: Rubycritic
run: |
git checkout -b ${{ github.head_ref}} # need check out
gem install rubycritic
rubycritic
Hey, I think this was fixed in https://github.com/whitesmith/rubycritic/pull/424 and can be closed.