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

Phpcs (RFC) #1639

Merged
merged 17 commits into from May 29, 2017

Conversation

Projects
None yet
3 participants
@AJenbo
Collaborator

AJenbo commented May 21, 2017

Hi, I started working on some extensions for CodeLite, I have gotten it to a POC level, but I'm unsure of what direction to take from here, so hope a pull request is an okay way to request for comment an possibly a little help.

TODO:

  • Figure out if this should be part of the php/codeformatter-plugin or stays as a separate plugin (I also plan to implement phpmd (and posibly phpcpd) integration)
  • Figure out how to integrate with config from other plugins. Useful for getting phpexe, but also to do a proper fix for phpcs.cpp:106
  • Figure out how to create a settings modal (I have never done GUI in c++, and I'm still a novice at c++)
@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif May 24, 2017

Owner

This pull request has some conflicts. Can you please fix this?

Owner

eranif commented May 24, 2017

This pull request has some conflicts. Can you please fix this?

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 24, 2017

Collaborator

Sure. I but merging it would probably be a bit premature unless you feel like making the gui/conf part of the plugin :)
Also I added a quick implementation (the path for the project config.xml is hardcoded and i plan to use XML instead of text output for better parsing and options) of a phpmd as I really needed it for work.

Collaborator

AJenbo commented May 24, 2017

Sure. I but merging it would probably be a bit premature unless you feel like making the gui/conf part of the plugin :)
Also I added a quick implementation (the path for the project config.xml is hardcoded and i plan to use XML instead of text output for better parsing and options) of a phpmd as I really needed it for work.

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif May 24, 2017

Owner

If you are having having problems creating the GUI parts, I can create the skeleton configuration dialog and you can take it from there (I am using wxCrafter to create the UI, also part of CodeLite)

Owner

eranif commented May 24, 2017

If you are having having problems creating the GUI parts, I can create the skeleton configuration dialog and you can take it from there (I am using wxCrafter to create the UI, also part of CodeLite)

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 24, 2017

Collaborator

@eranif that would be much appreciated. All I really need is a couple of input boxes for giving the path to php, the linter (phpcs/phpmd) and in phpmd's case a rules.xml.

I just did the XML parsing for the phpmd plugin so now the GUI is all that I need for this to be ready :)

Collaborator

AJenbo commented May 24, 2017

@eranif that would be much appreciated. All I really need is a couple of input boxes for giving the path to php, the linter (phpcs/phpmd) and in phpmd's case a rules.xml.

I just did the XML parsing for the phpmd plugin so now the GUI is all that I need for this to be ready :)

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif May 24, 2017

Owner

So, you need a simple settings dialog box that can select 3 files, right?

Owner

eranif commented May 24, 2017

So, you need a simple settings dialog box that can select 3 files, right?

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 24, 2017

Collaborator

I haven't figure out how i'm supose to open wxcrafter in CodeLite, so instead I have installed the standalone version. At first it failed to launch (missing libpng12, im on Ubuntu 17.04), but after downloading the missing lib file it seams to work. I'll se if i can figure out how to get this working. I just saw a commit for the vim plugin that looks like it could be helpful in figuring out how to do this. I'll let you know how it goes :)

Collaborator

AJenbo commented May 24, 2017

I haven't figure out how i'm supose to open wxcrafter in CodeLite, so instead I have installed the standalone version. At first it failed to launch (missing libpng12, im on Ubuntu 17.04), but after downloading the missing lib file it seams to work. I'll se if i can figure out how to get this working. I just saw a commit for the vim plugin that looks like it could be helpful in figuring out how to do this. I'll let you know how it goes :)

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif May 24, 2017

Owner

Better working from within CodeLite.
To add new dialog, Right click on a folder (the yellow ones) and select wxCrafter->Add wxWidgets UI form

A wizard will come up...

  1. 1st page, select wxDialog and give it a title
  2. 2nd page, click on the button next to the drop down control (white with green plus sign) to create a new form and dont re-use an existing one. Next you will need to setup the base name. Pick something like PHPCSSettingsDlgBase Hit TAB to move to the next field and you will notice that wxCrafter will suggest the subclass name and file to be the same as the base name class just without the Base part
  3. Select the folder where to place the sources

click Finish and you are done. You can now edit the UI.

See this tutorial: http://codelite.org/LiteEditor/WxCrafterHelloWorld

Owner

eranif commented May 24, 2017

Better working from within CodeLite.
To add new dialog, Right click on a folder (the yellow ones) and select wxCrafter->Add wxWidgets UI form

A wizard will come up...

  1. 1st page, select wxDialog and give it a title
  2. 2nd page, click on the button next to the drop down control (white with green plus sign) to create a new form and dont re-use an existing one. Next you will need to setup the base name. Pick something like PHPCSSettingsDlgBase Hit TAB to move to the next field and you will notice that wxCrafter will suggest the subclass name and file to be the same as the base name class just without the Base part
  3. Select the folder where to place the sources

click Finish and you are done. You can now edit the UI.

