Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No failure message for cop violation #133

Open
brentgreeff opened this issue Oct 10, 2024 · 3 comments
Open

No failure message for cop violation #133

brentgreeff opened this issue Oct 10, 2024 · 3 comments

Comments

@brentgreeff
Copy link

# @example EnforcedStyle: symbol (default)
      #   # bad
      #   create('user')
      #   build "user", username: "NAME"

I believe I am breaking this rule with before { create('project') }

I can see the cop being loaded, and the file where I break this rule is also checked.

bin/rubocop  --debug
configuration from /Users/brent/projects/assessments/confab/.rubocop.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-rspec-3.1.0/config/default.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-rspec-3.1.0/config/default.yml
Default configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-1.66.1/config/default.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-capybara-2.21.0/config/default.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-capybara-2.21.0/lib/../config/default.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-factory_bot-2.26.1/config/default.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-factory_bot-2.26.1/lib/../config/default.yml
Inheriting configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-rails-omakase-1.0.0/rubocop.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-performance-1.22.1/config/default.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-performance-1.22.1/config/default.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-rails-2.26.2/config/default.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-rails-2.26.2/config/default.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-minitest-0.36.0/config/default.yml
configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-minitest-0.36.0/config/default.yml
Use parallel by default.
Running parallel inspection

Can you recommend how I can debug this further?
I am using Rails 8.0.0.beta1.

brentgreeff added a commit to brentgreeff/confab that referenced this issue Oct 11, 2024
- Add Thoughtbot cops & capybara & factory_bot, I logged an issue: rubocop/rubocop-factory_bot#133 not sure if its a rails 8 issue, but cop failures dont seem consistent. I noticed not all single quoted strings are being caught.
@pirj
Copy link
Member

pirj commented Oct 12, 2024

Sorry, what cop?

@brentgreeff
Copy link
Author

configuration from /Users/brent/.rvm/gems/ruby-3.3.5@confab/gems/rubocop-factory_bot-2.26.1/lib/../config/default.yml

this one.

before { create('project') }

is this correct according to this gem?

@pirj
Copy link
Member

pirj commented Oct 12, 2024

What of the cops you expected to fail? https://docs.rubocop.org/rubocop-factory_bot/cops.html

You’ve already provided an excerpt from the cop’s documentation. May I kindly ask you to also put the cop’s name in the issue title or description?

Can you recommend how I can debug this further?

The above will be a solid first step.
After that, I suggest checking the cop’s spec. Does it look into hooks? Might be not. If not - send a PR with a failing spec. Kindly appreciated if you add specs for both styles.

Next, we can discuss in the PR how to actually fix the issue.

At a glance, I can’t tell why it doesn’t work.
Also, the “Explicit” option is confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants