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

Exception in plugin: XmlPullParserException: only whitespace content allowed before start tag and not O #16

Open
thomasbertet opened this issue Apr 10, 2017 · 4 comments

Comments

@thomasbertet
Copy link

thomasbertet commented Apr 10, 2017

Hi there,

First, thank for this plugin, really helpful.

I would like to report an issue: XmlPullParserException: only whitespace content allowed before start tag and not O ...

At first, I thought maybe my yaml file was invalid, but checked it with YAMLLint and it said it's valid.

Versions & OS

Sass-lint-plugin: 1.10.2
IntelliJ IDEA 2017.1 Build #IU-171.3780.107, built on March 22, 2017
JRE: 1.8.0_112-release-736-b13 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.8.0-46-generic

Context

sass-lint config:

  • Checked the Use specific config file , and verified the sass-lint.yml with YAMLLint, it's valid.
  • Filled the Path to sass-lint bin & Node interpreter

I just open any scss file, and when it starts analyzing the file, Intellij pops a notification saying an error occured with sass-lint-plugin.

Stacktrace

Here is the complete stacktrace if it can help =)

 : only whitespace content allowed before start tag and not O (position: START_DOCUMENT seen O... @1:1) 
com.thoughtworks.xstream.io.StreamException:  : only whitespace content allowed before start tag and not O (position: START_DOCUMENT seen O... @1:1) 
	at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
	at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
	at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1040)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1031)
	at com.sasslint.cli.SassLint.read(SassLint.java:25)
	at com.sasslint.cli.SassLintRunner.lint(SassLintRunner.java:61)
	at com.sasslint.cli.SassLintRunner.lint(SassLintRunner.java:47)
	at com.sasslint.inspection.SassLintExternalAnnotator.doAnnotate(SassLintExternalAnnotator.java:207)
	at com.sasslint.inspection.SassLintExternalAnnotator.doAnnotate(SassLintExternalAnnotator.java:48)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.b(ExternalToolPass.java:224)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$500(ExternalToolPass.java:48)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:172)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
	at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:277)
	at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:291)
	at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:246)
	at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:223)
	at com.intellij.util.Alarm$Request.runSafely(Alarm.java:418)
	at com.intellij.util.Alarm$Request.access$700(Alarm.java:343)
	at com.intellij.util.Alarm$Request$1.run(Alarm.java:385)
	at com.intellij.util.Alarm$Request.run(Alarm.java:396)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:237)
	at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:212)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not O (position: START_DOCUMENT seen O... @1:1) 
	at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1519)
	at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
	at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
	at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
	... 33 more


com.thoughtworks.xstream.io.StreamException:  : only whitespace content allowed before start tag and not O (position: START_DOCUMENT seen O... @1:1) 
	at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
	at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
	at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1040)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1031)
	at com.sasslint.cli.SassLint.read(SassLint.java:25)
	at com.sasslint.cli.SassLintRunner.lint(SassLintRunner.java:61)
	at com.sasslint.cli.SassLintRunner.lint(SassLintRunner.java:47)
	at com.sasslint.inspection.SassLintExternalAnnotator.doAnnotate(SassLintExternalAnnotator.java:207)
	at com.sasslint.inspection.SassLintExternalAnnotator.doAnnotate(SassLintExternalAnnotator.java:48)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.b(ExternalToolPass.java:224)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$500(ExternalToolPass.java:48)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:172)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
	at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:277)
	at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:291)
	at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:246)
	at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:223)
	at com.intellij.util.Alarm$Request.runSafely(Alarm.java:418)
	at com.intellij.util.Alarm$Request.access$700(Alarm.java:343)
	at com.intellij.util.Alarm$Request$1.run(Alarm.java:385)
	at com.intellij.util.Alarm$Request.run(Alarm.java:396)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:237)
	at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:212)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not O (position: START_DOCUMENT seen O... @1:1) 
	at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1519)
	at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
	at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
	at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
	... 33 more

Sample SCSS file & YAML config

SCSS file throwing the error (but it occurs on every filed I opened)


@import 'mixins/label';

.label {
    display: inline-block;
	font-size: $font-size-base;
	padding: $padding-base-vertical/2 $padding-base-horizontal;

	+ .label {
		margin-left: $padding-base-vertical/2;
	}
}

.label-default {
  @include label-variant($label-default-bg);
}

.label-primary {
  @include label-variant($label-primary-bg);
}

.label-success {
  @include label-variant($label-success-bg);
}

.label-info {
  @include label-variant($label-info-bg);
}

.label-warning {
  @include label-variant($label-warning-bg);
}

.label-danger {
  @include label-variant($label-danger-bg);
}

.mui-label-remove {
	padding-left: $padding-base-horizontal;

	cursor: pointer;
}

Yaml config I pointed to in sass-lint-plugin config in Intellij:

#########################
## Sample Sass Lint File
#########################
# Linter Options
options:
  # Don't merge default rules
  merge-default-rules: false
  # Set the formatter to 'html'
  formatter: html
  # Output file instead of logging results
  output-file: 'linters/sass-lint.html'
  # Raise an error if more than 50 warnings are generated
  max-warnings: 50
# File Options
files:
  include: 'lib/**/*.s+(a|c)ss'
  ignore:
    - 'sass/vendor/**/*.*'
