Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Daniel Vandersluis
    @dvandersluis
    Yeah looks to be the case because Set#=== wasn't added until 2.5
    I'm going to open an issue on rubocop-ast
    Daniel Vandersluis
    @dvandersluis
    Never mind you fixed it already haha 🤦🏻‍♂️
    Marc-André Lafortune
    @marcandre
    I want to auto-correct a node by adding a new line of code after it (with the same indent). Is there a helper for that?
    Phil Pirozhkov
    @pirj
    @marcandre I'm not sure if there's a guideline for that, but it seems that cops work as a team, i.e. one cop can do a dirty job inserting a line of code with an improper indentation, and others would further fix it.
    A well-known LineLength cop relies on a number of other cops to further format the code https://github.com/rubocop-hq/rubocop/blob/07c21d32408ecd5713578d50445387c89341815d/lib/rubocop/cop/layout/line_length.rb#L20
    I don't have a good understanding how rubocop --only <dirty-cop-that-relies-on-others-to-clean-it-all-up> is supposed to work though.
    Marc-André Lafortune
    @marcandre
    Sure, indentation isn't a strict requirement. The rest should be easy but taking care of comments and heredocs makes it non trivial; there probably should be a helper for that.
    In any case, I gave up doing the right thing, hacked something for my use and delegated 😆 rubocop-hq/rubocop#8724
    Alex Prokopev
    @Pr0p1k
    Hi, when Rubocop is used by another tool, it works fine for highlighting issues, but it doesn't provide info about autocorrectability, and if the tool wants to provide option to fix the offence on the highlighted area, it has to know whether the exact offence can be corrected (may depend on context) to avoid false-positives and so on. Do you have any plans or concerns regarding this? It may be just an option like --autocorrect-info to include it in JSON report
    Phil Pirozhkov
    @pirj
    @Pr0p1k You can set a different output format with rubocop --format json, and e.g. this JSON format gives you information if it's auto-correctable or not. Excerpt:
    {"path":"lib/rubocop/cop/rspec/describe_class.rb","offenses":[{"severity":"convention","message":"Extra blank line detected.","cop_name":"Layout/EmptyLines","corrected":false,"correctable":true,"location":{"start_line":51,"start_column":1,"last_line":52
    Alex Prokopev
    @Pr0p1k
    @pirj Thanks! I've it in sources right now, but there's no mention in the docs, probably should be updated.
    Phil Pirozhkov
    @pirj
    @Pr0p1k A pull request to mention this option in docs is welcome!
    Bozhidar Batsov
    @bbatsov
    It's nice to see this Gitter is still alive. I had completely forgotten about it. :D
    Bozhidar Batsov
    @bbatsov
    I don't know if @bbatsov is on gitter much...
    Not really. Too many chats for me. :D
    At some point it seemed to me that Gitter was declining as many projects moved their chats to other Platforms and I stopped using it.
    Marcos de Melo
    @marcosdemelo
    Hello, can anyone guide me if the --parallel parameter can be replaced by a .rubocop configuration?
    Phil Pirozhkov
    @pirj
    @marcosdemelo Not sure how this option can be added to .rubocop.yml, even though it's mentioned in the docs https://github.com/rubocop-hq/rubocop/blame/c1b7dce1fc7af1ad13ab1fa975b31312925f6109/docs/modules/ROOT/pages/usage/basic_usage.adoc#L259
    But you should definitely give RUBOCOP_OPTS a try.
    I would suggest loading RUBOCOP_OPTS with https://github.com/direnv/direnv, but it's only my personal preference.
    Marcos de Melo
    @marcosdemelo
    I also found no references in the documentation. Searching the code I also found little reference. It appears that this has not been documented or has been experimental. Anyway, I will continue using it even from the command line. Thank you for your attention @pirj.
    Lorenzo Gabriele
    @lolgab
    Hi everyone :)
    We at Codacy use rubocop ( it works very well, I have to say ).
    Now we're adding a feature to comment on PRs with the suggested changes by tools.
    I'm trying to integrate this with rubocop.. Is there a way to have the autocorrection for a cop inside the json report? The only way out I see is to run the autocorrect, generate a diff, and manually match the diff to the cops in the json report..
    Do think it's doable to add the modified line or the changes to the json report ?
    Phil Pirozhkov
    @pirj
    Hi @lolgab
    Does --format json work for you? There is a number of different formats you can try. Check rubocop --help for a complete list.
    Lorenzo Gabriele
    @lolgab
    @pirj Thanks, I already use the json format actually.. I was asking if there was a way to include the auto-correction text inside this json report ( or something to extract it )
    Lorenzo Gabriele
    @lolgab
    At the moment you can get the diff ( by running rubocop on stdin and diffing the result with the file) but you need to guess which cop generated which diff.. Having rubocop exporting it would allow know with 100% accuracy which cop does what it does.
    ShalokShalom
    @ShalokShalom
    is there a way to check for pure functions?