Skip to content

Conversation

@shulard
Copy link
Member

@shulard shulard commented Aug 23, 2016

I've found that there are simpler methods to retrieve data from Gitlab API library than the one used for the moment.

Also, Gitlab API response structure is not the same than Github, some keys must be updated.

Gitlab API response structure is not exactly the same than Github / Bitbucket. So we need to fix some of the logic here…

Also avoid making useless API calls
Use direct API endpoint instead of making others calls to retrieve useless data…

return $issue->showComments();
$comments = $this->client->api('merge_requests')->showNotes($this->getCurrentProject()->id, $id);
return array_filter(array_map(function($note) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please run the php-cs-fixer 👍

@shulard
Copy link
Member Author

shulard commented Aug 24, 2016

Ok, I've ran php-cs-fixer...

'<fg=white>Comment #%s</> by %s on %s',
$comment['id'],
$comment['user'],
empty($comment['created_at']) ? '' : $comment['created_at']->format('r')
Copy link
Member

Choose a reason for hiding this comment

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

do you have to do this check?

Copy link
Member Author

Choose a reason for hiding this comment

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

The created_at key can be null if there is no date in API data... Maybe it's too much, there is always a date... I'll remove it !

@cordoval
Copy link
Member

  • add todo list of what is left to the PR description
  • manually test it

Allow to make only the API calls required to perform the requested action.
@shulard
Copy link
Member Author

shulard commented Aug 24, 2016

Hello @cordoval you were right 😄. There are other places where API calls can be optimized. I've commited the changes. I've also processed your different feedbacks.

@cordoval cordoval merged commit 28b5ae9 into gushphp:master Aug 24, 2016
@cordoval
Copy link
Member

@shulard the build will push the new images on dockerhub for gush, after it builds and pushes successfully, can you docker pull and test these changes please? thanks so we have some validation. Thanks

@cordoval
Copy link
Member

test with github and gitlab

@shulard
Copy link
Member Author

shulard commented Aug 24, 2016

ok I'll try with docker 😄

@shulard
Copy link
Member Author

shulard commented Aug 25, 2016

Hello @cordoval

Is the image already built ? I've pull from docker hub and I've got some errors against data manipulation (array to string, strstr with a first parameter as array...). On my local machine without docker, there is no problem with data structure...

@cordoval
Copy link
Member

paste the errors and how you are running it, the image was built https://hub.docker.com/r/coder20078/gush/tags/ 20 hours ago, make sure you do docker pull coder20078/gush again, check how old is your images with docker images

@shulard
Copy link
Member Author

shulard commented Aug 25, 2016

I've just made docker pull coder20078/gush five minute ago.

$ docker images
REPOSITORY                                    TAG                 IMAGE ID            CREATED             SIZE
coder20078/gush                               latest              5cea92fb2356        19 hours ago        112.2 MB

I ran it using the gush.dist script bundled in the repo.

Example here :

$ ~/Sites/Forks/Gush/gush.dist issue:show 320186

Issue #320186 - Add a valid unit test suite !!! by shulard [opened]
===================================================================


Warning: strstr() expects parameter 1 to be string, array given in /usr/src/gush/vendor/symfony/console/Helper/Table.php on line 387

Notice: Array to string conversion in /usr/src/gush/vendor/symfony/console/Formatter/OutputFormatter.php on line 139
 Org/Repo:  bee4/beebot
 Link:      https://gitlab.com/bee4/beebot/issues/31
 Labels:    Bot, confirmed, critical

Warning: mb_detect_encoding() expects parameter 1 to be string, array given in /usr/src/gush/vendor/symfony/console/Helper/Table.php on line 342

Warning: strlen() expects parameter 1 to be string, array given in /usr/src/gush/vendor/symfony/console/Helper/Table.php on line 343

Warning: mb_strwidth() expects parameter 1 to be string, array given in /usr/src/gush/vendor/symfony/console/Helper/Table.php on line 343

Warning: mb_detect_encoding() expects parameter 1 to be string, array given in /usr/src/gush/vendor/symfony/console/Helper/Helper.php on line 54

Warning: mb_strwidth() expects parameter 1 to be string, array given in /usr/src/gush/vendor/symfony/console/Helper/Helper.php on line 58

Notice: Array to string conversion in /usr/src/gush/vendor/symfony/console/Formatter/OutputFormatter.php on line 139

Notice: Array to string conversion in /usr/src/gush/vendor/symfony/console/Helper/Table.php on line 353
 Milestone: Array
 Assignee:  shulard

Body
----

 It is really important to be able to validate the bot behaviour

I'm using the master branch freshly updated.

@cordoval
Copy link
Member

it works, the only problem are those warnings, which means that we are plugging an array instead somewhere.

@shulard
Copy link
Member Author

shulard commented Aug 25, 2016

Yeah I know but with the same code base I don't understand why these warning are present on the docker version...

@cordoval
Copy link
Member

because your error reporting is set to ignore these, also because really you don't have the same environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants