Skip to content

Commit 896bae7

Browse files
author
Dominik Helm
authored
Merge pull request #187 from opalj/feature/scalariformRemovalPreparation
Scalafmt introduction post work
2 parents 34bbd74 + 7f21e49 commit 896bae7

File tree

399 files changed

+2330
-2372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

399 files changed

+2330
-2372
lines changed

.scalafmt.conf

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ docstrings {
1212
indent {
1313
main = 4
1414
callSite = 4
15-
ctorSite = 8 # Double Indent
1615
}
1716
indentOperator.exemptScope = aloneEnclosed
1817

DEVELOPING_OPAL/demos/src/main/scala/org/opalj/ai/ExceptionUsage.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ object ExceptionUsage extends ProjectAnalysisApplication {
145145
}
146146

147147
case class ExceptionUsage(
148-
method: Method,
149-
definitionSite: PC,
150-
exceptionType: String,
151-
usageInformation: scala.collection.Set[UsageKind.Value]
148+
method: Method,
149+
definitionSite: PC,
150+
exceptionType: String,
151+
usageInformation: scala.collection.Set[UsageKind.Value]
152152
) extends scala.math.Ordered[ExceptionUsage] {
153153

154154
override def toString: String = {

DEVELOPING_OPAL/demos/src/main/scala/org/opalj/ai/domain/l1/MethodReturnValuesAnalysis.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ import scala.collection.parallel.CollectionConverters.IterableIsParallelizable
3030
object MethodReturnValuesAnalysis extends ProjectAnalysisApplication {
3131

3232
class AnalysisDomain(
33-
override val project: Project[java.net.URL],
34-
val ai: InterruptableAI[_],
35-
val method: Method
33+
override val project: Project[java.net.URL],
34+
val ai: InterruptableAI[_],
35+
val method: Method
3636
) extends CorrelationalDomain
3737
with domain.DefaultSpecialDomainValuesBinding
3838
with domain.ThrowAllPotentialExceptionsConfiguration

DEVELOPING_OPAL/demos/src/main/scala/org/opalj/ai/tutorial/base/IdentifyResourcesAnalysis.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ object IdentifyResourcesAnalysis extends ProjectAnalysisApplication {
5858
// Perform a simple abstract interpretation to check if there is some
5959
// method that passes a constant string to a method.
6060
class AnalysisDomain(
61-
override val project: Project[URL],
62-
val method: Method
61+
override val project: Project[URL],
62+
val method: Method
6363
) extends CorrelationalDomain
6464
with domain.TheProject
6565
with domain.TheMethod

DEVELOPING_OPAL/demos/src/main/scala/org/opalj/ai/tutorial/ex1/IdentifyResourcesAnalysis.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import scala.collection.parallel.CollectionConverters.IterableIsParallelizable
2424
object IdentifyResourcesAnalysis extends ProjectAnalysisApplication {
2525

2626
class AnalysisDomain(
27-
override val project: Project[URL],
28-
val method: Method
27+
override val project: Project[URL],
28+
val method: Method
2929
) extends CorrelationalDomain
3030
with domain.DefaultSpecialDomainValuesBinding
3131
with domain.ThrowAllPotentialExceptionsConfiguration

DEVELOPING_OPAL/tools/src/main/scala/org/opalj/support/debug/XHTMLTracer.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ import org.opalj.collection.mutable.IntArrayStack
2424
import org.opalj.io.writeAndOpen
2525

2626
case class FlowEntity(
27-
pc: Int,
28-
instruction: Instruction,
29-
operands: Operands[_ >: Null <: Domain#DomainValue],
30-
locals: Locals[_ >: Null <: Domain#DomainValue],
31-
properties: Option[String]
27+
pc: Int,
28+
instruction: Instruction,
29+
operands: Operands[_ >: Null <: Domain#DomainValue],
30+
locals: Locals[_ >: Null <: Domain#DomainValue],
31+
properties: Option[String]
3232
) {
3333
val flowId = FlowEntity.nextFlowId
3434
}

DEVELOPING_OPAL/validate/src/test/scala/org/opalj/fpcf/PropertiesTest.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ abstract class PropertiesTest extends AnyFunSpec with Matchers {
418418
}
419419

420420
case class TestContext(
421-
project: Project[URL],
422-
propertyStore: PropertyStore,
423-
analyses: List[FPCFAnalysis]
421+
project: Project[URL],
422+
propertyStore: PropertyStore,
423+
analyses: List[FPCFAnalysis]
424424
)

DEVELOPING_OPAL/validate/src/test/scala/org/opalj/fpcf/properties/allocation_freeness/AllocationFreenessMatcher.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import org.opalj.br.fpcf.properties.AllocationFreeness
1616
* @author Dominik Helm
1717
*/
1818
sealed abstract class AllocationFreenessMatcher(
19-
val property: AllocationFreeness
19+
val property: AllocationFreeness
2020
) extends AbstractPropertyMatcher {
2121

2222
def validateProperty(

DEVELOPING_OPAL/validate/src/test/scala/org/opalj/fpcf/properties/compile_time_constancy/CompileTimeConstancyMatcher.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import org.opalj.br.fpcf.properties.CompileTimeVaryingField
1717
* @author Dominik Helm
1818
*/
1919
sealed abstract class CompileTimeConstancyMatcher(
20-
val property: CompileTimeConstancy
20+
val property: CompileTimeConstancy
2121
) extends AbstractPropertyMatcher {
2222

2323
def validateProperty(

DEVELOPING_OPAL/validate/src/test/scala/org/opalj/fpcf/properties/escape/EscapePropertyMatcher.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import org.opalj.tac.common.DefinitionSite
2323
* @author Florian Kuebler
2424
*/
2525
abstract class EscapePropertyMatcher(
26-
val property: EscapeProperty
26+
val property: EscapeProperty
2727
) extends AbstractPropertyMatcher {
2828

2929
override def isRelevant(

DEVELOPING_OPAL/validate/src/test/scala/org/opalj/fpcf/properties/immutability/types/TypeImmutabilityMatcher.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import org.opalj.fpcf.Property
1616
import org.opalj.fpcf.properties.AbstractPropertyMatcher
1717

1818
class TypeImmutabilityMatcher(
19-
val property: TypeImmutability
19+
val property: TypeImmutability
2020
) extends AbstractPropertyMatcher {
2121

2222
import org.opalj.br.analyses.SomeProject

Eclipse Java Formatter Preferences.xml

+380-291
Large diffs are not rendered by default.

IntelliJ Java and Scala Formatter Preferences.xml

+52-28
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<code_scheme name="Java Conventions [maximum line width 100]" version="173">
2-
<option name="RIGHT_MARGIN" value="100" />
1+
<code_scheme name="Project" version="173">
2+
<option name="RIGHT_MARGIN" value="120" />
33
<option name="FORMATTER_TAGS_ENABLED" value="true" />
4+
<option name="SOFT_MARGINS" value="120" />
45
<JavaCodeStyleSettings>
56
<option name="ANNOTATION_PARAMETER_WRAP" value="1" />
67
</JavaCodeStyleSettings>
78
<ScalaCodeStyleSettings>
8-
<option name="classCountToUseImportOnDemand" value="32" />
9+
<option name="classCountToUseImportOnDemand" value="60" />
910
<option name="collectImports" value="false" />
1011
<option name="doNotChangeLocalImportsOnOptimize" value="false" />
1112
<option name="importLayout">
@@ -15,27 +16,19 @@
1516
<option value="scala.reflect" />
1617
<option value="_______ blank line _______" />
1718
<option value="java" />
18-
<option value="_______ blank line _______" />
1919
<option value="scala" />
20+
<option value="play" />
2021
<option value="_______ blank line _______" />
21-
<option value="all other imports" />
22+
<option value="org.junit" />
23+
<option value="org.scalacheck" />
24+
<option value="org.scalatest" />
25+
<option value="org.scalatestplus" />
26+
<option value="_______ blank line _______" />
27+
<option value="com.typesafe.config" />
28+
<option value="_______ blank line _______" />
29+
<option value="org.opalj" />
2230
<option value="_______ blank line _______" />
23-
<option value="org.opalj.log" />
24-
<option value="org.opalj.util" />
25-
<option value="org.opalj.collection" />
26-
<option value="org.opalj.concurrent" />
27-
<option value="org.opalj.fpcf" />
28-
<option value="org.opalj.bytecode" />
29-
<option value="org.opalj.value" />
30-
<option value="org.opalj.bi" />
31-
<option value="org.opalj.da" />
32-
<option value="org.opalj.br" />
33-
<option value="org.opalj.bc" />
34-
<option value="org.opalj.ba" />
35-
<option value="org.opalj.ai" />
36-
<option value="org.opalj.tac" />
37-
<option value="org.opalj.de" />
38-
<option value="org.opalj.av" />
31+
<option value="all other imports" />
3932
</array>
4033
</option>
4134
<option name="importShortestPathForAmbiguousReferences" value="false" />
@@ -87,18 +80,35 @@
8780
<option value="scala.reflect.macros.whitebox.Context" />
8881
</array>
8982
</option>
90-
<option name="sortAsScalastyle" value="true" />
91-
<option name="USE_SCALADOC2_FORMATTING" value="false" />
83+
<option name="WRAP_BEFORE_WITH_KEYWORD" value="true" />
84+
<option name="PLACE_SELF_TYPE_ON_NEW_LINE" value="false" />
85+
<option name="ALIGN_EXTENDS_WITH" value="3" />
86+
<option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" />
87+
<option name="ALIGN_COMPOSITE_PATTERN" value="false" />
88+
<option name="INDENT_FIRST_PARAMETER" value="false" />
89+
<option name="SCALAFMT_CONFIG_PATH" value="/home/dominik/Work/opal/.scalafmt.conf" />
90+
<option name="SCALAFMT_REFORMAT_ON_FILES_SAVE" value="true" />
91+
<option name="FORMATTER" value="1" />
92+
<option name="SPACE_AFTER_MODIFIERS_CONSTRUCTOR" value="true" />
93+
<option name="SPACES_IN_ONE_LINE_BLOCKS" value="true" />
94+
<option name="SPACES_AROUND_AT_IN_PATTERNS" value="true" />
95+
<option name="ALIGN_PARAMETER_TYPES_IN_MULTILINE_DECLARATIONS" value="2" />
96+
<option name="SPACE_BEFORE_TYPE_PARAMETER_LEADING_CONTEXT_BOUND_COLON_HK" value="false" />
97+
<option name="CALL_PARAMETERS_NEW_LINE_AFTER_LPAREN" value="2" />
98+
<option name="MULTILINE_STRING_ALIGN_DANGLING_CLOSING_QUOTES" value="true" />
9299
<option name="TYPE_ANNOTATION_EXCLUDE_MEMBER_OF_ANONYMOUS_CLASS" value="true" />
93100
<option name="TYPE_ANNOTATION_EXCLUDE_MEMBER_OF_PRIVATE_CLASS" value="true" />
94101
<option name="SD_BLANK_LINE_AFTER_PARAMETERS_COMMENTS" value="true" />
95102
<option name="SD_BLANK_LINE_AFTER_RETURN_COMMENTS" value="true" />
103+
<option name="SD_BLANK_LINE_BEFORE_PARAMETERS" value="true" />
96104
<option name="SD_KEEP_BLANK_LINES_BETWEEN_TAGS" value="true" />
97105
<option name="SD_PRESERVE_SPACES_IN_TAGS" value="true" />
98-
<!-- Unicode arrows are not supported anymore since Scala 2.13 -->
99-
<option name="REPLACE_CASE_ARROW_WITH_UNICODE_CHAR" value="false" />
100-
<option name="REPLACE_MAP_ARROW_WITH_UNICODE_CHAR" value="false" />
101-
<option name="REPLACE_FOR_GENERATOR_ARROW_WITH_UNICODE_CHAR" value="false" />
106+
<option name="TRAILING_COMMA_MODE" value="TRAILING_COMMA_REMOVE_WHEN_MULTILINE" />
107+
<option name="TRAILING_COMMA_TUPLE_ENABLED" value="true" />
108+
<option name="TRAILING_COMMA_TUPLE_TYPE_ENABLED" value="true" />
109+
<option name="TRAILING_COMMA_PATTERN_ARG_LIST_ENABLED" value="true" />
110+
<option name="TRAILING_COMMA_TYPE_PARAMS_ENABLED" value="true" />
111+
<option name="TRAILING_COMMA_IMPORT_SELECTOR_ENABLED" value="true" />
102112
</ScalaCodeStyleSettings>
103113
<codeStyleSettings language="JAVA">
104114
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
@@ -138,7 +148,21 @@
138148
</indentOptions>
139149
</codeStyleSettings>
140150
<codeStyleSettings language="Scala">
141-
<option name="MODIFIER_LIST_WRAP" value="true" />
151+
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
152+
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
153+
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
154+
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
155+
<option name="CALL_PARAMETERS_WRAP" value="5" />
156+
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
157+
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
158+
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
159+
<option name="EXTENDS_LIST_WRAP" value="5" />
160+
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
161+
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
162+
<option name="BINARY_OPERATION_WRAP" value="1" />
163+
<option name="FOR_STATEMENT_WRAP" value="2" />
164+
<option name="VARIABLE_ANNOTATION_WRAP" value="2" />
165+
<option name="SOFT_MARGINS" value="120" />
142166
<indentOptions>
143167
<option name="INDENT_SIZE" value="4" />
144168
<option name="CONTINUATION_INDENT_SIZE" value="4" />

OPAL/ai/src/it/scala/org/opalj/ai/domain/RecordDefUseTest.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class RecordDefUseTest extends AnyFunSpec with Matchers {
3535
protected[this] object DominatorsPerformanceEvaluation extends PerformanceEvaluation
3636

3737
protected[this] class DefUseDomain(
38-
val method: Method,
39-
val project: Project[URL]
38+
val method: Method,
39+
val project: Project[URL]
4040
) extends CorrelationalDomain
4141
with TheProject
4242
with TheMethod
@@ -57,8 +57,8 @@ class RecordDefUseTest extends AnyFunSpec with Matchers {
5757
with RecordDefUse // <=== we are going to test!
5858

5959
protected[this] class RefinedDefUseDomain(
60-
method: Method,
61-
project: Project[URL]
60+
method: Method,
61+
project: Project[URL]
6262
) extends DefUseDomain(method, project)
6363
with RefineDefUseUsingOrigins // this should not really affect the results...
6464

OPAL/ai/src/main/scala/org/opalj/ai/AI.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ import org.opalj.log.Warn
134134
* @author Michael Eichberg
135135
*/
136136
abstract class AI[D <: Domain](
137-
final val IdentifyDeadVariables: Boolean = true,
138-
final val RegisterStoreMayThrowExceptions: Boolean = false
137+
final val IdentifyDeadVariables: Boolean = true,
138+
final val RegisterStoreMayThrowExceptions: Boolean = false
139139
) {
140140

141141
type SomeLocals[V <: d.DomainValue forSome { val d: D }] = Option[IndexedSeq[V]]

OPAL/ai/src/main/scala/org/opalj/ai/AIException.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ package ai
1212
* @author Michael Eichberg
1313
*/
1414
class AIException(
15-
message: String = null,
16-
cause: Throwable = null,
17-
enableSuppression: Boolean = false,
18-
writableStackTrace: Boolean = true
15+
message: String = null,
16+
cause: Throwable = null,
17+
enableSuppression: Boolean = false,
18+
writableStackTrace: Boolean = true
1919
) extends RuntimeException(message, cause, enableSuppression, writableStackTrace)

OPAL/ai/src/main/scala/org/opalj/ai/BaseAI.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ package ai
1414
* @author Michael Eichberg
1515
*/
1616
class BaseAI(
17-
IdentifyDeadVariables: Boolean = true,
18-
RegisterStoreMayThrowExceptions: Boolean = false
17+
IdentifyDeadVariables: Boolean = true,
18+
RegisterStoreMayThrowExceptions: Boolean = false
1919
) extends AI[Domain](IdentifyDeadVariables, RegisterStoreMayThrowExceptions) {
2020

2121
override def isInterrupted: Boolean = Thread.interrupted()

OPAL/ai/src/main/scala/org/opalj/ai/BoundedInterruptableAI.scala

+10-10
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ import org.opalj.util.Nanoseconds
2525
* @author Michael Eichberg
2626
*/
2727
class BoundedInterruptableAI[D <: Domain](
28-
maxEvaluationCount: Int,
29-
val maxEvaluationTime: Nanoseconds,
30-
val doInterrupt: () => Boolean,
31-
IdentifyDeadVariables: Boolean
28+
maxEvaluationCount: Int,
29+
val maxEvaluationTime: Nanoseconds,
30+
val doInterrupt: () => Boolean,
31+
IdentifyDeadVariables: Boolean
3232
) extends InstructionCountBoundedAI[D](maxEvaluationCount, IdentifyDeadVariables) {
3333

3434
private[this] var startTime: Long = -1L;
3535

3636
def this(
37-
code: Code,
38-
maxEvaluationFactor: Double,
39-
maxEvaluationTime: Milliseconds,
40-
doInterrupt: () => Boolean,
41-
identifyDeadVariables: Boolean = true
37+
code: Code,
38+
maxEvaluationFactor: Double,
39+
maxEvaluationTime: Milliseconds,
40+
doInterrupt: () => Boolean,
41+
identifyDeadVariables: Boolean = true
4242
)(
43-
implicit logContext: LogContext
43+
implicit logContext: LogContext
4444
) = {
4545
this(
4646
InstructionCountBoundedAI.calculateMaxEvaluationCount(code, maxEvaluationFactor),

OPAL/ai/src/main/scala/org/opalj/ai/Computation.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ final case class ComputedValue[+V](result: V) extends Computation[V, Nothing] {
121121
* or threw an exception.
122122
*/
123123
final case class ComputedValueOrException[+V, +E](
124-
result: V,
125-
exceptions: E
124+
result: V,
125+
exceptions: E
126126
) extends Computation[V, E] {
127127

128128
def returnsNormally: Boolean = true
@@ -169,7 +169,7 @@ final case class ThrowsException[+E](exceptions: E) extends Computation[Nothing,
169169
* did not return some value) or that threw an exception/multiple exceptions.
170170
*/
171171
final case class ComputationWithSideEffectOrException[+E](
172-
exceptions: E
172+
exceptions: E
173173
) extends Computation[Nothing, E] {
174174

175175
def returnsNormally: Boolean = true

OPAL/ai/src/main/scala/org/opalj/ai/InstructionCountBoundedAI.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ import org.opalj.log.OPALLogger
2525
* @author Michael Eichberg
2626
*/
2727
class InstructionCountBoundedAI[D <: Domain](
28-
val maxEvaluationCount: Int,
29-
IdentifyDeadVariables: Boolean
28+
val maxEvaluationCount: Int,
29+
IdentifyDeadVariables: Boolean
3030
) extends AI[D](IdentifyDeadVariables) {
3131

3232
/**
3333
* @param maxEvaluationFactor Determines the maximum number of instruction evaluations
3434
* before the evaluation of the method is automatically interrupted.
3535
*/
3636
def this(
37-
code: Code,
38-
maxEvaluationFactor: Double = 1.5d,
39-
identifyDeadVariables: Boolean = true
37+
code: Code,
38+
maxEvaluationFactor: Double = 1.5d,
39+
identifyDeadVariables: Boolean = true
4040
)(implicit logContext: LogContext) = {
4141
this(
4242
InstructionCountBoundedAI.calculateMaxEvaluationCount(code, maxEvaluationFactor),

OPAL/ai/src/main/scala/org/opalj/ai/TimeBoundedAI.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import org.opalj.util.Nanoseconds
1515
* @author Michael Eichberg
1616
*/
1717
class TimeBoundedAI[D <: Domain](
18-
val maxEffort: Nanoseconds = new Milliseconds(150L).toNanoseconds
18+
val maxEffort: Nanoseconds = new Milliseconds(150L).toNanoseconds
1919
) extends AI[D] {
2020

2121
private[this] final val CheckInterval = 100

OPAL/ai/src/main/scala/org/opalj/ai/common/DomainRegistry.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import org.opalj.br.analyses.SomeProject
2727
object DomainRegistry {
2828

2929
case class DomainMetaInformation(
30-
lessPreciseDomains: Set[Class[_ <: Domain]],
31-
factory: (SomeProject, Method) => Domain
30+
lessPreciseDomains: Set[Class[_ <: Domain]],
31+
factory: (SomeProject, Method) => Domain
3232
)
3333

3434
type ClassRegistry = Map[Class[_ <: Domain], DomainMetaInformation]

0 commit comments

Comments
 (0)