Skip to content
This repository has been archived by the owner on Dec 8, 2017. It is now read-only.

ComposerLintReview Error #57

Closed
jyggen opened this issue Dec 15, 2015 · 6 comments
Closed

ComposerLintReview Error #57

jyggen opened this issue Dec 15, 2015 · 6 comments

Comments

@jyggen
Copy link

jyggen commented Dec 15, 2015

When I try to commit changes to a composer.json ComposerLintReview more often that not gives me the following error:

ComposerLintReview Error: The composer configuration is not valid in composer.json

If I manually run composer diagnose against the file it'll give me the following output (with exit code 0):

./composer.json is valid

Digging into the ComposerLintReview class and logging the output of the child process (if $process->isSuccessful() is false) gives me the following:

/var/folders/1_/j6pgbhz546g4t92sckw7215c0000gn/T/sjparkinson.static-review/cached/composer.json is valid

Digging deeper by manually running composer validate against the cache file above, I receive the following:

/var/folders/1_/j6pgbhz546g4t92sckw7215c0000gn/T/sjparkinson.static-review/cached/composer.json is valid
The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.

Not sure what's going here, but Composer is seemingly not a big fan of the static-review's cached composer file.

Any ideas?

Thanks!

@shadowhand
Copy link
Contributor

static-review doesn't include composer.lock in the repository, so this should be solved by running composer update on your local machine. If that doesn't work, try rm -rf vendor/sjparkinson/static-review followed by composer install.

@jyggen
Copy link
Author

jyggen commented Dec 15, 2015

The composer.json file is not part of static-review in any way. Our project uses static-review as a git hook, and one of the reviews is ComposerLintReview which fails when we try to commit changes to our composer.json.

@shadowhand
Copy link
Contributor

Well then it looks like you tried to commit composer.json without composer.lock being in sync.

@sjparkinson
Copy link
Owner

Our project uses static-review as a git hook, and one of the reviews is ComposerLintReview which fails when we try to commit changes to our composer.json.

So static review creates a temporary version of the staged file that you want to commit and reviews that.

Have a go running git show :composer.json and ensure that the output is a valid file. Feel free to include it here.

@jyggen
Copy link
Author

jyggen commented Dec 15, 2015

I figured it out.

The cached composer.json file static-review uses checks if it's out-of-sync against any cached composer.lock, meaning that if I only commit the composer.json file it'll check out-of-sync against an old composer.lock (as long as there is one in the cache).

In my case we once upon a time had composer.lock in the repo but later decided to remove it (due to the repo being a library). But I still have an old copy of it in static-review's cache, so every time I try to commit changes to composer.json it'll complain.

I removed the cached composer.lock and now I can successfully commit composer.json. Woo!

@sjparkinson
Copy link
Owner

In my case we once upon a time had composer.lock in the repo but later decided to remove it (due to the repo being a library). But I still have an old copy of it in static-review's cache, so every time I try to commit changes to composer.json it'll complain.

Ah yes, I haven't done much work on cleaning up the temporary files, nice work figuring it out! I'll open a new issue to look at cleaning up the temporary files that the git version control class creates.

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

No branches or pull requests

3 participants