See this tutorial: http://codelite.org/LiteEditor/WxCrafterHelloWorld

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 24, 2017

Collaborator

I only get an option for wxFormBuilder :/ I'm also missing the wxCrafter tab from the tutorial

Collaborator

AJenbo commented May 24, 2017

I only get an option for wxFormBuilder :/ I'm also missing the wxCrafter tab from the tutorial

@mtangoo

This comment has been minimized.

Show comment
Hide comment
@mtangoo

mtangoo May 25, 2017

I only get an option for wxFormBuilder :/ I'm also missing the wxCrafter tab from the tutorial

Is it listed in Plugins? You seem to use Ubuntu, did you install wxCrafter also? It works flawlessly in my Ubuntu following the guide on the website and then install with:
sudo apt-get install codelite wxcrafter

mtangoo commented May 25, 2017

I only get an option for wxFormBuilder :/ I'm also missing the wxCrafter tab from the tutorial

Is it listed in Plugins? You seem to use Ubuntu, did you install wxCrafter also? It works flawlessly in my Ubuntu following the guide on the website and then install with:
sudo apt-get install codelite wxcrafter

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif May 25, 2017

Owner

Which OS are you using? it should be bundled with CodeLite (wxCrafter plugin)
Is it a self compiled CodeLite or an official version?

Owner

eranif commented May 25, 2017

Which OS are you using? it should be bundled with CodeLite (wxCrafter plugin)
Is it a self compiled CodeLite or an official version?

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 25, 2017

Collaborator

Ubuntu 16.04 and also on Ubuntu 17.04, currently I'm using a self compiled version (the one in this pull request) but I can try the official on and the distribution later.

Collaborator

AJenbo commented May 25, 2017

Ubuntu 16.04 and also on Ubuntu 17.04, currently I'm using a self compiled version (the one in this pull request) but I can try the official on and the distribution later.

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 25, 2017

Collaborator

The plugins is listed and enabled

Collaborator

AJenbo commented May 25, 2017

The plugins is listed and enabled

@mtangoo

This comment has been minimized.

Show comment
Hide comment
@mtangoo

mtangoo May 25, 2017

I'm using a self compiled version (the one in this pull request)

I have never tried that myself, so cannot help. But installing official will save you pain on this.

mtangoo commented May 25, 2017

I'm using a self compiled version (the one in this pull request)

I have never tried that myself, so cannot help. But installing official will save you pain on this.

Refactor php linters in to a single plugin
This resolves the issue of clearing markeres in the right order, and
just feels right :)
@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 26, 2017

Collaborator

Ok I have re-factored the linters in to a single plugin and the code for that part is pretty much what I would consider ready, unless you have some comments.

As for the options dialog I managed to create something in wxCrafter that looks right, but when I try to open the dialog from the menu it just crashes CodeLite instantly (no error in the logs) and I for one can not figure out how to get it to work. Any help at this point would be greatly appreciated.

Collaborator

AJenbo commented May 26, 2017

Ok I have re-factored the linters in to a single plugin and the code for that part is pretty much what I would consider ready, unless you have some comments.

As for the options dialog I managed to create something in wxCrafter that looks right, but when I try to open the dialog from the menu it just crashes CodeLite instantly (no error in the logs) and I for one can not figure out how to get it to work. Any help at this point would be greatly appreciated.

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif May 26, 2017

Owner

This sounds like missing symbols issues.
To fix this: you need to re-run cmake and build again so the new generated files will get included and linked

Owner

eranif commented May 26, 2017

This sounds like missing symbols issues.
To fix this: you need to re-run cmake and build again so the new generated files will get included and linked

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 26, 2017

Collaborator

