Skip to content

[ci] Add Travis#1619

Merged
Alkarex merged 57 commits intoFreshRSS:devfrom
Frenzie:dev
Sep 22, 2017
Merged

[ci] Add Travis#1619
Alkarex merged 57 commits intoFreshRSS:devfrom
Frenzie:dev

Conversation

@Frenzie
Copy link
Copy Markdown
Member

@Frenzie Frenzie commented Aug 21, 2017

References #577.

Some caveats:

  1. This won't work until someone enables Travis integration.
  2. I hope I've captured the coding style correctly. It'll be a while before it passes. If nothing else there are many spaces in the code base where there should be tabs. See here for a detailed log. The fixes can be applied almost entirely automatically.
  3. This is just for basic linting and coding standards compliance. Adding PHPUnit is for another day. ;-)

@Alkarex
Copy link
Copy Markdown
Member

Alkarex commented Aug 21, 2017

@Frenzie Super. I think you should have the rights in the project settings, if you want to have a look.

@Alkarex Alkarex added this to the 1.7.1 milestone Aug 21, 2017
@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Aug 21, 2017

As a "member" I can now push to all the repos, but only "owners" can change project settings like continuous integration.

A couple of preliminary issues I've spotted.

Style guide vs. reality

The style guide quite clearly says:

if ($a == 10) {
    // do something
}

if ((int)$a == 10) {
    // do something
}

but I noticed that there's a great quantity of this kind of thing:

