The only workaround I've found so far is to mark the directories as "Test source", and uncheck the "Include test sources" box in the code inspection window. Needless to say that this is not the best solution!
If you need to completely exclude few files from any analyse (for example a compiled php file) like it not even exist, you can right click on file in source tree and select "Mark as Plain Text". This action totally remove any inspections on this file. With this I removed a lot of notifications about "source duplications" in Laravel 5.
I have been working with phpStorm and it had suddenly stopped showing suggestions for code completion. When i do Ctrl + space its behaving correctly by showing all the possible options in a drop down.
However sometimes the PhpStorm code analysis failed and you lost your code completion. In this case you juste have to ask for a new code analysis (File > Synchronize [CTRL+ALT+Y]) or invalid the cache and force a restart (File > Invalid cache / Restart).
" ... stopped showing suggestions for code completion".On mac you can invoke it by fn+ctrl+space.Going to php-storm -> Settings -> Keymap -> Set Active Changelist you can see it is associated with ^+space.on windows ctrl+space
If you have issues opening the "reformat code" popup for multiple files, make sure that you don't have any open files as it'll otherwise only reformat the current open file (edit: sometimes - I still haven't been able to figure out why it allows you to reformat the entire code sometimes, but regardless, this fix will work if it doesn't allow you to).
If you close all open code window and select a folder in the Project pane, you can use the keyboard shortcut or the Code->Refactor command and you'll get the dialog to reformat the code for the entire folder. This works in 2018.03, even for multiple subdirectories.
PHP Sniffer & Beautifier: I probably use this the most, as it helps me to auto-format my PHP code to match the WordPress coding standards (or any other coding standard for that matter). It requires having phpcs and phpcbf installed and configured.
Very nice to know. It is a shame when plugin authors have to abandone stuff. But that is life, as they say on Mars. ? And that is what is great about Open Source. Someone should and can pickup on a good plugin.
This is the default behavior of our PHP analyzer: any directory named vendor is ignored, since for most project, this is where composer puts 3rd party dependencies - and our reasoning is that raising issues on 3rd party code would be noise for most projects.
If I understand correctly, in your project (is this a Magento project?), you want to analyze the contents of (at least) vendor/module. In my screenshot above, I put a value of which will result in all PHP files being analyzed.
I'm giving a talk soon about Laravel and "the enterprise", and the concept of LOC (lines of code) keeps coming up. It turns out that's actually a much harder number to discover than you might think, so I figured I would write up a few options here.
For what it's worth, I'm not a big fan of LOC as a measure of any importance, but it can at least give us some broad foundations to use to talk about broad differences in project size. If you were to ask me, I would say we shouldn't even think about it. But we don't always have that luxury.
It can also pull from archives and git repositories, diff two versions of a codebase, pull from specific commits, ignore files and folders matching specific patterns, and it's installable via Brew, NPM, two Windows package managers, and all the major Linux package managers.
This is definitely one of the less precise measures, but it also doesn't require you to have anything else installed, and it gives you the ability to include and exclude specific patterns for files and folders.
In the end, I'd still recommend PHPLOC if you can. It is the most contextualized and provides additional details several others don't. It makes it easy to exclude vendor directories. It's good. That's all.
I found out that there are many ways that you could do this, but I was searching for a solution that would be simple to implement. That way I would get the grips with what really makes a difference when checking your complexity. After that, I could proceed with testing different options and having something that could be implemented on a team level.
Some Google searches later, I found out about Code Inspections in PhpStorm (as well as WebStorm). It ticked all of my boxes because it was simple, didn't require any installation and had a ton of options.
Now, there are a whole lot of different checks (and levels of severity) you can set, so I won't be going through them all. You can check all of those over at JetBrains. Some of the rules might be even coverable with ESLint and/or Prettier, but I will list all of them here. It's worth noting that this isn't a final list since I have only started using this tool.
And that's it! It's a long list, but I think it really helps out during development. Although most of the stuff is how you usually write code, it's good not to have the mental burden of having to think about it constantly.
Do you have any recommendations of rules or even other tools to use? I would love to see what other people are using!
As you evidently figured out by the contents of this post, JetBrains offers multiple great IDE's to handle some of the many developing languages, each with a language or set of languages that it focuses on. I just wanted post this in case anyone finds this article to be useful and happens to be developing a JavaScript-based application. I have used many of their products including IntelliJ, PyCharm, PHPStorm, CLion, and WebStorm, and would like to recommend that you check out WebStorm if you have not done so already. It is yet another great IDE that offers a multitude of useful tools and features to help improve all aspects of your project's code.
Personally if i am developing PHP applications i am using PhpStorm, and if i am developing JS app's i am using WebStorm. One of the examples would be better debuging JS frameworks, for example meteor.js etc ...
Your welcome. I attached the thing that is different in a way of debuging code. You'll clearly see differences. Yes they are really powerful tools, but yet again you get really spoiled by it, gets you lazy in some ways of handling for example git, leaving IDE to do all the work for you. After all i think it is just habit in a way what IDE you will use.
dev-to-uploads.s3.amazonaws.com/i/...
And I agree about the spoiling. I believe it's not the best tool for people just getting familiar with all the tools and concepts. It's a shortcut that should be used with caution and with deeper understanding. But I honestly love the way the Storms handle git. I really rarely need to use the terminal. It is a huge productivity boost for a lot of the stuff
It's a really good tool in Phpstorm/Webstorm, but I love to use Eslint with airbnb coding standard settings, Oh and don't forget lint with precommit hooks. It will prevent you to push any "bad" code to the codebase.
After the initial promo year of free access, GitHub released a commercial version of Copilot a while ago. While the price tag isn't anything special ($10 a month or $100 a year), when you consider the fact that there are many tools, services, IDE plugins,... priced at about $10 to $25 a month, the costs quickly pile up. When you add subscriptions which are not work related, it can become a bit overwhelming. So, the question for each subscription service is - is it worth it? Here are my impressions which you may find useful.
First of all, let's set something straight - whatever Copilot can do, it can't be classified as great. It does many things good (or good enough), but not great. You can simply feel the architecture behind the AI in every single code or comment suggestion it makes.
The first thing which Copilot does good is writing comments for the already existing code. I am in the process of revisiting and refactoring some old PHP 7.4 code to PHP 8.2, along with the upgrade of Symfony and PHPUnit. There are parts of the code which I remember being exceptionally complex to write and optimize, which inevitably produced code which is difficult to understand now, 2 years from the time the code was written. Copilot is handy in this situation. I only need to open a comment on top of the code, or start a new docblock comment line, and the suggested description is generated. Copilot's suggestions in this case are OK and mostly true, but I do need to read and try to understand the exact meaning of the generated comment, then run through the code and see if the suggestion was right. About 80%-90% of the time it is, but there are cases where it can generate a misleading comment which would make more damage than help if left unchecked. It's important to note that the accuracy of the generated comment does not depend on the size or complexity of the code. It can be 100% accurate for a complex code, but fail on more simple one (and vice versa). Generated comments are more like good and useful guidelines.
Refactoring and rewriting existing code is one of the stronger points of Copilot. If you take a look at Terms of service, you might notice that you're giving the right to Copilot to read and analyze the code of your project and any open tab in your IDE. I can simply feel this being used extensively. For example, if I have two projects opened and trying to rewrite some old code, it will start offering code suggestions based on the currently opened file (tab) of the other project. However, this is a double-edged sword, since it will force suggestions based on the old code. That's fine if I just want to rewrite something and make minimum adjustments (like renaming properties, variables, methods,...), but if I really want to refactor and improve the code, Copilot simply gets in my way with suggestions based on the old code - and it keeps doing it so aggressively that I simply want to disable it until I'm done refactoring. In addition to this, it will almost certainly skip suggesting empty string or array initialization, even if the old code has it and even if it makes perfect sense in the code. The worst part is that it gradually tries to mix the new code with the old one, which does create a solid amount of mess. But, sometimes - it just works perfectly.
b37509886e