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

Better handle reporting locations of Sass syntax errors #1133

Merged
merged 1 commit into from Dec 6, 2017

Conversation

Projects
None yet
2 participants
@abrom
Contributor

abrom commented Dec 5, 2017

Test case is a HAML file with some invalid SASS like:

:sass
  .foo
    2px

Somewhat unintelligible result is:

+Errors+

+----------------------------------------------------+------------------+
| Error                                              | Location         |
+----------------------------------------------------+------------------+
| Invalid CSS after "": expected selector, was "2px" | (__TEMPLATE__):2 |
+----------------------------------------------------+------------------+

With this change we get:

+Errors+

+----------------------------------------------------+-----------------------------------------------------------+
| Error                                              | Location                                                  |
+----------------------------------------------------+-----------------------------------------------------------+
| Invalid CSS after "": expected selector, was "2px" | While processing /test-project/app/views/tests/index.haml |
+----------------------------------------------------+-----------------------------------------------------------+

Not perfect, but it at least gives you some idea of where the problem is (without having to turn on the full debug output)

I couldn't find any tests for the template parser. If there are some, I'd be happy to add to them

@presidentbeef

This comment has been minimized.

Show comment
Hide comment
@presidentbeef

presidentbeef Dec 6, 2017

Owner

Cool! Can you capitalize the w? :)

Owner

presidentbeef commented Dec 6, 2017

Cool! Can you capitalize the w? :)

@@ -39,6 +39,8 @@ def parse_template path, text
tracker.error e, "could not parse #{path}"

This comment has been minimized.

@abrom

abrom Dec 6, 2017

Contributor

Should the same apply here?? ie Could not parse... ??

@abrom

abrom Dec 6, 2017

Contributor

Should the same apply here?? ie Could not parse... ??

This comment has been minimized.

@presidentbeef

presidentbeef Dec 6, 2017

Owner

Yes, got it in #1137

@presidentbeef

presidentbeef Dec 6, 2017

Owner

Yes, got it in #1137

@abrom

This comment has been minimized.

Show comment
Hide comment
@abrom

abrom Dec 6, 2017

Contributor

Done

Contributor

abrom commented Dec 6, 2017

Done

@presidentbeef presidentbeef merged commit 9739743 into presidentbeef:master Dec 6, 2017

4 of 5 checks passed

codeclimate/diff-coverage 0% (80% threshold)
Details
ci/circleci Your tests passed on CircleCI!
Details
codeclimate All good!
Details
codeclimate/total-coverage 94% (0.0% change)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@abrom abrom deleted the abrom:handle-sass-syntax-errors branch Dec 7, 2017

Repository owner locked and limited conversation to collaborators Feb 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.