Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Error when running auto-correct #439

Closed
hugoburguete opened this issue Sep 9, 2021 · 1 comment · Fixed by #442
Closed

Error when running auto-correct #439

hugoburguete opened this issue Sep 9, 2021 · 1 comment · Fixed by #442
Assignees
Labels
bug Something isn't working p:high Priority (or Impact): High

Comments

@hugoburguete
Copy link

As the title states, I'm getting an error when running the auto-correct flag. The command run was shopify theme check -a
and the error details are:

/usr/local/Cellar/shopify-cli/2.3.0/gems/theme-check-1.4.0/lib/theme_check/node.rb:124:in `range': undefined method `+' for nil:NilClass (NoMethodError)
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/theme-check-1.4.0/lib/theme_check/corrector.rb:21:in `replace'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/theme-check-1.4.0/lib/theme_check/checks/convert_include_to_render.rb:11:in `block in on_include'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/theme-check-1.4.0/lib/theme_check/offense.rb:145:in `correct'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/theme-check-1.4.0/lib/theme_check/analyzer.rb:88:in `each'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/theme-check-1.4.0/lib/theme_check/analyzer.rb:88:in `correct_offenses'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/theme-check-1.4.0/lib/theme_check/cli.rb:184:in `check'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/theme-check-1.4.0/lib/theme_check/cli.rb:114:in `run!'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/theme-check-1.4.0/lib/theme_check/cli.rb:118:in `run'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/lib/project_types/theme/commands/check.rb:25:in `call'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/lib/shopify-cli/sub_command.rb:13:in `call'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/lib/shopify-cli/command.rb:19:in `call'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:16:in `block (2 levels) in call'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:37:in `block (2 levels) in with_logging'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb:169:in `with_id'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:36:in `block in with_logging'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-ui/lib/cli/ui.rb:176:in `log_output_to'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:35:in `with_logging'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:15:in `block in call'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:45:in `block (2 levels) in with_traps'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:55:in `twrap'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:44:in `block in with_traps'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:55:in `twrap'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:43:in `with_traps'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:14:in `call'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/lib/shopify-cli/core/executor.rb:15:in `call'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/lib/shopify-cli/core/entry_point.rb:24:in `block in call'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/lib/shopify-cli/core/monorail.rb:20:in `log'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/lib/shopify-cli/core/entry_point.rb:23:in `call'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/bin/shopify:33:in `block in <top (required)>'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:75:in `handle_abort'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:21:in `call'
        from /usr/local/Cellar/shopify-cli/2.3.0/gems/shopify-cli-2.3.0/bin/shopify:32:in `<top (required)>'
        from /usr/local/bin/shopify:6:in `load'
        from /usr/local/bin/shopify:6:in `<main>'

Any ideas? Happy to give more details if required.

Thanks

@charlespwd charlespwd added bug Something isn't working p:high Priority (or Impact): High labels Sep 9, 2021
@charlespwd charlespwd self-assigned this Sep 9, 2021
@charlespwd
Copy link
Contributor

I think I do. I noticed a flaw in our Node.range function when fixing #423. Seems like it didn't take long for the flaw to appear in the wild.

Thanks for flagging! I'm jumping on this.

charlespwd added a commit that referenced this issue Sep 9, 2021
Fixes #439

Fixes major flaws of corrector:

1. insert_before/insert_after/replace/wrap could all mess with the indexes when applied multiple times.
2. the template.excerpt logic in Corrector didn't work well when you had multiline tags
3. template.exceprt and template.source_exceprt were confusing.

Along with minor flaws in Template:

1. The mutable @lines thing was confusing
2. The difference between excerpt and source_excerpt was confusing =>
   (excerpt was only used in tests, not the other. So I removed excerpt in favour of the other. If we really want one we can always template.write to commit the changes.)

Introduces Parser::Source::TreeRewriter to handle the correct rewrite of the files for us. This is what RuboCop uses under the hood so why not do the same, eh?
charlespwd added a commit that referenced this issue Sep 9, 2021
Fixes #439

Fixes major flaws of corrector:

1. insert_before/insert_after/replace/wrap could all mess with the indexes when applied multiple times.
2. the template.excerpt logic in Corrector didn't work well when you had multiline tags
3. template.exceprt and template.source_exceprt were confusing.

Along with minor flaws in Template:

1. The mutable @lines thing was confusing
2. The difference between excerpt and source_excerpt was confusing =>
   (excerpt was only used in tests, not the other. So I removed excerpt in favour of the other. If we really want one we can always template.write to commit the changes.)

