void (final @NotNull PyStatement statement) { ASTNode statementNode = statement.getNode(); if (statementNode != null) { ASTNode[] nodes = statementNode.getChildren(TokenSet.create(PyTokenTypes.SEMICOLON)); for (ASTNode node : nodes) { ASTNode nextNode = statementNode.getTreeNext(); while ((nextNode instanceof PsiWhiteSpace) && (!nextNode.textContains('\n'))) { nextNode = nextNode.getTreeNext(); } if (nextNode == null || nextNode.textContains('\n')) { if (ContainerUtil.exists(PyInspectionExtension.EP_NAME.getExtensionList(), extension -> extension.ignoreTrailingSemicolon(statement))) { return; } registerProblem(node.getPsi(), PyPsiBundle.message("INSP.trailing.semicolon"), new RemoveTrailingSemicolonQuickFix()); } } } }