-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
Refactor CatListDisplayer, add some tests #288
Conversation
Oh, I forgot I created a nice testing post on the vagrant machine for this. Sharing in case it makes things easier
|
@zymeth25 this is awesome! Can you please write me an e-mail? |
Sure |
Bumping this just so I remember to review it and merge it. |
When you merge #318 there will be a conflict here but I'll resolve it. |
endif; | ||
|
||
return $this->assign_style($info, $tag); | ||
return $this->wrapper->wrap($info, $tag, $css_class); | ||
} | ||
|
||
private function get_post_link($single, $text, $class = null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left get_post_link
, get_post_title
and lcp_title_limit
as they are for now. Mostly because they work differently than the stuff above.
22a07a2
to
5efe57e
Compare
Hey @zymeth25, not sure if you're still around doing any development, but I'm doing some refactoring in another branch and since I'm back on the PHP, it's a good moment to get the changes from this PR in. Really sorry for how long it's taken, but I had been doing very small updates to the plugin for a long while. Would you be able to update it at all or should I just go ahead and incorporate your changes into my branch? I'd like to at least have it rebased to remove the Cheers! |
Hi, I haven't done much PHP work lately but I have some free time now for WordPress fun ;) I would have to re-read what I wrote in this PR because I don't remember the details but I see my past self was kind enough to leave some comments :D This PR deals with display, have you added any display options according to the current procedure? If so, I'll have to refractor them too and include here. |
Hi Klemens, good to see you again! I didn't refactor anything in the displayer yet, I can't remember what's changed since you opened this PR but I'm guessing not much. Apparently there are no conflicts with I think I might try to merge this PR into a new branch that incorporates the changes in the No rush anyway, I'm trying to dedicate some time in the nights to this new refactoring, which should make things easier for us and anyone new to the project in the long run :) |
Since it currently has no conflicts with the master branch it's probably a better idea to merge it with master. I remember I tested it thorougly and found no problems. I will have to set up my local testing env again to see if it's still good. |
I'll rebase it to remove the merge commits. |
* @param string $css_class | ||
* @return string | ||
*/ | ||
private function assign_style($info, $tag = null, $css_class = null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function assign_style
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Code Climate has analyzed commit db95501 and detected 3 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Ok done. Travis is broken but all tests pass locally. As far as I'm concerned it's ready to be merged and all changes are pretty well documented/commented in the code or this PR. |
Merging this 🎉 Don't worry about the Code Climate comments at all, this PR fixes many issues and brings the displayer to a much better state. The build is broken for Travis and me. I'll spend some time on fixing that after some refactoring. In the meantime I'm doing manual work to test stuff 😬 I'll rebase my branch and keep refactoring things out. One immediate thing I see here is we should exctract the template code into it's own class or trait! I'm going to start adding issues too so I can be more organized. Thanks again!!! |
Nice :D Yes, the template thing is something I noticed when writing this. I have a separate branch where I started work on that. Will open a PR tomorrow so you can have a look. It's 2 years old but should be good, it was based on the lcp-wrapper branch. |
Ah awesome! Yeah, if it's based off of this, it should be fine 😄 |
I only wanted to refactor
CatListDisplayer
and createLcpWrapper
but it quickly turned out that to do it properly I have to change many other files...Anyway, I moved wrapping with tags and classes to
LcpWrapper
. This PR alters many lines of code but in most cases for clarity and ease of use, not much changes in how the plugin works, except:something_tag
andsomething_class
parameters now work in all template functions, they take precedence over argumentsget_category_link($tag = 'strong', $css_class = null)
thumbnail_tag
because template function already had this feature but default build function didn'tOther thigs that don't change how things work but are important to mention:
CatListDisplayer
but this is work in progress, test cases I wrote are a good start though, we need even more refactoring to write good tests for this class...I edited the readme, but the incosistencies I mentioned in #284 are mostly in the wiki, especially the html & css section, I'll fix them once this is merged.
Fixes #282