gilbarbara / codeclimate-stylelint

A Code Climate engine for the mighty, modern CSS linter
24 stars 18 forks source link

Error: parser.parse is not a function #33

Closed ogonkov closed 3 years ago

ogonkov commented 5 years ago

.codeclimate.yml

version: "2"
plugins:
  eslint:
    enabled: true
    channel: "eslint-5"

  stylelint:
    enabled: true

.stylelintrc

{
    "extends": "stylelint-config-recommended"
}

Couldn't get engine to work, it just throws error, that is not much helpful:

Status: Downloaded newer image for codeclimate/codeclimate:0.72.0
WARNING: A new version (v0.85.4) is available. Upgrade instructions are available at: https://github.com/codeclimate/codeclimate#packages
error: (CC::CLI::Analyze::EngineFailure) engine stylelint failed with status 1 and stderr 
Unable to find image 'codeclimate/codeclimate-stylelint:latest' locally
latest: Pulling from codeclimate/codeclimate-stylelint
407ea412d82c: Pulling fs layer
e73932c6d883: Pulling fs layer
a080831c74c7: Pulling fs layer
a9cdd9457a1a: Pulling fs layer
8369b91303e6: Pulling fs layer
0ab03e49ec8e: Pulling fs layer
5477248cf32d: Pulling fs layer
f49319b22d26: Pulling fs layer
00425c54b7e0: Pulling fs layer
4b21b6dd78e3: Pulling fs layer
8369b91303e6: Waiting
0ab03e49ec8e: Waiting
5477248cf32d: Waiting
f49319b22d26: Waiting
00425c54b7e0: Waiting
4b21b6dd78e3: Waiting
a9cdd9457a1a: Waiting
a080831c74c7: Verifying Checksum
a080831c74c7: Download complete
407ea412d82c: Verifying Checksum
407ea412d82c: Download complete
407ea412d82c: Pull complete
a9cdd9457a1a: Verifying Checksum
a9cdd9457a1a: Download complete
8369b91303e6: Verifying Checksum
8369b91303e6: Download complete
e73932c6d883: Verifying Checksum
e73932c6d883: Download complete
5477248cf32d: Verifying Checksum
5477248cf32d: Download complete
f49319b22d26: Verifying Checksum
f49319b22d26: Download complete
4b21b6dd78e3: Verifying Checksum
4b21b6dd78e3: Download complete
0ab03e49ec8e: Verifying Checksum
0ab03e49ec8e: Download complete
00425c54b7e0: Verifying Checksum
00425c54b7e0: Download complete
e73932c6d883: Pull complete
a080831c74c7: Pull complete
a9cdd9457a1a: Pull complete
8369b91303e6: Pull complete
0ab03e49ec8e: Pull complete
5477248cf32d: Pull complete
f49319b22d26: Pull complete
00425c54b7e0: Pull complete
4b21b6dd78e3: Pull complete
Digest: sha256:9ebcd4721a15d611cd5a6cc5e037c2311a96ac80e81cd8853533b13b36a59202
Status: Downloaded newer image for codeclimate/codeclimate-stylelint:latest
•• Timing: .engineConfig: 0.518s
Error: parser.parse is not a function
See our documentation at https://docs.codeclimate.com/docs/stylelint for more information.
Could not analyze code quality for the repository at /code
Uploading artifacts...
WARNING: gl-code-quality-report.json: no matching files 
ERROR: No files to upload                          
ERROR: Job failed: exit code 1

CodeClimate runs from default GitLab Community Edition 11.11.2 code_quality template.

gilbarbara commented 5 years ago

There's no parser.parse in this package source code, so it's probably an issue with codeclimate's cli. Make sure to upgrade the CLI to the latest version since 0.72 is really old.

leonelgalan commented 5 years ago

I'm getting the same issue when running the engine on CodeClimate and not through the CLI. It started today. I contacted CodeClimate support and will update if I get a workaround or explanation that might benefit other users.

Unfortunately, error on CodeClimate's build is less helpful:

•• Timing: .engineConfig: 0.341s
Error: parser.parse is not a function
See our documentation at https://docs.codeclimate.com/docs/stylelint for more information.
ogonkov commented 5 years ago

I fixed my issue by replacing Gitlab template with job it actually provides (from master).

But then I replace it with simple bash script that run only on changed files, while CC runs on whole project and took 15 minutes instead of few seconds. Inline lint report is missing, but I plan to write custom formatter.

gilbarbara commented 5 years ago

@davehenton Let's continue the discussion here since that PR is already merged and is not related to the problem.

What does parser.parse do? I added new entries to the rules.json but it's a valid JSON

maxjacobson commented 5 years ago

:wave:

Hm.

Based on the output we're seeing, this parser.parse error is occuring within the stylelint engine. Possibly within one of the dependencies. Does someone have an open source repo that reproduces the issue?

leonelgalan commented 5 years ago

My CodeClimate builds starting passing 21 hours ago, and they pass for all open source builds I try now. CodeClimate support haven't responded yet, but they must have changed something on their end.

gilbarbara commented 5 years ago

@leonelgalan They reverted the last update.

gilbarbara commented 5 years ago

@maxjacobson Yes, it is happening with this engine. What does parser.parse do?

maxjacobson commented 5 years ago

@leonelgalan Hi there, I'm with Code Climate. Could you point me to an open source repo which was exhibiting this bug? That would help get to the bottom of it, which will allow us to move forward again.

@gilbarbara Just to be clear, what I mean is that this parser.parse error seems to be emanating from this engine, most likely from one of its dependencies. Unfortunately there's no stack trace printed so it's not clear where exactly it's coming from. I'm happy to help debug it if we have a public repo to reproduce it against.

leonelgalan commented 5 years ago

@maxjacobson, it wasn't an open source project. As soon as I started setting one (today) I couldn't get it to fail. I contacted support and checked the option to give you access to my code if needed. So please feel free to do so.

gilbarbara commented 3 years ago

I have no idea how to fix this since this only happens in codeclimate.com. The CLI works fine.

Anyway, I've released a new version: 2.3.0 (engine 13.7.2)

silverbucket commented 3 years ago

@maxjacobson I just ran into this issue (Parsing error: parser.parse is not a function) with a very simple PR. You asked for an example of an open source repo which is exhibiting this bug. https://github.com/sockethub/sockethub/pull/325 -- Let me know if there's somewhere I could file a proper issue for this.

maxjacobson commented 3 years ago

Hi @silverbucket -- I actually don't work at Code Climate anymore. Let me tag in @efueger to take a look. Best of luck!

silverbucket commented 3 years ago

Created an issue here (in case anyone comes along this thread) https://github.com/codeclimate/codeclimate-eslint/issues/512

gilbarbara commented 3 years ago

This is off-topic for this repo, locking.