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

Can't disable cache in file #163

Closed
vlakarados opened this issue Dec 11, 2022 · 14 comments
Closed

Can't disable cache in file #163

vlakarados opened this issue Dec 11, 2022 · 14 comments
Assignees
Labels

Comments

@vlakarados
Copy link

Cache can't be disabled in the file because of usage of $input->getOption('no-cache') instead of merged $options['no-cache'] in LintCommand::execute()

@llaville
Copy link
Collaborator

Hello @vlakarados

Can you precise which version you used (native php installed by composer OR docker or PHAR) and version number ?

I cannot reproduce your issue

@vlakarados
Copy link
Author

Hi @llaville,
I use composer version, here's entry from .lock file:

"name": "overtrue/phplint",
"version": "5.3.0",

@llaville
Copy link
Collaborator

llaville commented Dec 18, 2022

If source code you check is open-source, could you provide a link to repository.
If you can also provide a version of your .phplint-cache file

Don't forget also to provide contents of your .phplint.yml config file

@vlakarados
Copy link
Author

Just did this with fresh installation, PHP 8.1 on Ubuntu, here's history output:

3905  composer init
 3908  composer require overtrue/phplint
 3909  cp ../../projects/phpchecks/config/lint.yml .
 3911  cat lint.yml
 3915  ./vendor/bin/phplint -c lint.yml -vvv .
 3917  ./vendor/bin/phplint -c lint.yml -vvv .
 3920  history | tail -n10

$ cat lint.yml

path: ./target
jobs: 10
extensions:
  - php
exclude:
  - vendor/phpoffice
warning: true
memory_limit: -1
cache: No

First run:

...
Time: < 1 sec   Memory: 4.0 MiB Cache: No
OK! (Files: 231, Success: 231)
 

Second run:


$ ./vendor/bin/phplint -c lint.yml -vvv .
phplint 5.3 by overtrue and contributors.

Loaded config from "lint.yml"

Options: {"jobs":10,"path":["."],"exclude":["vendor\/phpoffice"],"extensions":["php"],"warning":true,"memory_limit":-1,"cache":"No","configuration":"lint.yml","verbose":true}
Time: < 1 sec   Memory: 4.0 MiB Cache: Yes
OK! (Files: 231, Success: 231)

@llaville
Copy link
Collaborator

Ok I see the problem now !
Thanks to provide all these informations.

@llaville llaville added the bug label Dec 18, 2022
@llaville llaville self-assigned this Dec 18, 2022
@llaville
Copy link
Collaborator

@overtrue As it seems confusion between options is possible, I've re-structured code to add a new component named ConfigResolver. It's goal is to validate all options (either from command line or from a config file).

I'll propose in next minutes a PR to solve this issue for branch 8.0 (and if you're agree, I'll apply it to other branches)

@overtrue
Copy link
Owner

Just do it! I trust you 👍

@llaville
Copy link
Collaborator

I'll also renamed memory_limit option to memory-limit to always use the same syntax (dash as word separator, rather than underscore)

And If we forgot something, the symfony/options-resolver will help us :)

For example:

  [Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException]
  The option "memory-limit" does not exist. Defined options are: "cache", "configuration", "exclude", "extensions", "jobs", "no-cache", "path", "warning"
  .

@llaville
Copy link
Collaborator

Code is available on branch fix-163 : help to check if I've missed something or introduced new regression is welcome ! @overtrue and @vlakarados

To avoid confusion :

  • cache in YAML config file identify the file to save cache results
  • no-cache in YAML config file tell if you want to always bypass cache file as console --no-cache option.

@llaville
Copy link
Collaborator

llaville commented Dec 21, 2022

Already found some regressions about format (json | xml) I'm on it !

PS: fixed by commit 4966bbb

@llaville
Copy link
Collaborator

All regressions seems to be fixed now. @vlakarados if it's ok for you, we may think to push new releases tomorrow.

@vlakarados
Copy link
Author

All good, it's no rush for me!

llaville added a commit that referenced this issue Dec 22, 2022
* introduces a new component Configuration/ConfigResolver to solve issue #163

* fix for issue #167
@llaville
Copy link
Collaborator

FYI: Branch 8.0 for umpcoming version 4.4 is now stable.
I'll apply same fixes on other branches, and push new releases.

llaville added a commit that referenced this issue Dec 22, 2022
llaville added a commit that referenced this issue Dec 22, 2022
llaville added a commit that referenced this issue Dec 22, 2022
@llaville
Copy link
Collaborator

Available in latest releases 3.3.1, 4.4.0, 5.4.1 and 6.0.3

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

No branches or pull requests

3 participants