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

ControlStatementSpacing may be broken #168

Closed
akiomik opened this issue Jan 12, 2024 · 5 comments
Closed

ControlStatementSpacing may be broken #168

akiomik opened this issue Jan 12, 2024 · 5 comments
Labels

Comments

@akiomik
Copy link
Contributor

akiomik commented Jan 12, 2024

I got the following error in v0.25.0.

undefined method `[]' for nil:NilClass
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/linter/control_statement_spacing.rb:17:in `block in <class:ControlStatementSpacing>'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:24:in `call'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:24:in `block in traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:21:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:21:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:34:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:34:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:34:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:34:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:34:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:34:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:34:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:34:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:34:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:34:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:42:in `block in traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `each'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:41:in `traverse_children'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:34:in `traverse'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/sexp_visitor.rb:14:in `trigger_pattern_callbacks'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/linter.rb:33:in `run'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/runner.rb:64:in `block in collect_lints'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/runner.rb:63:in `map'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/runner.rb:63:in `collect_lints'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/runner.rb:23:in `block in run'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/runner.rb:22:in `map'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/runner.rb:22:in `run'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/cli.rb:91:in `scan_for_lints'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/cli.rb:60:in `act_on_options'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/lib/slim_lint/cli.rb:32:in `run'
/tmp/app/vendor/bundle/ruby/3.0.0/gems/slim_lint-0.25.0/bin/slim-lint:7:in `<top (required)>'
/tmp/app/vendor/bundle/ruby/3.0.0/bin/slim-lint:25:in `load'
/tmp/app/vendor/bundle/ruby/3.0.0/bin/slim-lint:25:in `<top (required)>'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/lib/bundler/cli.rb:479:in `exec'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/lib/bundler/cli.rb:31:in `dispatch'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/lib/bundler/cli.rb:25:in `start'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/exe/bundle:49:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/exe/bundle:37:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Report this bug at https://github.com/sds/slim-lint/issues

To help fix this issue, please include:
- The above stack trace
- Slim-Lint version: 0.25.0
- RuboCop version: 1.59.0
- Ruby version: 3.0.6

Exited with code exit status 70
@akiomik akiomik changed the title ControlSpacingStatement may be broken ControlStatementSpacing may be broken Jan 12, 2024
@sds
Copy link
Owner

sds commented Jan 15, 2024

Thanks for the report.

Can you confirm this doesn't happen in 0.24.0?

Can you provide a snippet of code that reproduces the issue?

@sds sds added the bug label Jan 15, 2024
@akiomik
Copy link
Contributor Author

akiomik commented Jan 15, 2024

Can you confirm this doesn't happen in 0.24.0?

We are currently using 0.24.0 and this does not happen.

Can you provide a snippet of code that reproduces the issue?

Sure! But it takes a little time to provide this.

@sds
Copy link
Owner

sds commented Jan 15, 2024

Heads up @rotelstift: looks like this was introduced by #164.

I will revert if you are not able to provide a fix. Thanks!

@akiomik
Copy link
Contributor Author

akiomik commented Jan 15, 2024

I've created a repository for reproduction.
https://github.com/akiomik/slim-lint-issue-168

The issue seems to happen when inlined = is used after a line that has been newlined with \, as in the following:

= link_to_if true, \
             'index'
span = '42'.to_i

sds added a commit that referenced this issue Jan 16, 2024
This reverts commit ff1ef25, since it
results in the issue described in
#168.
sds added a commit that referenced this issue Jan 16, 2024
…169)

This reverts commit ff1ef25, since it
results in the issue described in
#168.
@sds
Copy link
Owner

sds commented Jan 16, 2024

For now, I've reverted the PR that introduced and cut 0.26.0 as a new release.

Happy to re-merge the reverted PR once the issue discussed here has been addressed. In the meantime, I'm going to close this issue as technically resolved by virtue of reverting, but hopefully the original author will find some time to investigate and implement a fix. Thanks for reporting!

@sds sds closed this as completed Jan 16, 2024
MegaDev007 added a commit to MegaDev007/slim-lint that referenced this issue Aug 3, 2024
…(#169)

This reverts commit ff1ef25815b4094320b8fdb709429e9aa1fee6f9, since it
results in the issue described in
sds/slim-lint#168.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants