Reputation: 63221
The Spark code style requires four character indentation for multi parameter methods. So: the following code -as presently formatted by IJ - is incorrect:
def generateCirclesRdd(sc: SparkContext,
nCircles: Int = 3,
nTotalPoints: Int = 30,
outerRadius: Double): RDD[(Long, Long, Double)] = {
It should apparently be:
def generateCirclesRdd(sc: SparkContext,
nCircles: Int = 3,
nTotalPoints: Int = 30,
outerRadius: Double): RDD[(Long, Long, Double)] = {
Where is this setting in the IJ code style? Screenshot shows what I was able to find.
UPDATE There is a comment about "Tabs and Indents" here it is :
Another Update: @yole has provided a helpful answer. However, I am still left with 2 spaces instead of 4 on the continuation.
For reference, here is the correct/required indentation within Spark. Notice the continuation on method declarations is 4 spaces.
def train(
data: RDD[Vector],
k: Int,
maxIterations: Int,
runs: Int,
initializationMode: String,
seed: Long): KMeansModel = {
However the continuation on method invocations is only two:
new KMeans().setK(k)
.setMaxIterations(maxIterations)
.setRuns(runs)
.setInitializationMode(initializationMode)
.setSeed(seed)
.run(data)
Upvotes: 34
Views: 18209
Reputation: 702
This is that worked for me:
Upvotes: 1
Reputation: 3367
There is two option that you have to change
Upvotes: 21
Reputation: 91
In 2017, Check all the Settings/Editor/CodeStyle/Java/Wrapping and Braces options, where the line name is Allign when multiline. For me, it was checked at Chained Method calls, and that made these long indents. Just uncheck them.
Upvotes: 6
Reputation: 31
enable "other | Alternate indentation for constructor args and parameter declarations with 4 spaces" help me out finally
Upvotes: 3
Reputation: 97308
Uncheck "Method declaration parameters | Align when multiline" and enable "Use normal indent for parameters".
Upvotes: 37