Skip to content

scalariform should be idempotent #62

@paulp

Description

@paulp

It is useful to have a canonical source representation; it is less useful if the program does not generate it on the first try. I have to run scalariform two additional times on scala trunk before it reaches a fixpoint. It seems the issue is limited to the handling of scaladoc comments; with it so close, it seems a shame not to take it all the way.

These are my settings:

java -jar $JAR \
  -s=2.10.0 \
  +alignSingleLineCaseStatements \
  +alignParameters \
  +compactControlReadability \
  +doubleIndentClassDeclaration \
  +multilineScaladocCommentsStartOnFirstLine \
  +spacesWithinPatternBinders \
  +formatXml \
  -alignSingleLineCaseStatements.maxArrowIndent=40 \
  -indentSpaces=2 \
  -r src

Here is the essence of the diff after the first iteration:

-/**   Used as the timeout pattern in
+/**  Used as the timeout pattern in
-  /**
-   *  A full type-flow analysis on a method computes in- and out-flows for each basic block (that's what MethodTFA does).
+  /** A full type-flow analysis on a method computes in- and out-flows for each basic block (that's what MethodTFA does).
-    /**
-     *  This method is invoked after one or more inlinings have been performed in basic blocks whose in-flow is non-bottom (this makes a difference later).
+    /** This method is invoked after one or more inlinings have been performed in basic blocks whose in-flow is non-bottom (this makes a difference later).
-/**
- *  @author Stephane Micheloud
+/** @author Stephane Micheloud
-/**
- *  @author Stephane Micheloud
+/** @author Stephane Micheloud
-/**  A collection of implicit conversions supporting interoperability between
+/** A collection of implicit conversions supporting interoperability between
-  /**  The erasure |T| of a type T. This is:
+  /** The erasure |T| of a type T. This is:
-/**
- *  SourceFile_attribute {
+/** SourceFile_attribute {

And the second.

-/**  Used as the timeout pattern in
+/** Used as the timeout pattern in

Ah, the second makes me realize what at least part of the problem is. If I add a little whitespace, we see this revealing diff on what would be the next iteration of many.

-/**                     Used as the timeout pattern in
+/**                    Used as the timeout pattern in

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions