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

Performance issues with custom configuration #11010

Open
mockdeep opened this issue Sep 22, 2022 · 0 comments
Open

Performance issues with custom configuration #11010

mockdeep opened this issue Sep 22, 2022 · 0 comments

Comments

@mockdeep
Copy link
Contributor

When passing a custom configuration option to RuboCop via the programmatic API (a la haml-lint) it is significantly slower than using the default configuration.


Expected behavior

There should be no performance difference when passing a custom configuration.

Actual behavior

It takes about twice as long.

Steps to reproduce the problem

There's probably a better way, but I ran into this with haml-lint when specifying a custom HAML_LINT_RUBOCOP_CONF. It looks like if you call out to RuboCop in a loop with a --config option it triggers this issue. We happen to have an unrelated warning caused by our .rubocop.yml, and one thing I'm noticing is that the warning gets output a single time when using the default .rubocop.yml but a bunch of times when using a custom configuration. So maybe it is reloading the configuration every time?

RuboCop version

$ [bundle exec] rubocop -V
1.36.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.0.4) [x86_64-linux]
  - rubocop-graphql 0.14.6
  - rubocop-performance 1.15.0
  - rubocop-rails 2.16.0
  - rubocop-rake 0.6.0
  - rubocop-rspec 2.13.1```
mockdeep added a commit to mockdeep/haml-lint that referenced this issue Sep 25, 2022
**What**

This adds support for specifying custom RuboCop configuration files via
`.haml-lint.yml`. Users can now add a `config_file:` option with the
path to a custom RuboCop configuration to be used when running
`haml-lint`.

**Why**

Having the ability to specify a custom configuration file for RuboCop
for our haml views is valuable, but handling this via environment
variables can be a challenge. It requires collaborators to add the env
variable to their system, or use a tool like [direnv][de]. On the other
hand, configuring in `.haml-lint.yml` or friends works out of the box
without needing any additional setup.

**Notes**

A caveat of using a custom RuboCop configuration is that there appears
to be [a bit of a performance hit][ph] when using them. Hopefully this
will be resolved at some point on the RuboCop side.

[de]: https://direnv.net/
[ph]: rubocop/rubocop#11010
sds pushed a commit to sds/haml-lint that referenced this issue Sep 27, 2022
**What**

This adds support for specifying custom RuboCop configuration files via
`.haml-lint.yml`. Users can now add a `config_file:` option with the
path to a custom RuboCop configuration to be used when running
`haml-lint`.

**Why**

Having the ability to specify a custom configuration file for RuboCop
for our haml views is valuable, but handling this via environment
variables can be a challenge. It requires collaborators to add the env
variable to their system, or use a tool like [direnv][de]. On the other
hand, configuring in `.haml-lint.yml` or friends works out of the box
without needing any additional setup.

**Notes**

A caveat of using a custom RuboCop configuration is that there appears
to be [a bit of a performance hit][ph] when using them. Hopefully this
will be resolved at some point on the RuboCop side.

[de]: https://direnv.net/
[ph]: rubocop/rubocop#11010
MegaDev007 added a commit to MegaDev007/haml-lint that referenced this issue Aug 3, 2024
**What**

This adds support for specifying custom RuboCop configuration files via
`.haml-lint.yml`. Users can now add a `config_file:` option with the
path to a custom RuboCop configuration to be used when running
`haml-lint`.

**Why**

Having the ability to specify a custom configuration file for RuboCop
for our haml views is valuable, but handling this via environment
variables can be a challenge. It requires collaborators to add the env
variable to their system, or use a tool like [direnv][de]. On the other
hand, configuring in `.haml-lint.yml` or friends works out of the box
without needing any additional setup.

**Notes**

A caveat of using a custom RuboCop configuration is that there appears
to be [a bit of a performance hit][ph] when using them. Hopefully this
will be resolved at some point on the RuboCop side.

[de]: https://direnv.net/
[ph]: rubocop/rubocop#11010
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

1 participant