Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,4 @@ def foo(param):
print(f'{foo(param=3)}') # OK, param is a keyword argument

print(f'{foo(param)}') # Noncompliant
# ^^^^^
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
import javax.annotation.Nullable;
import org.sonar.plugins.python.api.tree.AliasedName;
import org.sonar.plugins.python.api.tree.AnnotatedAssignment;
import org.sonar.plugins.python.api.tree.Argument;
import org.sonar.plugins.python.api.tree.AnyParameter;
import org.sonar.plugins.python.api.tree.ArgList;
import org.sonar.plugins.python.api.tree.Argument;
import org.sonar.plugins.python.api.tree.AssertStatement;
import org.sonar.plugins.python.api.tree.AssignmentStatement;
import org.sonar.plugins.python.api.tree.BreakStatement;
Expand Down Expand Up @@ -1321,7 +1321,7 @@ private static void updateTokensLineAndColumn(Token token, int startOfLiteral, L
}
int newline = (line - 1) + token.line();
// update token line and column with offset of string element.
TreeUtils.tokens(exp).forEach(t -> ((TokenImpl) t).setLineColumn(newline, col));
TreeUtils.tokens(exp).forEach(t -> ((TokenImpl) t).setLineColumn(newline, col + t.column()));
if (exp.is(Tree.Kind.STRING_LITERAL)) {
((StringLiteral) exp).stringElements().forEach(PythonTreeMaker::adjustNestedInterpolations);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public void symbol_visitor() {
verifyUsages(30, 11, reference(30, 1, 30, 4));
verifyUsages(34, 0, reference(35, 42, 35, 43), reference(38, 1, 38, 2),
reference(41, 10, 41, 11), reference(41, 36, 41, 37));
verifyUsages(43, 61, reference(43, 54, 43, 55));
}

private void verifyUsages(int line, int offset, TextRange... trs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ def other_func(self):

nested = f'some: {f"nested interpolation:\
{u} and then some {f"more {u}"}"}'

f"symbol created and used inside interpolation: {[len(x) for x in []]}"