As an example, when using the "extract variable" feature, the variable is declared "var" rather than "final", although the latter is what I usually end up assigning.
The "analysis_options.yaml" file seems to know a linter flag "prefer_final_locals" (and prefer_final_fields).
Is there a way to make the IDE make use of these?
The analysis_options.yaml located in the flutter installation directory is NOT used by IDEA as default. In order for these configurations to be applied, the file has to be copied to the root of a dart/flutter project (so, next to the pubspec.yaml). The mentioned flags regarding finals and much more then get applied without any further action required.
Related
I use clion for quite a while now and in the past there was a dedicated window which shows all cmake variables/options for the current projet. Here you could see and change all variables/options. It was very convenient. I guess they changed this now and you have to open the CMakeCache.txt file and change the options in this file. But this file is so big it is very annoying to search for the option you want to change. It is even more annoying when you don't know the exact name of the option. So, my feeling is, there should be better way to list at least all options. So, is there a better way or do I have to go through the hassle and search for the options in the CMakeCache.txt?
As mentioned by #Maxim Banaev in the comments, there is a feature request on youtrack. Quoting from the discussion thread:
we hope to deliver this feature this year. Hopefully, in 2022.2 release
We've added the editor to CMake settings in EAP3 link and more updates for it are yet to come in EAP4 and EAP5.
See the interactive dialog applications that come bundled with CMake, ccmake (a curses-based terminal gui), and cmake-gui (a gui application). Both provide user-friendly interfaces to edit the CMake cache variables, including appropriate GUI inputs based on the cache variable's type (string, bool, path, filepath, etc.), and enable hide/show of variables that are marked as being for advanced usage scenarios. They also provide the option to group options by common prefixes of cache variable names and to visually expand and collapse those groups.
This is the first time that I'm giving a chance to IntelliJ, and to be honest it's not going quite well...
I have imported my Eclipse subprojects. They use external .jar dependencies and they are specified as with a variable, ie: $EXTERNAL_LIBS/derby.jar
When I have imported my projects, IntelliJ recognize the variable and ask me to give it a value, which I misspointed to a wrong path. Now I see on the subproject properties all the module dependencies pointing to a wrong path.
I go to File - Settings and change the value of my EXTERNAL_LIBS to the right path, but all the current dependencies doesn't seem to reflect the change. They still pointing to the first and wrong path.
Am I suppose to go one by one? I do not understand how IntelliJ manages Path Variables... When I try to add a new module dependency it forces me to choose it from the hard drive, and doesn't give the change to use any of these variables.... The documentation is quite poor as well....
Path variables can be changed in File | Settings | Path Variables.
They are handled transparently by the IDE on project load and on project save.
When project loads and contains path variables, IDE will substitute them with the actual paths defined in Settings. If no path variable is defined yet, IDE will ask you to define it.
When the project files are saved on disk, IDE will transparently and silently replace all the paths matching defined variables with the variable name.
It works fully automatically and user doesn't have to define variables explicitly in any IDE settings, just use the actual paths in your libraries, they will be replaced with the corresponding variables on project save so that your project files are portable and other users can define different values for the path variables when opening this project for the first time.
I would like to add into project some files that shouldn't be compiled. I mean mainly text files with for example notes, concepts, comments etc.
I realized that it is possible only at module level. But it is not very convenient. I'd rather prefer to keep them on project level. Is it possible in any way?
And if not:
I have another idea: to create special module, name it for example "other_stuff", do not create src directory and put files there. Is it ok? I'm afraid of potential compilation problems when one of modules is artificial, with no sources but still has sdk assigned (it is probably impossible to leave module without sdk assigned).
While generating artifacts you can add any file into your artifact. Also, in modules you can have folders not declared as source, and they will not be compiled.
I'm working with gendarme for .net called by Sonar (launched by Jenkins).
I've a lot of AvoidVisibleFieldsRule violations. The main violations are found in the generated files. As I can't do anything on it, i would like to exclude *.designer.cs from the scan.
I can't find a way to do that. There is a properties in Sonar to exclude generated files but it doesn't seem to be applied for gendarme.
Is there a way to do such a thing ?
Thanks for all
Gendarme expects you provide an ignore list,
http://www.mono-project.com/Gendarme.FAQ
https://github.com/mono/mono-tools/blob/master/gendarme/self-test.ignore
The ignore file format is bit of weird, but you can learn it by experiments.
Indeed that is actually not normal at all. Generated code is excluded by the plugin with the standard configuration. What version of the C# plugins are you using ?
Anyway, the configuration property you can try is "sonar.exclusions" (see http://docs.codehaus.org/display/SONAR/Advanced+parameters).
If you do not solve your problem right away, the best thing would be to drop a mail to the user mailing list (see http://www.sonarsource.org/support/support/) and send the verbose output of your build. To get this output simply add "-X" to the command line.
Hope it helps
I've been using Checkstyle with Eclipse, with a rule for making all local variables final. This rule is enforced when saving, so if a file containing a local variable without a final modifier is saved, final is automatically added to the variable declaration.
Now I've switched to IntelliJ IDEA, and i'm using Checkstyle to enforce this same rule here. But, instead of automatically adding the final modifier when saving, the variables are marked as erroneous, and I have to press ALT+enter enter to get the final modifier added, once for each variable. This is quite impractical, as I am doing further development on a quite large code base, where no variables have been marked as final.
Is there a way to set up Checkstyle with IDEA, in order to get it to add the final modifier to local variables automatically upon saving, as it does with Eclipse?
There is a way to avoid having to make each and every variable final.
Just alt+enter on one, then right-arrow and select "Fix all 'Local variable..".
Will fix all finals in the file.
It also works for other checks, have found it useful after migrating to Java7, to change to the diamond-format when instantiating parameterized objects.
Most likely it's not supported. You should submit a feature request to Checkstyle team.