I am getting several warnings when generating my project documentation because YARD cannot parse some external class extensions
[warn]: in YARD::Handlers::Ruby::MixinHandler: Undocumentable mixin: YARD::Parser::UndocumentableError for class MyClass
[warn]: in file 'lib/Project/myclass.rb':7:
7: include Virtus.model
The root of the problem is one class extension that cannot be parsed. I know I could just run yard -q to suppress all warnings, but I would rather supress individual extensions than everything.
As far as I can see in the help, I could --exclude but right now, the offending class is part of an external gem. I also tried #!parse without success
class MyClass
# #!parse Virtus.model
include Virtus.model
end
I had the same problem, and I was able to hide the warning by obfuscating the inclusion so YARD cannot detect it:
class MyClass
send :include, Virtus.model
end
There is more discussion of this issue on github:
https://github.com/lsegal/yard/issues/546
Related
I have a yii2 project set up on phpstorm 8.0.3. My namespace structure is as follows:
backend\
controllers
models
...
frontend\
controllers
models
..
common\
controllers
models
I used composer on the project and have various dependancies installed in the vendor folder.
Whenever I try to use a class that is not in the same base namespace (frontend, backend or common), I get an undefined class error. The odd thing is the namespace of the class is in autocomplete:
Another oddity is that the undefined class error disappears for some classes if the file with the defined class is opened.
It looks like the PHPStorm cache was somehow corrupted. I ended up invalidating the cache by going to File -> Invalidate Caches/Restart. This deleted my history but fixed the undefined class issue.
You must declare in use section nedded class or namespace. For example, if you need to use BaseController from custom\controllers namespace:
<?php
namespace frontend\components;
// Add this line
use common\controllers\BaseController;
class Controller extends BaseController {
}
I had to reset my PHPstorm to fix the issue of "Class not found".
File > Manage IDE Settings > Restore Default Settings...
Be carreful, it rests everything, but it also offers you to back up your current settings. After that, all has been hard reseted and it now works again.
Can be helpful sometimes.
Settings -> Directories
Remove folders from "Excluded"
I think you have some problems with composer autoload.
Try :
composer update
This was happening to me because of my PHP language settings. I found this out by taking out the namespace in one of my classes. The error changed to "Scalar types are only available in PHP 7".
Go to File -> Settings -> Language & Frameworks -> PHP. Change the PHP language level to language version 7 or greater.
Edit:
After doing that, Insert -> Getters and Setters was intermittently generating functions and comments as mixed instead of string. I don't know why this happened but I recreated all my fields manually and that fixed the issue.
I fiddled around with it for more than 8 hours without getting it resolved.
All I want is to call a ViewHelper in a Fluid template. I did that before and I never had a similar problem.
My ViewHelper file is located in
EXTDIR/VendorName/Classes/ViewHelpers/SomeViewHelper.php.
In my Fluid Template I use the namespace
{namespace k=VendorName\Extname\ViewHelpers}.
Somewhere in the template I call the ViewHelper with
{k:some()}.
The ViewHelper script "SomeViewHelper.php" contains the following code:
class SomeViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
public function initializeArguments() { }
public function render() {
return 7;
}
}
As you can see, the whole thing is quite simple and the expected output on the page should be "7". But calling a page in the frontend produces this error message:
Oops, an error occurred!
Could not analyse class:VendorName\Extname\ViewHelpers\SomeViewHelper maybe not loaded
or no autoloader?"
Any hints on what might be wrong here?
Cheers
Michael
If everything is spelled correct, and even after deleting System/Configuration Cache the ViewHelper doesn't come up (Could not analyse.. / maybe not loaded or no autoloader), try to reinstall the extension in extension manager!
Your path to the viewHelper source file is wrong.
The correct path should be (without vendorname):
EXTDIR/Classes/ViewHelpers/SomeViewHelper.php
You also need to make sure, you use the correct namespace for your viewHelper (if you're on TYPO3 6+, don't use the old Tx_ classes but namespaces).
<?php
namespace VendorName\Extname\ViewHelpers;
class SomeViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
public function initializeArguments() { }
public function render() {
return 7;
}
}
The error message seems to indicate that the class is not found.
Without more info, I would probably suspect a typo somewhere (pun not intended).
The following assumes you are using TYPO3 7 and not composer mode:
First, please check if your viewhelper class is autoloaded. This will help to narrow down the problem. On the command line in the htdocs directory: grep SomeViewHelper typo3temp/autoload/autoload_classmap.php This should give you a hit, if the ViewHelper class is included in the autoload file.
If the classes are not autoloaded, you might manually want to do the autoloading: On the command line in the htdocs directory: php typo3/cli_dispatch.phpsh extbase extension:dumpclassloadinginformation
For more information see: https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Autoloading/Index.html. For more in depth info see this: http://insight.helhum.io/post/130876393595/how-to-configure-class-loading-for-extensions-in You can find this functionality of autoloading in the install tool in TYPO3 8, so in that case you would not need to run the command on the command line.
If this does not work either, check the following:
Are you using namespace correctly in the class: <?php namespace VendorName\Extname\ViewHelpers\SomeViewHelper;
Is the path (including Camelcase class name) correct: /Classes/ViewHelpers/SomeViewHelper.php
After that, clear the system cache and reinitiate the autoloading as described above.
In order for the autoloading to be initiated automatically, you might have to update your ext_emconf.php (if you are not using composer mode) or composer.json (if you are using composer mode).
Just some questions:
Did you add the TypoScript Template of the Extension to the Static Includes?
If you're using a unix-alike system, are you sure that your webserver has the permission to read that files?
If TYPO3 is installed in composer mode and your extension is not installed via composer (e.g. a ProviderExtension of FluidTYPO3), you must provide autoload information for your extension in the main composer.json file, as described within TYPO3-composer-documentation:
In Composer Mode all class loading information must be provided by each of the installed extensions or the root package. If TYPO3 extensions are not installed by composer, e.g. because they are directly committed to the root package or a new package is kickstarted, class loading information needs to be provided, otherwise no classes can be loaded for these extensions/ packages.
E.g. if you have a site extension directly committed to your root package, you must include the class loading information in the root package like that:
Drove me crazy to get my ViewHelpers autoloaded. Providing the autoload-information within a composer.json or the ext_emconf.php of the extension and reinstalling it didn't do the trick.
I recently updated to SimpleCV 1.3. When I try to run examples I get the following:
objc[92210]: Class SDLTranslatorResponder is implemented in both /Library/Frameworks/SDL.framework/Versions/A/SDL and /usr/local/lib/libSDL-1.2.0.dylib. One of the two will be used. Which one is undefined.
objc[92210]: Class SDL_QuartzWindow is implemented in both /Library/Frameworks/SDL.framework/Versions/A/SDL and /usr/local/lib/libSDL-1.2.0.dylib. One of the two will be used. Which one is undefined.
objc[92210]: Class SDL_QuartzWindowDelegate is implemented in both /Library/Frameworks/SDL.framework/Versions/A/SDL and /usr/local/lib/libSDL-1.2.0.dylib. One of the two will be used. Which one is undefined.
objc[92210]: Class SDL_QuartzView is implemented in both /Library/Frameworks/SDL.framework/Versions/A/SDL and /usr/local/lib/libSDL-1.2.0.dylib. One of the two will be used. Which one is undefined.
WARNING: You need the python image library to save by filehandle
WARNING: You need the python image library to save by filehandle
WARNING: You need the python image library to save by filehandle
Considering this is related to the pygame installations before, when I remove the old pygame folders (There are few of them) I get the error: "ImportError: No module named pygame".
How can I get rid of this? This is something I must take care of until Tomorrow night.
ImportError means the correct folder isn't in your PYTHONPATH environment variable.
I have a couple of test files written in my DSL in my tests plugin/project. Most of the tests use inline multi-line strings and Xtend but in four cases, I need to test code which does some magic with URLs and the classpath, so I really need resources in the classpath for that.
Since loading the resources only works when the extension is correct, I can't give the files a fake extension.
Now my problem: My DSL also has a code generator. This means that eventually, I end up with a couple of generated files in places where I can't have them (they don't compile, for example, and one even contains an error to test error handling when information is split across several files).
I can't disable the Xtext nature because the tests project uses Xtend so for these files, I do need code generation.
Since the generator runs inside Eclipse (I have the DSL plugins installed for other projects), there is no way to override the code generator in Guice.
How can I disable the code generator in this case?
There is a simple way to achieve this:
Open the properties of your project
Expand the entry for your DSL
Select "Compiler"
Select "Enable project specific settings"
Disable/deselect "Compiler is activated" under "General"
If you don't have a properties entry for your DSL:
Add this fragment to your .mwe2 workflow file:
fragment = generator.GeneratorFragment {}
Regenerate your projects
Merge the new code from plugin.xml_gen into plugin.xml both in the base and the UI plugins.
The interesting parts are the two extension points org.eclipse.ui.preferencePages and org.eclipse.ui.propertyPages
Packaging a log4j configuration file in a NetBeans Platform application apparently requires some thinking through. This is what I tried...
I put log4j.xml in src/main/resources/my/package/log4j.xml of some_netbeans_module. The package is a public module package (i.e. classes from this package are used from other packages). I rebuilt the module and confirmed that the file does, in fact, get packaged into the module.
In my classes I get an instance of the logger the way I always do:
static final Logger log = Logger.getLogger(ThisClass.class);
Every NetBeans Platform application has a my_app.conf file which makes it possible to set certain properties. This is where I set log4j.conf:
log4j.configuration="/my/package/log4j.xml"
Now, when I run the application, I see the following output:
[INFO] /home/me/my_app/application/target/my_app/bin/../etc/my_app.conf: 5:
log4j.configuration=/my/package/log4j.xml: not found
What is wrong with the above configuration?
In the my_app.conf file if you append the log4j.configuration property to the default_options property, like so:
default_options="...<other options> -J-Dlog4j.configuration=my/package/log4j.xml"
then this option will get passed to the JVM. Notice that the log4j property has -J-D appended to it. The -J is used by NetBeans to delineate JVM properties and the -D is used by the JVM to delineate a system property.
Also you can/should drop the quotes and the initial / as the quotes are not necessary and NetBeans will complain if you have the initial /
The other way to do this, and the way that I prefer since it doesn't require editing the .conf file, is to put the log4j.xml file into the default package. If you have other requirements that prevents you from doing this then remember that you must put the log4j.configuration property in the app's platform.properties file while your in dev mode and running the app inside of the IDE. Like so:
run.args.extra=-J-Dlog4j.configuration=my/package/log4j.xml
Edit: For questions regarding NetBeans Platform you might have better luck posting to the NetBeans Platform Users forum.