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

Feature/php parser task #138

Closed
wants to merge 34 commits into from
Closed

Feature/php parser task #138

wants to merge 34 commits into from

Conversation

llaville
Copy link
Contributor

@llaville llaville commented Apr 5, 2016

Q A
Branch master for features and deprecations
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? not yet
Documented? no
Fixed tickets comma-separated list of tickets fixed by the PR, if any

visitors_options:
function_call_visitor:
blacklist: ["var_dump", "error_log"]
whitelist: ["count", "get_class"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly is the difference between blacklist and whitelist. Aren't whitelist items allowed by default?
In the code I see that whitelist returns a notice. But the notice will still make the task fail?
I am not sure what this should do :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitelist was a try to distinct two groups but, you're right the task fail anyway, so it's not a nice try !

ignore_patterns: []
```

**visitors_options**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could describe what options you can configure per visitor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each class visitor as it's own configuration:

When class named Namespace\To\ClassFooVisitor the option entry should underscore named as base class name. In this example it will be class_foo_visitor

@veewee
Copy link
Contributor

veewee commented Apr 6, 2016

HI @llaville,

The PR is starting to look pretty good. I made some remarks about the code.
We will continuing discussing the feature in this PR, so I will close the other one.

I think there is something struturally wrong with how the visitors are added, initialized and configured.
I was thinking about using Symfony service configurators as described here:
http://symfony.com/doc/current/components/dependency_injection/configurators.html

Maybe this could be the solution to the problems we are facing?
It will also make it possible to configure the visitors as described in the previous threat. I think the current implemented visitor_options will make the configuration confusing.

One other thing I don't like about current visitors implementation is the constructor and init() method. It looks like both the runtime configuration, the file and the errorlist should be added through the constructor. So maybe the visitors aren't really services, but factory services that can create a vistor during runtime?

Can you give me your feedback on these remarks so that we can get the architecture of the parser right?
Thanks!

@llaville
Copy link
Contributor Author

llaville commented Apr 6, 2016

Hi @veewee

Thanks again for all your remarks and code review. I appreciate a lot !

I'll reply to you ASAP.

@llaville
Copy link
Contributor Author

llaville commented Apr 8, 2016

Hello @veewee
I need your help about phpspec usage.
I've wrote some spec files but I can't solve an issue. Perharps you could help me. Here are the ouput I got on my windows platform with PHP 5.6.19

GrumPHP\Collection\FilesCollection
 101  - it should filter by date
      warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the
      date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are
      still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now,
      but please set date.timezone to select your timezone. in
      C:\home\github\grumphp\spec\GrumPHP\Collection\FilesCollectionSpec.php line 107

GrumPHP\Task\PhpParser
  23  - it should have a name
      exception <label>[exc:GrumPHP\Exception\RuntimeException("The php_parser can't run on your system. Please install
all dependencies.")]</label> has been thrown.

GrumPHP\Task\PhpParser
  28  - it should have configurable options
      exception <label>[exc:GrumPHP\Exception\RuntimeException("The php_parser can't run on your system. Please install
all dependencies.")]</label> has been thrown.

GrumPHP\Task\PhpParser
  38  - it should run in git pre commit context
      exception <label>[exc:GrumPHP\Exception\RuntimeException("The php_parser can't run on your system. Please install
all dependencies.")]</label> has been thrown.

GrumPHP\Task\PhpParser
  43  - it should run in run context
      exception <label>[exc:GrumPHP\Exception\RuntimeException("The php_parser can't run on your system. Please install
all dependencies.")]</label> has been thrown.

GrumPHP\Task\PhpParser
  20  - it should handle ignore patterns
      exception <label>[exc:GrumPHP\Exception\RuntimeException("The php_parser can't run on your system. Please install
all dependencies.")]</label> has been thrown.

                                      98%                                        397
61 specs
397 examples (391 passed, 6 broken)
13046ms

I've tried to set timezone to UTC, but I got same result (with or without)

@llaville
Copy link
Contributor Author

llaville commented Apr 8, 2016

@veewee Forget my previous help request about spec files. I've solved the first broken spec about timezone settings.

I got another PHP in my path that was used but timezone was not defined in UTC on php.ini !

@veewee
Copy link
Contributor

veewee commented Apr 9, 2016

Dus you also solve the php_parser can't run on your system error? You probably have to add the parser to the dev dependences in composer.

@llaville
Copy link
Contributor Author

I'll push the code updated this evening, when I'll be back from Office

@veewee veewee mentioned this pull request Aug 10, 2016
@veewee
Copy link
Contributor

veewee commented Aug 28, 2016

@llaville Are you planning to finish this PR any time soon? Thanks!

@veewee
Copy link
Contributor

veewee commented Oct 26, 2016

@llaville
For your info: I've started a little branch myself:
veewee@e5de05c

Maybe the task has to be configured through services in a first version. I'll try to work on it again when I find some spare time again :)
Feel free to add your remarks.

@veewee veewee mentioned this pull request Oct 27, 2016
18 tasks
@veewee
Copy link
Contributor

veewee commented Oct 27, 2016

We'll continue integrating this task in #218.
Thanks for your work, I managed to reuse quite a lot of it.

@veewee veewee closed this Oct 27, 2016
@llaville llaville deleted the feature/php_parser_task branch May 3, 2017 04:46
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

Successfully merging this pull request may close these issues.

2 participants