rubycritic
rubycritic copied to clipboard
Shell error with rake task
!!! Running `rubycritic` rake command
!!! Inspecting 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 with options --mode-ci --format json --no-browser
Warning: you are leaving 5 commits behind, not connected to
any of your branches:
045b88d Merge d43ecf263cf6f45b7f1981e07cd489b9e7d23a52 into dec6daea97a124a57a5c599768e2fdca7ab99011
d43ecf2 Fix up tests
171d4a4 Update list of what is being observed
ebbc596 Missed the addition of the observer
a5353a5 Move mixpanel/mailchimp updates to on-demand observer setup
If you want to keep them by creating a new branch, this may be a good time
to do so with:
git branch <new-branch-name> 045b88d
Switched to branch 'master'
running flay smells
.................................................
running flog smells
........................................................................................................................................................................................................................................................................................................................................................................................
running reek smells
........................................................................................................................................................................................................................................................................................................................................................................................
running complexity
........................................................................................................................................................................................................................................................................................................................................................................................
running attributes
........................................................................................................................................................................................................................................................................................................................................................................................
running churn
........................................................................................................................................................................................................................................................................................................................................................................................
running simple_cov
........................................................................................................................................................................................................................................................................................................................................................................................
sh: 1: Syntax error: "(" unexpected
running flay smells
.................................................
running flog smells
........................................................................................................................................................................................................................................................................................................................................................................................
running reek smells
........................................................................................................................................................................................................................................................................................................................................................................................
running complexity
........................................................................................................................................................................................................................................................................................................................................................................................
running attributes
........................................................................................................................................................................................................................................................................................................................................................................................
running churn
........................................................................................................................................................................................................................................................................................................................................................................................
running simple_cov
........................................................................................................................................................................................................................................................................................................................................................................................
sh: 1: Syntax error: "(" unexpected
Score (87.54) is below the minimum 95
The command "bundle exec rspec && bundle leak check --update && bundle audit check --update && git reset --hard && bundle exec rake rubycritic" exited with 0.
@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.