@@ -718,20 +716,15 @@ class SimplePie
-               if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
-               {
-                       if (!empty($this->data['items']))
-                       {
-                               foreach ($this->data['items'] as $item)
-                               {
+               if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) {
+                       if (!empty($this->data['items'])) {
+                               foreach ($this->data['items'] as $item) {
                                        $item->__destruct();
                                }
                                unset($item, $this->data['items']);
                        }
-                       if (!empty($this->data['ordered_items']))
-                       {
-                               foreach ($this->data['ordered_items'] as $item)
-                               {
+                       if (!empty($this->data['ordered_items'])) {
+                               foreach ($this->data['ordered_items'] as $item) {

I tend to prefer what the style guide says, but the code itself seems to be 50/50 on it (not an actual stat).

The /libs issue

On a related note, should everything in /libs be ignored or only the stuff that doesn't start with lib_? It looks like the lib_ files might be FreshRSS-specific.

@Alkarex
Copy link
Copy Markdown
Member

Alkarex commented Aug 21, 2017

Quick partial response:

  • favicons, lib_rss, lib_install, lib_date, lib_opml : FreshRSS code to be included
  • Minz library is from @marienfressinaud and could probably be included
  • SimplePie (this is the code of your example): excluded
  • other libs: probably excluded

Ah, I did not know for the rights. Maybe @marienfressinaud or @aledeg could be interested in enabling the Travis config?

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Aug 22, 2017

I hadn't looked at it in too much detail yesterday, but sensibly excluding a few libraries makes a lot of difference.

https://travis-ci.org/Frenzie/FreshRSS/jobs/267081829

Travis with all the libs:

Time: 57.69 secs; Memory: 90.75Mb

Travis without (most of it):

Time: 12.63 secs; Memory: 22.25Mb

There are a few occurrences of this kind of thing that don't error on my local phpcs but do on Travis. On my Debian I'm currently using PHP_CodeSniffer version 2.7.1, whereas the Travis box installs a brand new PHP_CodeSniffer-3.0.2.tgz. I hope squizlabs/PHP_CodeSniffer#1404 didn't fix this the wrong way.

'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom && $xml &&
$data && $cache && $users && $favicons && $http_referer && $message == '' ?
'ok' : 'ko'

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Aug 22, 2017

I've added a few commits to start addressing some of the errors. I'm keeping them all separate so they're easy to drop or amend if desired.

https://travis-ci.org/Frenzie/FreshRSS/jobs/267229385

@marienfressinaud
Copy link
Copy Markdown
Member

I just enabled repo on Travis, you can add [![Build Status](https://travis-ci.org/FreshRSS/FreshRSS.svg?branch=master)](https://travis-ci.org/FreshRSS/FreshRSS) in README if you want :)

@Frenzie Frenzie force-pushed the dev branch 3 times, most recently from f3b2ccf to c515655 Compare August 24, 2017 18:11
@Alkarex
Copy link
Copy Markdown
Member

Alkarex commented Aug 24, 2017

Thanks for all this cleaning effort @Frenzie 👍

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Aug 24, 2017

It's actually surprisingly relaxing combined with listening to this album I just bought in hi-res.

I haven't yet found out if there's a setting to make it shut up about these things 66 | ERROR | [x] Expected 1 space after ":"; newline found

return $isoDate === null || $isoDate === '' ? null :
str_replace(array('-', ':'), '', $isoDate); //FIXME: Bug with negative time zone

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Aug 24, 2017

I dropped a comment here regarding what I consider a regression compared to the version 2.7.1 I'm still happily using on my desktop: https://github.com/squizlabs/PHP_CodeSniffer/pull/1404/files#r135108075

Personally I would just toss in an extra tab without bothering with pixel art alignment, but it looks beautiful the way it is and obviously @marienfressinaud went through all the trouble of doing it in the first place. I think I might force an older version of phpcs in the meantime.

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Sep 9, 2017

Alright, I got it down to 0 errors in the test. Please take a look at the changes and let me know if there are any changes you dislike.

Except for PHP 5.3 (pear/PHP_CodeSniffer requires PHP (version >= 5.4.0)) I'm not sure why the test is only passing on PHP 7.1 on Travis, but that aside. My whole point in setting this up is to run the unit tests on all supported versions of PHP and perhaps a few allowed to fail other versions to boot, but for the linting I suppose it doesn't matter.

@Alkarex
Copy link
Copy Markdown
Member

Alkarex commented Sep 9, 2017

Good work! Quickly looking at the changes, I do not see anything unwanted :-)

@Frenzie Frenzie force-pushed the dev branch 2 times, most recently from a149d96 to 15a0715 Compare September 18, 2017 19:49
@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Sep 18, 2017

I just added everything except PHP 7.1 to allowed failures, but now 5.4 and 5.5 are also passing. In any case, I think this should be safe to squash merge without every PR getting a fail if no one has any objections.

@Alkarex Alkarex merged commit 4e174ed into FreshRSS:dev Sep 22, 2017
@Alkarex
Copy link
Copy Markdown
Member

Alkarex commented Sep 22, 2017

Ok, let's give it a try :-)

Alkarex added a commit that referenced this pull request Sep 22, 2017
Alkarex added a commit to Alkarex/FreshRSS that referenced this pull request Sep 22, 2017
Alkarex added a commit that referenced this pull request Sep 22, 2017
. '&hub.mode=' . ($state ? 'subscribe' : 'unsubscribe')
. '&hub.topic=' . urlencode($url)
. '&hub.callback=' . urlencode($callbackUrl)
CURLOPT_POSTFIELDS => http_build_query(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Strange this syntax error was not caught by the linter.
Fixed in #1633

CURLOPT_POSTFIELDS => http_build_query(
'hub.verify' => 'sync',
'hub.mode' => ($state ? 'subscribe' : 'unsubscribe'),
'hub.topic' => urlencode($url),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This broke PSHB. Fix on the way

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should've been an array around it I suppose. Whoops. :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The array was the first issue (a bit higher up). I wonder why it was not caught by the linter when running Travis. Any idea?
This is another issue, with a double-encoding of hub.topic value :-)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be fixed in #1643

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not sure to what extent the linter picks up on things the regular parser will. Its main purpose is that which the parser won't pick up. (This particular error is all on me. The parser said it was a big bunch of string concatenation and I realized that PHP is a bit more efficient now than it once was... unfortunately introduced a slight type error in the process.)

Alkarex added a commit to Alkarex/FreshRSS that referenced this pull request Sep 24, 2017
@Frenzie Frenzie deleted the dev branch September 24, 2017 10:36
@Alkarex
Copy link
Copy Markdown
Member

Alkarex commented Sep 26, 2017

#1570

@Frenzie , have you found out why PHP versions 5.3, 5.6, 7.0 are failing?
It looks to be due to some (mis-)configuration, and not due to FreshRSS code:
image

@Frenzie
Copy link
Copy Markdown
Member Author

Frenzie commented Sep 26, 2017

5.3 won't work with a recent version of CodeSniffer but I don't consider that of any importance (unlike PHPUnit). All the PHP versions are just there as prep for PHPUnit really since just one PHP would do for the linter.

In the case of 5.6 and 7.0 it looks like Travis hasn't set up the include dirs correctly but I don't understand why that should be the case. What is clear is that 5.6 and 7.0 are installed by default while the others are installed only on request.

A workaround mentioned in travis-ci/travis-ci#7154 is to be more specific, such as 5.4.44 (except in this case that'd be something like 5.6.5 or 5.6.6, also see travis-ci/travis-ci#5410 (comment)). Or maybe just a simple symlink would do.

Anyway, I'll look into the specifics if it's relevant for PHPUnit. :)

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.

3 participants