Yep that fixed it :(
(sad because i spent hours trying to figure out what I did wrong, redoing it a few times)

Collaborator

AJenbo commented May 26, 2017

Yep that fixed it :(
(sad because i spent hours trying to figure out what I did wrong, redoing it a few times)

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 27, 2017

Collaborator

@eranif I'm happy to say that I now think the plugin is ready for merge. Hope you feel the same :)

Collaborator

AJenbo commented May 27, 2017

@eranif I'm happy to say that I now think the plugin is ready for merge. Hope you feel the same :)

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif May 27, 2017

Owner

Great, I will merge it later today and will test it on Windows (I am not sure if you tried it on Windows)

Owner

eranif commented May 27, 2017

Great, I will merge it later today and will test it on Windows (I am not sure if you tried it on Windows)

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 27, 2017

Collaborator

Thanks that would probably be a good idea, though I have strived to keep it compatible.

I have yet to figure out how to compile CodeLite on Windows. The README.md skips setting up wxWidget and the download link is doesn't work (looks like the right package is DwxMSW-3.0.3_gcc510TDM_x64_Dev.7z), but i still end up with a non informative fail about halfway threw the compile (current master branch on your repo mind you).

Collaborator

AJenbo commented May 27, 2017

Thanks that would probably be a good idea, though I have strived to keep it compatible.

I have yet to figure out how to compile CodeLite on Windows. The README.md skips setting up wxWidget and the download link is doesn't work (looks like the right package is DwxMSW-3.0.3_gcc510TDM_x64_Dev.7z), but i still end up with a non informative fail about halfway threw the compile (current master branch on your repo mind you).

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif May 29, 2017

Owner

FYI: CodeLite is built with wxWidgets 3.1 on Windows and it uses some custom build steps which are explained here in details:

http://codelite.org/Developers/BuildingWxWidgetsWin

Owner

eranif commented May 29, 2017

FYI: CodeLite is built with wxWidgets 3.1 on Windows and it uses some custom build steps which are explained here in details:

http://codelite.org/Developers/BuildingWxWidgetsWin

@eranif eranif merged commit eef54e8 into eranif:master May 29, 2017

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif May 29, 2017

Owner

Are the tooltips in the dialog correct? (e.g. the field that says: PHPMD, the tooltip is: "Select the PHP-CS-Fixer phar file location")
Can you please go over the dialog entries and correct the tooltips?

Owner

eranif commented May 29, 2017

Are the tooltips in the dialog correct? (e.g. the field that says: PHPMD, the tooltip is: "Select the PHP-CS-Fixer phar file location")
Can you please go over the dialog entries and correct the tooltips?

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif May 29, 2017

Owner

Few comments:

  • Avoid using the old macros CL_DEBUG, CL_WARNING etc, please use the new macros. An example of a typical debug line:
clDEBUG() << "The filename is:" << m_fileName << clEndl;
  • I fixed a bug that if no PHP exectuable was set properly and then I fixed it from the PHP settings dialog, it was not reloaded by the PHPLint plugin

other than that, I added some more debug messages to the log and ensured that the plugin is built properly on Windows (and installs)

Owner

eranif commented May 29, 2017

Few comments:

  • Avoid using the old macros CL_DEBUG, CL_WARNING etc, please use the new macros. An example of a typical debug line:
clDEBUG() << "The filename is:" << m_fileName << clEndl;
  • I fixed a bug that if no PHP exectuable was set properly and then I fixed it from the PHP settings dialog, it was not reloaded by the PHPLint plugin

other than that, I added some more debug messages to the log and ensured that the plugin is built properly on Windows (and installs)

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 29, 2017

Collaborator

Thanks for the help :)

Would it be helpful if I cleaned up other usages of CL_DEBUG, CL_WARNING & frinds?

I'll keep the Windows install in mined if I do another plug-in. The only major feature I have plans for is PHP refactoring, but I'm not sure weather i should use an external phar tool or work with the build in lexer (might be above my skill set, but if you feel like helping I could probably learn).

Collaborator

AJenbo commented May 29, 2017

Thanks for the help :)

Would it be helpful if I cleaned up other usages of CL_DEBUG, CL_WARNING & frinds?

I'll keep the Windows install in mined if I do another plug-in. The only major feature I have plans for is PHP refactoring, but I'm not sure weather i should use an external phar tool or work with the build in lexer (might be above my skill set, but if you feel like helping I could probably learn).

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 29, 2017

Collaborator

P.s. i think PHPLint and the VIM mode plugins are missing from the list in the initial setup wizard. I looked threw the code but came to the conclusion that it's generated dynamically, but didn't really debug the issue.

Collaborator

AJenbo commented May 29, 2017

P.s. i think PHPLint and the VIM mode plugins are missing from the list in the initial setup wizard. I looked threw the code but came to the conclusion that it's generated dynamically, but didn't really debug the issue.

@AJenbo

This comment has been minimized.

Show comment
Hide comment
@AJenbo

AJenbo May 30, 2017

Collaborator

After setting following the guide you linked to mingw32-make reports that there isn't a file called Makefile.gcc in the project.

Running build crom codelite now gives me this more informative error:
windows-error

mingw32-make with Makefile instead of Makefile.gcc resultes in an error about missing SDK files for sqllite3 :/

Collaborator

AJenbo commented May 30, 2017

After setting following the guide you linked to mingw32-make reports that there isn't a file called Makefile.gcc in the project.

Running build crom codelite now gives me this more informative error:
windows-error

mingw32-make with Makefile instead of Makefile.gcc resultes in an error about missing SDK files for sqllite3 :/

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif May 30, 2017

Owner

This means that you did not build wxWidgets properly. The wxTrap calls are part of the Debug build and they should not be called when building CodeLite in release mode.

I will run my guide on a clean setup, step by step to make sure I did not miss anything there.

About the plugins missing in the wizard: I do see them... Just run "Help->Run the setup wizard" - and I can see them there

Owner

eranif commented May 30, 2017

This means that you did not build wxWidgets properly. The wxTrap calls are part of the Debug build and they should not be called when building CodeLite in release mode.

I will run my guide on a clean setup, step by step to make sure I did not miss anything there.

About the plugins missing in the wizard: I do see them... Just run "Help->Run the setup wizard" - and I can see them there

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