I am using IntelliJ IDEA version 2017.3, then I install plug-in CheckStyle-IDEA v 5.16.0 successful, I install Apache Maven Checkstyle Plugin to run myCheckFile.xml. At install phase, I received many check style error like:
Indentation: '.' has incorrect indentation level 6, expected level should be 8.
Indentation: 'new' has incorrect indentation level 6, expected level should be 8.
After importing CheckStyle settings, I expect when I hit Ctrl+Alt+L inside IntelliJ IDEA all check style error will die but that doesn't happen, is there's something i'm missing ?
You might have a .editorconfig file which is taking precedence. I ran into the same problem and my solution was to comment out the .editorconfig file. Our team is using JHipster, which automatically generates a .editorconfig file. This generally has just a few key settings, including indent_size=4. I was experimenting with Google's checkstyle xml settings and saw the same overall issue you were seeing, where the checkstyle plugin was indicating the indentation was wrong, but the code/reformat option wasn't fixing it.
TL;DR - see if you have a .editorconfig file and if so delete it or comment out the conflicting styles.
Related
I am getting a warning about the usage of deprecated features in my build.
Is there a way to list all the deprecated features so that I may go through and update my code?
*clarification
I know I can go to the Gradle documentation and see what is now deprecated, what I would specifically like is a way to go through MY code and list MY deprecated features.
I just faced the exact same problem and running the Gradle build task every time through the command line wasn't the best option for me because, during development, I usually just use the built-in Gradle build task run, so:
I know I can go to the Gradle documentation and see what is now deprecated, what I would specifically like is a way to go through MY code and list out MY deprecated features.
You can do this by adding the mentioned --warning-mode=all flag to your gradle command line options in your Android Studio settings:
This will print the proper warnings for you to be aware of what are the specific deprecated features your app is using.
Also, I know you asked this near a year ago, but, it might be useful for other people facing the same issue.
In order to change the warning verbosity level in the Android Studio IDE, you can add the option org.gradle.warning.mode=(all,none,summary) to the gradle.properties file, which can be found in the root directory of your project.
Add following line to set the warning mode to all:
...
org.gradle.warning.mode=all
...
Use Gradle option -Dorg.gradle.warning.mode=(all,none,summary) to control verbosity, for example, mode all will log all warnings with detailed descriptions:
./gradlew build -Dorg.gradle.warning.mode=all
More details can be found in the official documentation: Showing or hiding warnings
Go to the build.Gradle (Module) file.
replace Compile with implementation.
Sync the gradle file and you will not receive the warning again.
I am developing a Java application and Using SonarLint to test the code quality.
Sonar shows the error : Take the required action to fix the issue indicated by this comment.
For below line of code:
// FIXME: temp here until we drop tomee or remove all exceptions from ejb <-> non-ejb path.
Is there any way I can suppress the warning in SonarLint ?
You can use the connected mode to bind your project in the IDE to a project in SonarQube. SonarLint will use the same code analyzers and rules as the ones in SonarQube.
In SonarQube, it's possible to change the quality profile assigned to projects and in this way, to enable or disable rules.
More information: https://www.sonarlint.org/intellij/howto.html
I checked several places and tried many things to suppress the warnings, but turns out that //FIXME are considered as major warnings in Sonar . You need to take care of them by removing the tag and fixing the issue which was mentioned in the tag (by the developer of tag).
Or you can simply remove the tag if that issue is not needed to be fixed or that is itself not an issue now.
I've recently implemented the maven Check style plugging into my project and have changed all of the formater Settings in intellij (Which I use) to conform to this style guide (which they now do).
However I need to produce a settings .xml file for eclipse, so that my colleagues can automatically format there code so that it also conforms to this style guide.
The problem I am finding is that I cannot see a way of exporting the settings from intellij and importing them into eclipse. and I cannot manually configure eclipse to conform with the nuances of the new style guide (Continuation indentation being the main problem).
Any help or Ideas would be fantastic. :)
I couldn't find a ready plugin for that in 2018. So here is a side by side code style configuration from UI perspective of Intellij IDEA 2017.3 and Eclipse OXYGEN.3 March 2018. If both configured this way the code will be formatted close enough, so for example github will show you code differences so that it make sense.
For our project we configured one XML for each IDE so they more or less match:
IntelliJ Config File is default of IDEA 2017.3 so not much to define in XML - enter link description here
Eclipse Config is modified a bit from the default to match IntelliJ - link
Here is also a PDF file to show all the options set in both IDEs side by side - link
There is also a project to solve this problem across more IDEs(Answer) : EditorConfig
There is a EditorConfig - independent format for editors/IDEs code style configuration.
There are EditorConfig plugins for most popular editors(see full list here).
You can see examples for IntelliJ IDEA(tutorial) and Eclipse(plugin page).
You can export settings in Intellij by clicking on File > Export Settings but they will be in .jar format.
According to this thread there is no easy way of importing settings.jar into eclipse.
Eclipse - import code format settings
I hope this helps :)
The exact data from JetBrains is here. Check out the Link
Hit like if this helps.
I've installed 30 day trial of IntelliJ 15.0.2 and cloned my project using git (I've created this project in community version). Project compiles (maven), runs, works. But new IntelliJ does not underline my errors, misspellings etc. When I wanted to commit, IntelliJ shows big number of errors, mostly on imports, as it can't resolve them. All dependencies are inside pom.xml. Once again, there were no errors in community version of IntelliJ. Ultimate version builds project just fine, but doesn't underline any errors and shows almost every import as unsolvable. What could go wrong? How to fix it?
Go to Build -> Make Project. After that errors should be visible in the project tree and in the specific project files.
You may need to mark the source dir, by right-clicking it on the project tab and select mark directory as -> source root
Check that you have a correct project sdk set in modules configuration. If IJ doesn't found any classes, jdk classes included, probably there is no sdk set.
You can also try to invalidate caches (in File menu) and rebuild project
I have faced with strange behaviour of Intelij Idea after update (syntax highlight stopped working). If you want to understand what is going on with yor Idea and can not quickly find an answer in internet, just go to Log files (for Mac OS the path is
~/Library/Logs/IntelliJIdea< your version>
List all files in that directory
ls -la
in terminal and find the latest one. Usually it should be idea.log (without numbers, logs with numbers identify logs for previous days). View that log. If that log contains a lot of ERRORS, try to find the reason (you can just type
grep "ERROR" idea.log
in terminal to find all lines that contain errors). Usually log files shouldn't contain errors, just info and warnings.
In my case syntax highlight stopped working. The log looked like
You can see here that error is in plugins that called like haxe.
I found that plugin in my idea, uninstalled it and idea started working properly. I investigated the log after and what I have seen there:
You can see just INFO in new rows.
Investigating a log can be really useful if you can not find the rootcase of your problem quickly in the internet. I hope it can help you even if it can be quite tricky.
Good luck!
I have configured check style plugin in eclipse juno.
I have a following snippet in my code:
articleView.setResponseType("HTML");
articleView.setImageFilePrefix(imageURL);
articleView.setUrlIndicator("Y");
In above code , I want to make checkstyle plugin to check is there any hard coded values or not like "HTML"
I am using built in sun check style xml file.
I have used following check style plugin version for eclipse juno :
"net.sf.eclipsecs-updatesite_6.4.0.201503042206-bin.zip"
How can I make my check style plugin to check is there any hard code values or not mean to say is there, any rule which we can define in check style xml fiel to check hard coded values for string.
Can any one help me out.
Thanks in advance.
Naresh.
How about this? I've copied and modified the existing sun checkstyle configuration and made it default.
Eclipse can do this without check style.
In the Preferences look at 'Java > Compiler > Errors/Warnings'. In the 'Code style' section change 'Non-externalized strings' to Warning or Error.