# Rule Configuration
rules:
  extends-before-mixins: 2
  extends-before-declarations: 2
  placeholder-in-extend: 2
  mixins-before-declarations:
    - 2
    -
      exclude:
        - breakpoint
        - mq
  no-warn: 1
  no-debug: 1
  no-ids: 2
  no-important: 2
  hex-notation:
    - 2
    -
      style: uppercase
  indentation:
    - 1
    -
      size: 4
  property-sort-order:
    - 1
    -
      order:
        - display
        - margin
      ignore-custom-properties: true
  variable-for-property:
    - 2
    -
      properties:
        - margin
        - content

Any clue ? =)

Thanks in advance, and again, great work !

@thomashermant
Copy link

thomashermant commented Jul 7, 2017

Hello,

First thank you for this great plugin ;-)
I've got the exact same problem here.

Any clue ?

OS X 10.12.5
PhpStorm 2017.1.4
sass-lint 1.10.2
node 6.10.2


: only whitespace content allowed before start tag and not O (position: START_DOCUMENT seen O... @1:1) 
com.thoughtworks.xstream.io.StreamException:  : only whitespace content allowed before start tag and not O (position: START_DOCUMENT seen O... @1:1) 
	at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
	at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
	at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
	at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1040)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1031)
	at com.sasslint.cli.SassLint.read(SassLint.java:25)
	at com.sasslint.cli.SassLintRunner.lint(SassLintRunner.java:61)
	at com.sasslint.cli.SassLintRunner.lint(SassLintRunner.java:47)
	at com.sasslint.inspection.SassLintExternalAnnotator.doAnnotate(SassLintExternalAnnotator.java:207)
	at com.sasslint.inspection.SassLintExternalAnnotator.doAnnotate(SassLintExternalAnnotator.java:48)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.c(ExternalToolPass.java:224)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$500(ExternalToolPass.java:48)
	at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:172)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
	at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
	at com.intellij.util.ui.update.MergingUpdateQueue.lambda$flush$1(MergingUpdateQueue.java:277)
	at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:291)
	at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:246)
	at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:223)
	at com.intellij.util.Alarm$Request.runSafely(Alarm.java:418)
	at com.intellij.util.Alarm$Request.access$700(Alarm.java:343)
	at com.intellij.util.Alarm$Request$1.run(Alarm.java:385)
	at com.intellij.util.Alarm$Request.run(Alarm.java:396)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:237)
	at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:212)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not O (position: START_DOCUMENT seen O... @1:1) 
	at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1519)
	at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
	at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
	at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
	... 33 more

@alansmithnbs
Copy link

alansmithnbs commented Aug 31, 2017

Seeing this on Windows and macOS in PyCharm. Node 8.1.3 and sass-lint 1.11.1.

Update: I was able to resolve the problem by using a different .sass-lint.yml. The following .yml file worked:

options:
  formatter: stylish
files:
  include: './src/**/*.s+(a|c)ss'
rules:
  # Extends
  extends-before-mixins: 1
  extends-before-declarations: 1
  placeholder-in-extend: 1

  # Mixins
  mixins-before-declarations: 1

  # Line Spacing
  one-declaration-per-line: 1
  empty-line-between-blocks: 1
  single-line-per-selector: 1

  # Disallows
  no-attribute-selectors: 0
  no-color-hex: 0
  no-color-keywords: 1
  no-color-literals: 1
  no-combinators: 0
  no-css-comments: 1
  no-debug: 1
  no-disallowed-properties: 0
  no-duplicate-properties: 1
  no-empty-rulesets: 1
  no-extends: 0
  no-ids: 1
  no-important: 1
  no-invalid-hex: 1
  no-mergeable-selectors: 1
  no-misspelled-properties: 1
  no-qualifying-elements: 1
  no-trailing-whitespace: 1
  no-trailing-zero: 1
  no-transition-all: 1
  no-universal-selectors: 0
  no-url-domains: 1
  no-url-protocols: 1
  no-vendor-prefixes: 1
  no-warn: 1
  property-units: 0

  # Nesting
  declarations-before-nesting: 1
  force-attribute-nesting: 1
  force-element-nesting: 1
  force-pseudo-nesting: 1

  # Name Formats
  class-name-format: 1
  function-name-format: 1
  id-name-format: 0
  mixin-name-format: 1
  placeholder-name-format: 1
  variable-name-format: 1

  # Style Guide
  attribute-quotes: 1
  bem-depth: 0
  border-zero: 1
  brace-style: 1
  clean-import-paths: 1
  empty-args: 1
  hex-length: 1
  hex-notation: 1
  indentation: 1
  leading-zero: 1
  max-line-length: 0
  max-file-line-count: 0
  nesting-depth: 1
  property-sort-order: 1
  pseudo-element: 1
  quotes: 1
  shorthand-values: 1
  url-quotes: 1
  variable-for-property: 1
  zero-unit: 1

  # Inner Spacing
  space-after-comma: 1
  space-before-colon: 1
  space-after-colon: 1
  space-before-brace: 1
  space-before-bang: 1
  space-after-bang: 1
  space-between-parens: 1
  space-around-operator: 1

  # Final Items
  trailing-semicolon: 1
  final-newline: 1

@uncleSoWise
Copy link

This appears to be a bug surrounding the option formatter when set to html. Removing output-file and setting formatter to stylish seem to make WebStorm lint styles properly.

@Dirk-LG
Copy link

Dirk-LG commented Oct 24, 2020

I had the same problem in AndroidStudio when I delibrately downgraded "compileSdkVersion" and "targetSdkVersion" in file build.gradle.
It cannot be fixed with "Clean Project". To fix I removed all, took an initial version of the project, applied my few desired changes, and now it works again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants