Skip to content

Commit

Permalink
SONARPY-1829 tmp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-dequenne-sonarsource committed May 8, 2024
1 parent a14f095 commit 4a5bb73
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
10 changes: 10 additions & 0 deletions python-checks/src/test/resources/checks/nonCallableCalled.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,13 @@ def my_callable(): ...
def my_callable(): ...
my_callable = 42
my_callable() # Noncompliant


def reassigned_class():
if cond:
class MyClass(): ...
MyClass() # OK
else:
def MyClass(): ...
MyClass = 42
MyClass() # Noncompliant
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,14 @@ public void visitName(Name name) {
}
}

bindingUsages.stream()
/* bindingUsages.stream()
.findFirst()
.filter(UsageV2::isBindingUsage)
.map(UsageV2::tree)
.filter(Expression.class::isInstance)
.map(Expression.class::cast)
.map(Expression::typeV2)
.ifPresent(type -> setTypeToName(name, type));
.ifPresent(type -> setTypeToName(name, type));*/
}

private PythonType currentType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(name, members, attributes, superClasses);
return Objects.hash(name, members, attributes);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ def foo(a, b): ...
}

@Test
@Disabled("ClassDef not in CFG prevents us from getting this to work")
void multipleClassDefinitions() {
FileInput root = inferTypes("""
class MyClass(int): ...
Expand Down

0 comments on commit 4a5bb73

Please sign in to comment.