35 questions
-3
votes
1
answer
130
views
How to exclude a directory from google-java-format via Git pre-commit hook?
.pre-commit-hooks.yaml is like below:
- id: google-style-java
name: Google Java Code Style for Java
description: Formats code in Google's Java codestyle.
entry: ./format-code.sh
...
1
vote
0
answers
356
views
Can spotless be isolated from the application's configuration in gradle?
I have added spotless google-java-format to an existing project, and a pinned version of guava is causing conflicts.
I have reproduced the problem in a toy example. Here is the full project if you ...
0
votes
1
answer
197
views
How do update Spring Boot build.gradle to ensure every developer on team is using google-java-format and some general questions
I added the following dependency to the build.gradle file in my branch.
dependencies {
implementation 'com.google.googlejavaformat:google-java-format:1.24.0'
}
From here, I am confused. How can I ...
2
votes
0
answers
631
views
Spotless and java-code-format don't apply No Wildcard Import
The java code format suggest that star/wildcard imports are not tolerated.
Without the help of the IDE, neither the java-code-format nor spotless can enforce this.
Is there any success case out there?
...
0
votes
0
answers
412
views
How Can I Use Google JavaFormat with Java 17 in Maven Plugin Project
A few years ago I created a maven plugin project which takes a given input and generates a series of Java source files which are formatted upon output using the google-java-format library. I'm trying ...
1
vote
1
answer
802
views
Common import's order for IntelliJ and Eclipse using google-java-format
In our team we're using IntelliJ and Eclipse. As formatter we're plugins for Eclipse and IntelliJ from v1.18.1 of https://github.com/google/google-java-format
We set the same imports layouts for both ...
1
vote
0
answers
50
views
Create GCP tags and attach it to VM using google sdk client library
Need help with google client lib for creating tags and attach to VM
InstanceTagDetails instanceTagDetails = new InstanceTagDetails();
instanceTagDetails.setKey("tagKeys/...
1
vote
0
answers
1k
views
How to get similar google java formatting in intellij and with maven
I'd like to have the google java formatting in my IDE (using the google-java-format plugin for IntelliJ or something else if that's not the best way to do...) and be able to check with maven that ...
1
vote
1
answer
6k
views
google-java-format IntelliJ IDEA not formatting (Java 19)
I have OpenJDK 19 installed and use the "google-java-format" plugin. I have configured IntelliJ IDEA as per instructions here. However, code formatting doesn't work.
If I uninstall the ...
0
votes
1
answer
554
views
Add Eclipse plugin via dropins on MacOS
I used to add a google-java-format plugin in Eclipse via drop an e.g. google-java-format-eclipse-plugin-1.13.0.jar into a dropins folder. On Windows and Linux it always worked.
But on MacOS 12.6 it ...
0
votes
1
answer
727
views
format openapi/swagger generated java source using maven plugin
I've openapi plugin to autogenerate some java source code using mustache files as template.
I wish to format this code using google java style. I followed example at this link:
https://shankulk.com/...
5
votes
1
answer
4k
views
How can I use the googleJavaFormat to make reflowLongStrings set to a max of 120 chars per line
I am using the Spotless plugin to format my Java code. However, when I am enabling the reflowLongStrings rule, it breaks lines to be no longer than 80 chars.
Is it possible to change it to 120?
3
votes
1
answer
2k
views
What is the exact Google Java Format version used by CheckStyle 9.3?
I use Checkstyle 9.3 (because I'm still using JDK 8). I'm wondering what is the exact Google Java Format version used by that Checkstyle version? I'm referring to the following file:
https://github....
10
votes
1
answer
9k
views
Spotless + Java Google format vs Intellij + import file
I am trying to configure a maven spring boot application to use spotless with google java format style. I would like as well to have Intellij formatting the code as the maven plugin does.
But i am ...
4
votes
3
answers
4k
views
google-java-format: format whole project
I'm using google-java-format to format Java code according to Google Java Style. However, I only find documentation and examples showing how to format one file using the CLI.
Is there a built-in way ...
0
votes
2
answers
2k
views
Import google-java-format from Eclipse to VSCode
I have an archive plugin for Eclipse that contains an personalized google-java-format implementation, I want to import this to VSCode editor, is it possible to this?I found how to do this with xml ...
12
votes
0
answers
2k
views
Use of checkstyle.xml in diffplug/spotless
I have a checkstyle.xml file to check for formatting violations . Is there any way to provide checkstyle.xml as a input to diffplug/spotless formatter . Java8 is being used and spotless verison is 2....
4
votes
3
answers
6k
views
Eclipse Plugin --add-exports Java 16+
Using the google-java-format eclipse plugin works great when running Eclipse under Java 11, but when running on Java 16+, it fails with the following error:
Full error: A save participant caused ...
2
votes
0
answers
716
views
Java formatting: Disable line joining?
I have the following code:
Arrays.asList(new Point2D.Double(1.00, 3.028571712152178),
new Point2D.Double(2.00, 4.5990231472038055),
new Point2D.Double(3.00, 4.816365844337747),
new ...
0
votes
0
answers
562
views
Code style formatting without google-java-format plugin
Please tell me how to use code style formatting in IDEA?
I used the google-java-format plugin and it works very well for me.
An example of my code using the google-java-format plugin:
public Single<...
3
votes
2
answers
13k
views
Maven spotless can't skip files
I'm using maven spotless plugin to format java files, but it can't skip files. I used exclude and toggle off, neither works.
<plugin>
<groupId>com.diffplug.spotless</groupId>
<...
0
votes
1
answer
2k
views
Disable auto line breaking in Java Formatter - VSCODE [duplicate]
I need to disable this auto line break my code in Java VS CODE Formatter
It's wrong
Expected:
7
votes
1
answer
3k
views
Maven Checkstyle plugin with google_checks and 4 space indentSize
I am finding out ways to configure google_checks to use 4 spaces in the maven Checkstyle plugin. I set the indentSize configuration parameter to 4, but it does not work. Is there a configuration ...
1
vote
1
answer
4k
views
Google -java-format Code formatter for java Intellij
I installed google-java-format in Intellij and made sure its enabled for current project. However its still not working, CTRL+ALT+L, which is by default in Intellij is still working.
Also, does this ...
6
votes
1
answer
14k
views
How can I configure Gradle google-java-format plugin to run goJF in the build step?
We wired https://github.com/sherter/google-java-format-gradle-plugin into our project per the readme.
We also wired in a pre-commit hook to run the plugin before committing, which ensures that all of ...
-1
votes
1
answer
2k
views
Google Sheets JavaScript - TypeError: Cannot read property 'getSheetName' of undefined
I've got an identical script running on three google sheets, it works just fine on two of them, but on one it just won't generate, keeps throwing me the below error:
TypeError: Cannot read property '...
4
votes
2
answers
4k
views
Google code style formats maven pom strange in Intellij
I use the Google code style in my Java projects. I installed the google-java-format plugin in IntelliJ, but the plugin does not cover all formatting rules (e.g java imports). The documentation ...
1
vote
1
answer
871
views
Google Java Format unable to read file while formatting
I've added an ant task to format sources before compilation.
However, the formatter comes up a cropper when provided a list of file paths and skips (is unable to read) a file when run as a java Ant ...
4
votes
0
answers
1k
views
Eclipse Cursor Position Stays at Line Beginning
I'm wondering if the following behavior of the Eclipse formatter is a bug or not, and if so, if there is any workaround.
After I click return and create a new line, I can see Eclipse has ...
3
votes
1
answer
6k
views
where is eclipse dropins folder
i just downloaded eclipse 2019-03 (4.11.0), and need to install google-java-format plugin, according to the instruction I need to put the google-java-format Eclipse plugin to eclipse dropins folder, i ...
0
votes
2
answers
5k
views
Google java format in IntelliJ IDEA
I am using the Google-java-formatter in IntelliJ IDEA.
I tried all the option present under setting > editor > code Style > java but not able to change this behavior.
private void ...
0
votes
1
answer
377
views
Sherter Gradle plugin for pre-commit
I am trying to add sherter gradle plugin for code style. I want to run this plugin in pre-commit script file.
I added sherter in gradle as,
repositories {
jcenter()
maven { url "https://...
0
votes
0
answers
156
views
Groovy and Java code parsing which are embedded inside a xml tag
I have a xml file which has Java and groovy codes in some tags and I need to format the code, I am able to format xml but not java and groovy code inside xml tags.
Ex:
Input:
<?xml version="1....
1
vote
2
answers
2k
views
How can I automatically run google-java-format as part of my Gradle build?
Google-java-format-gradle-plugin integrates with Gradle, but how can I run it automatically as part of the normal build?
2
votes
1
answer
2k
views
google-java-format dependency syncing but not getting build.
I have added mavenCentral() in rootProject build script. But its giving below error while build. Any idea on this.
You probably need to add a repository containing the '[com.google.googlejavaformat:...