profile
viewpoint

Ask questionsFalse positive for Layout/ArgumentAlignment

The following code is in a .js.haml file in my Rails application and somehow, it's triggering an offense for the cop Layout/ArgumentAlignment:

https://github.com/openSUSE/open-build-service/blob/94660dfcced5541ece9ed3c964c779896ad051b6/src/api/app/views/webui/interconnects/create.js.haml#L5

I kept the exact same indentation as in my file. This is what RuboCop outputs:

Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line.

After trying out various indentation changes, I just don't get it. Someone has a clue?

RuboCop version

1.16.1 (using Parser 3.0.1.1, rubocop-ast 1.7.0, running on ruby 2.5.8 x86_64-linux-gnu)
  - rubocop-performance 1.10.2
  - rubocop-rails 2.10.1
  - rubocop-rspec 2.2.0

RuboCop is called from haml-lint, this is why it's linting a .js.haml file.

rubocop/rubocop

Answer questions koic

Layout/ArgumentAlignment cop now supports first keyword arguments and HAML-Lint will need to support it. https://github.com/rubocop/rubocop/pull/9798

I'm not familiar with HAML-Lint, but at least it's passed to RuboCop with the following alignment, so this is not a false positive.

openSUSE/open-build-service code

$('.in-place-editing').html("#{escape_javascript(render(partial: 'webui/package/basic_info',
                                                        locals: { package: @package, project: @project }))}");

The result of some processing of haml-lint

render(partial: 'webui/package/basic_info',
                                                            locals: { package: @package, project: @project })

Can you open the issue to HAML-Lint? https://github.com/sds/haml-lint

Thank you.

useful!
source:https://uonfu.com/
answerer
Koichi ITO koic ESM, Inc. (@esminc) Tokyo, Japan http://koic.github.io @rubocop core team.
Github User Rank List