Skip to content

Commit f280073

Browse files
committed
formatting and renaming
1 parent e5792f3 commit f280073

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

python-frontend/src/main/java/org/sonar/python/semantic/v2/types/AstBasedPropagation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private void computeDependencies(Assignment assignment, Set<SymbolV2> trackedVar
8181
if (e instanceof Name name) {
8282
SymbolV2 symbol = name.symbolV2();
8383
if (symbol != null && trackedVars.contains(symbol)) {
84-
assignment.addVariableDependencies(symbol);
84+
assignment.addVariableDependency(symbol);
8585
propagationsByLhs.get(symbol).forEach(propagation -> propagation.addDependent(assignment));
8686
}
8787
} else if (e instanceof HasTypeDependencies hasTypeDependencies) {

python-frontend/src/main/java/org/sonar/python/semantic/v2/types/Propagation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public SymbolV2 lhsSymbol() {
6161
return lhsSymbol;
6262
}
6363

64-
public void addVariableDependencies(SymbolV2 dependency) {
64+
public void addVariableDependency(SymbolV2 dependency) {
6565
variableDependencies.add(dependency);
6666
}
6767

python-frontend/src/main/java/org/sonar/python/semantic/v2/types/TrivialTypePropagationVisitor.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
import org.sonar.python.types.v2.TypeUtils;
3333

3434
public class TrivialTypePropagationVisitor extends BaseTreeVisitor {
35-
private TypeCheckBuilder isBooleanTypeCheck;
36-
private TypeCheckBuilder isIntTypeCheck;
37-
private TypeCheckBuilder isFloatTypeCheck;
38-
private TypeCheckBuilder isComplexTypeCheck;
35+
private final TypeCheckBuilder isBooleanTypeCheck;
36+
private final TypeCheckBuilder isIntTypeCheck;
37+
private final TypeCheckBuilder isFloatTypeCheck;
38+
private final TypeCheckBuilder isComplexTypeCheck;
3939

40-
private PythonType intType;
41-
private PythonType boolType;
40+
private final PythonType intType;
41+
private final PythonType boolType;
4242

4343
public TrivialTypePropagationVisitor(TypeTable typeTable) {
4444
this.isBooleanTypeCheck = new TypeCheckBuilder(typeTable).isBuiltinWithName(BuiltinTypes.BOOL);
@@ -76,20 +76,20 @@ private PythonType getTypeWhenUnaryPlusMinus(UnaryExpression unaryExpr) {
7676
private PythonType mapUnaryPlusMinusType(PythonType type) {
7777
if (isNumber(type)) {
7878
return type;
79-
} else if(isBooleanTypeCheck.check(type) == TriBool.TRUE) {
79+
} else if (isBooleanTypeCheck.check(type) == TriBool.TRUE) {
8080
return toObjectType(intType);
8181
}
8282
return PythonType.UNKNOWN;
8383
}
8484

85-
private boolean isNumber(PythonType type) {
85+
private boolean isNumber(PythonType type) {
8686
return isIntTypeCheck.check(type) == TriBool.TRUE
8787
|| isFloatTypeCheck.check(type) == TriBool.TRUE
8888
|| isComplexTypeCheck.check(type) == TriBool.TRUE;
8989
}
9090

9191
private static PythonType toObjectType(PythonType type) {
92-
if(type instanceof ObjectType || type == PythonType.UNKNOWN) {
92+
if (type instanceof ObjectType || type == PythonType.UNKNOWN) {
9393
return type;
9494
}
9595
return new ObjectType(type);

python-frontend/src/main/java/org/sonar/python/types/v2/TypeUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static PythonType ensureWrappedObjectType(PythonType pythonType) {
3939
}
4040

4141
public static PythonType map(PythonType type, UnaryOperator<PythonType> mapper) {
42-
if(type instanceof UnionType unionType) {
42+
if (type instanceof UnionType unionType) {
4343
return unionType.candidates().stream().map(mapper).reduce(UnionType::or).orElse(PythonType.UNKNOWN);
4444
} else {
4545
return mapper.apply(type);

0 commit comments

Comments
 (0)