Sonarqube 4.2 & PHP - php

since I updated to sonar 4.2 and the PHP plugin to 2.1 there is no way to use results or execute external tools like phpcs and phpmd.
We used phpcs quite extensively before - I wanted to know is there any way to get our phpcs rules back in Sonar as else the php analysis run is not much use to us. I have not found a way to define my own new rules, just found those few that come with the plugin (for comparison we had 580 rules before, and now have 28).
Hope someone can help us ;)
Thanks,
Susanne

We hope to eventually include the ability to write custom rules in Java: http://jira.codehaus.org/browse/SONARPHP-270
In the meantime, please join the user list and tell us what rules you'd like to see re-implemented.

Related

Dynamically add or remove code module in a laravel project

I have been trying to understand how this concept works. Adding or removing code modules from laravel project. I have seen this feature in many places such as quickadminpanel.com, October CMS etc. These sites are used to create an admin panel quicker, there is an interesting feature that i found in quickadminpanel that is installing module that i need. Basically i want to achieve this but i don't know how to do !! May be someone can help as this feature and concept actually exists.
The author himself replied in a mail. Now the concept is much clear to me. He simply replied this, "It's similar to how Laravel works with stubs - copy-pasting files as templates, replacing the variables in content: youtube.com/watch?v=eWarTZuates&t=1s"

How to bootstrap/setup Angular2 in an existing Laravel project?

I am looking to implement Angular2 inside my current Laravel project. I've read about many setups including AngularClass's version with Webpack, but I feel like it's all over-complicated.
What I wish to make:
A simple single page app inside my Laravel app.
It needs to have something like Grunt/Gulp or even Webpack to compile upon changes.
Does not need NodeJs to run in production, no lite-server, just like AngularJS it can be injected and that's it.
I need to understand the implementation files to achieve this, so no starterpack or angular-cli, unless if you can supply good arguments.
Looking for a "how to"-like example on creating the above.
Thanks in advance.
EDIT: More information
As ANKH pointed out, i needed a more detailed and coursed question. So here we go:
- Looking for a example implementation of a Angular2 based SPA inside an existing PHP application (Laravel).
- I've tried many different tutorials, going from the heroes tour, to Sitepoint and AngularCLI based tutorials, but they all assume a SPA on it's own. Ergo, they are compiled and served through NodeJS, which I don't need.
Turns out that I've actually been looking at this entirely wrong. I've gone with using Angular-cli and found that I could generate the output files and include these inside my Laravel project. No need to integrate them further.

How do I find out what view file is being used in codeigniter

In a nutshell I'm updating some code that uses CodeIgniter and I'm wasting a lot of time just tracing the code's controllers to find out what views are being used.
Is there an easy way to find out what view is being used and possibly what controller is calling them.
I know you'd usually just go to the uri and figure it out from there, but the previous programmer used some really complicated regex in his routing.
I'm looking for a tracing tool that does something like ASP.NET tracing or maybe a tool similar to .NET's Glimpse
Anyone have any ideas?
There is now a version of Glimpse for PHP.
You may be able to createba plugin for it: http://blog.maartenballiauw.be/post/2011/08/02/A-client-side-Glimpse-to-your-PHP-application.aspx
Enable profiler. controller_info section should help you out.
Here is example how to enable ir globally.

Automatic DB setup for CakePHP plugins

Let me disclaim first, that I'm a total CakePHP newbie. I am pretty proficient in PHP and MySQL however, having developed my own frameworks, etc., until I saw that other frameworks have already done the work for you :/ I'm trying to get into CakePHP cuz it has great documentation, good organization and the powerful console.
I've gone through the basics now and am trying to look into plugins - I have decided to start with the comments plugin, found at: http://cakedc.com/eng/downloads/view/cakephp_comments_plugin
I followed the first few lines of instructions to where I'm supposed to see the thing work, but it gave me errors about missing tables (e.g. Database table comments for model Comment was not found.). Certain I'll find a file, I've found this: /app/plugins/comments/config/schema/schema.php. The $comments array looks like it's formatted to be automated, instead of creating tables manually. But googling has failed to produce a good guide.
What line of instruction am I missing? Is there a way to use the console to convert this array (and other schema the plugin may require) into the DB scheme? Is there a script I should run every time I install a plugin?
Thanks in advance for your help.
You load the schema via the cake shell. More info here: h
http://book.cakephp.org/view/1524/Generating-and-using-Schema-files

Debug PHP and Control Flow?

I am an autodidact so dont know much about conventional web development however, I have wrote a complete social networking website yet I dont know how to debug. My website has some problems and I need to learn debuggin things around/
First of all I need instructions how to install Xdebug on WAMP (since I use phpDesigner). I tried a lot using tutorials on the web everytime I get a new error. I also tried puting it in the /ext/ directory and activating it from the WAMP PHP Extensions menu. Doesnt Work!
So if anyone odf you out there uses PHPDesigner with Xdebug (not the package that comes along, rather install it on WAMP) please help me and I would really be grateful. BTW PHP version is 5.3.0
Next thing is this is how is the the control flow of my website :-
htaccess -> redirect everything to index.php if file doesn't exist.
index.php ->
include all libraries (__autoload).
initialize classes.
Get the $_SERVER['REQUEST_URI'] to get the $page.
If $page is found
Check if the user is logged in,
if yes then include view/$page.php
or else redirect to login.php page
If page is not found then
redirect to 404.php
Is this control flow good for debugging? because I really cant understand the real MVC concept so I created something like this.
There is a tutorial for installing XDebug for use with phpDesigner here.
MVC is an organizing principle (also called a "design pattern"). It can be helpful keeping logically similar parts of a project together, and encouraging clean interfaces between them, but—especially for low complexity projects—strict MVC modeling isn't always an improvement.
You ask:
Is this control flow good for debugging?
Debugging is to identify flaws in programs. Writing a program to be easy to debug is like intentionally driving a car off the left side of the road so you'll know where to direct an ambulance to find you. Granted—there are small things which can be done to greatly improve debugability. But the point is to architect any control structure so it naturally expresses the algorithm. By doing that, it is far more likely to avoid the need to debug. Anything you can do to write correctly functioning code is justifiable.
Your control flow is clear to me. I wouldn't have any qualms about working on it.
Use xDebug.
Its very easy to install and use.
and you can download xDebug from here http://www.xdebug.org/
step by step tutorial for setup xdebug with WAMP is available at sachithsays.blogspot.com/

Categories