Introduces Parser::Source::TreeRewriter to handle the correct rewrite of the files for us. This is what RuboCop uses under the hood so why not do the same, eh?
charlespwd added a commit that referenced this issue Sep 9, 2021
Fixes #439

Fixes major flaws of corrector:

1. insert_before/insert_after/replace/wrap could all mess with the indexes when applied multiple times.
2. the template.excerpt logic in Corrector didn't work well when you had multiline tags
3. template.exceprt and template.source_exceprt were confusing.

Along with minor flaws in Template:

1. The mutable @lines thing was confusing
2. The difference between excerpt and source_excerpt was confusing =>
   (excerpt was only used in tests, not the other. So I removed excerpt in favour of the other. If we really want one we can always template.write to commit the changes.)

Introduces Parser::Source::TreeRewriter to handle the correct rewrite of the files for us. This is what RuboCop uses under the hood so why not do the same, eh?
charlespwd added a commit that referenced this issue Sep 9, 2021
Fixes #439

Fixes major flaws of corrector:

1. insert_before/insert_after/replace/wrap could all mess with the indexes when applied multiple times.
2. the template.excerpt logic in Corrector didn't work well when you had multiline tags
3. template.exceprt and template.source_exceprt were confusing.

Along with minor flaws in Template:

1. The mutable @lines thing was confusing
2. The difference between excerpt and source_excerpt was confusing =>
   (excerpt was only used in tests, not the other. So I removed excerpt in favour of the other. If we really want one we can always template.write to commit the changes.)

Introduces Parser::Source::TreeRewriter to handle the correct rewrite of the files for us. This is what RuboCop uses under the hood so why not do the same, eh?
charlespwd added a commit that referenced this issue Sep 10, 2021
Fixes #439

Fixes major flaws of corrector:

1. insert_before/insert_after/replace/wrap could all mess with the indexes when applied multiple times.
2. the template.excerpt logic in Corrector didn't work well when you had multiline tags
3. template.exceprt and template.source_exceprt were confusing.

Along with minor flaws in Template:

1. The mutable @lines thing was confusing
2. The difference between excerpt and source_excerpt was confusing =>
   (excerpt was only used in tests, not the other. So I removed excerpt in favour of the other. If we really want one we can always template.write to commit the changes.)

Introduces Parser::Source::TreeRewriter to handle the correct rewrite of the files for us. This is what RuboCop uses under the hood so why not do the same, eh?
charlespwd added a commit that referenced this issue Sep 10, 2021
Fixes #439

Fixes major flaws of corrector:

1. insert_before/insert_after/replace/wrap could all mess with the indexes when applied multiple times.
2. the template.excerpt logic in Corrector didn't work well when you had multiline tags
3. template.exceprt and template.source_exceprt were confusing.

Along with minor flaws in Template:

1. The mutable @lines thing was confusing
2. The difference between excerpt and source_excerpt was confusing =>
   (excerpt was only used in tests, not the other. So I removed excerpt in favour of the other. If we really want one we can always template.write to commit the changes.)

Introduces Parser::Source::TreeRewriter to handle the correct rewrite of the files for us. This is what RuboCop uses under the hood so why not do the same, eh?
charlespwd added a commit that referenced this issue Sep 13, 2021
Fixes #439

Fixes major flaws of corrector:

1. insert_before/insert_after/replace/wrap could all mess with the indexes when applied multiple times.
2. the template.excerpt logic in Corrector didn't work well when you had multiline tags
3. template.exceprt and template.source_exceprt were confusing.

Along with minor flaws in Template:

1. The mutable @lines thing was confusing
2. The difference between excerpt and source_excerpt was confusing =>
   (excerpt was only used in tests, not the other. So I removed excerpt in favour of the other. If we really want one we can always template.write to commit the changes.)

Introduces Parser::Source::TreeRewriter to handle the correct rewrite of the files for us. This is what RuboCop uses under the hood so why not do the same, eh?
charlespwd added a commit that referenced this issue Sep 14, 2021
Fixes #439

Fixes major flaws of corrector:

1. insert_before/insert_after/replace/wrap could all mess with the indexes when applied multiple times.
2. the template.excerpt logic in Corrector didn't work well when you had multiline tags
3. template.exceprt and template.source_exceprt were confusing.

Along with minor flaws in Template:

1. The mutable @lines thing was confusing
2. The difference between excerpt and source_excerpt was confusing =>
   (excerpt was only used in tests, not the other. So I removed excerpt in favour of the other. If we really want one we can always template.write to commit the changes.)

Introduces Parser::Source::TreeRewriter to handle the correct rewrite of the files for us. This is what RuboCop uses under the hood so why not do the same, eh?
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working p:high Priority (or Impact): High
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants