Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
36,500 | void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final GrExpression expression = (GrExpression) element; final String newExpression = calculateReplacementExpression(expression); GrInspectionUtil.replaceExpression(expression, newExpression); } | applyFix |
36,501 | void (@NotNull GrBinaryExpression expression) { super.visitBinaryExpression(expression); if (isFake(expression)) return; final GrExpression rhs = expression.getRightOperand(); if (rhs == null) return; final IElementType sign = expression.getOperationTokenType(); if (!arithmeticTokens.contains(sign)) return; final GrExp... | visitBinaryExpression |
36,502 | boolean (GrExpression rhs) { return isZero(rhs); } | subtractionExpressionIsPointless |
36,503 | boolean (GrExpression lhs, GrExpression rhs) { return isZero(lhs) || isZero(rhs); } | additionExpressionIsPointless |
36,504 | boolean (GrExpression lhs, GrExpression rhs) { return isZero(lhs) || isZero(rhs) || isOne(lhs) || isOne(rhs); } | multiplyExpressionIsPointless |
36,505 | boolean (GrExpression rhs) { return isOne(rhs); } | divideExpressionIsPointless |
36,506 | boolean (GrExpression expression) { final PsiElement inner = PsiUtil.skipParentheses(expression, false); if (inner == null) return false; @NonNls final String text = inner.getText(); return "0".equals(text) || "0x0".equals(text) || "0X0".equals(text) || "0.0".equals(text) || "0L".equals(text) || "0l".equals(text) || "0... | isZero |
36,507 | boolean (GrExpression expression) { final PsiElement inner = PsiUtil.skipParentheses(expression, false); if (inner == null) return false; @NonNls final String text = inner.getText(); return "1".equals(text) || "0x1".equals(text) || "0X1".equals(text) || "1.0".equals(text) || "1L".equals(text) || "1l".equals(text) || "0... | isOne |
36,508 | BaseInspectionVisitor () { return new BaseInspectionVisitor() { @Override public void visitAnnotation(@NotNull GrAnnotation annotation) { checkTarget(annotation); checkDelegatesTo(annotation); } private void checkTarget(GrAnnotation annotation) { if (!GroovyCommonClassNames.GROOVY_LANG_DELEGATES_TO_TARGET.equals(annota... | buildVisitor |
36,509 | void (@NotNull GrAnnotation annotation) { checkTarget(annotation); checkDelegatesTo(annotation); } | visitAnnotation |
36,510 | void (GrAnnotation annotation) { if (!GroovyCommonClassNames.GROOVY_LANG_DELEGATES_TO_TARGET.equals(annotation.getQualifiedName())) return; final PsiElement owner = annotation.getParent().getParent(); if (!(owner instanceof GrParameter)) return; final boolean isTargetDeclared = annotation.findDeclaredAttributeValue("va... | checkTarget |
36,511 | void (GrAnnotation annotation) { if (!GroovyCommonClassNames.GROOVY_LANG_DELEGATES_TO.equals(annotation.getQualifiedName())) return; final PsiElement owner = annotation.getParent().getParent(); if (!(owner instanceof GrParameter)) return; final PsiAnnotationMemberValue targetPair = annotation.findDeclaredAttributeValue... | checkDelegatesTo |
36,512 | String (Object... args) { if (args[0] instanceof GrIfStatement) { return GroovyBundle.message("inspection.message.ref.statement.has.empty.branch"); } else { return GroovyBundle.message("inspection.message.ref.statement.has.empty.body"); } } | buildErrorString |
36,513 | BaseInspectionVisitor () { return new Visitor(); } | buildVisitor |
36,514 | void (@NotNull GrWhileStatement statement) { super.visitWhileStatement(statement); final GrStatement body = statement.getBody(); if (body == null) { return; } if (!isEmpty(body)) { return; } registerStatementError(statement, statement); } | visitWhileStatement |
36,515 | void (@NotNull GrForStatement statement) { super.visitForStatement(statement); final GrStatement body = statement.getBody(); if (body == null) { return; } if (!isEmpty(body)) { return; } registerStatementError(statement, statement); } | visitForStatement |
36,516 | void (@NotNull GrIfStatement statement) { super.visitIfStatement(statement); final GrStatement thenBranch = statement.getThenBranch(); if (thenBranch != null) { if (isEmpty(thenBranch)) { registerStatementError(statement, statement); return; } } final GrStatement elseBranch = statement.getElseBranch(); if (elseBranch !... | visitIfStatement |
36,517 | boolean (GroovyPsiElement body) { if (!(body instanceof GrBlockStatement block)) { return false; } final GrOpenBlock openBlock = block.getBlock(); final PsiElement brace = openBlock.getLBrace(); if (brace == null) return false; final PsiElement nextNonWhitespace = PsiUtil.skipWhitespaces(brace.getNextSibling(), true); ... | isEmpty |
36,518 | String (Object... args) { return GroovyBundle.message("getter.0.clashes.with.getter.1", args); } | buildErrorString |
36,519 | BaseInspectionVisitor () { return new BaseInspectionVisitor() { @Override public void visitTypeDefinition(@NotNull GrTypeDefinition typeDefinition) { super.visitTypeDefinition(typeDefinition); Map<String, PsiMethod> getters = new HashMap<>(); for (PsiMethod method : typeDefinition.getMethods()) { final String methodNam... | buildVisitor |
36,520 | void (@NotNull GrTypeDefinition typeDefinition) { super.visitTypeDefinition(typeDefinition); Map<String, PsiMethod> getters = new HashMap<>(); for (PsiMethod method : typeDefinition.getMethods()) { final String methodName = method.getName(); if (!GroovyPropertyUtils.isSimplePropertyGetter(method)) continue; final Strin... | visitTypeDefinition |
36,521 | String (Object... args) { return GroovyBundle.message("inspection.message.octal.integer.ref"); } | buildErrorString |
36,522 | BaseInspectionVisitor () { return new BaseInspectionVisitor() { @Override public void visitLiteralExpression(@NotNull GrLiteral literal) { super.visitLiteralExpression(literal); @NonNls final String text = literal.getText(); if (!text.startsWith("0")) return; if (text.replaceAll("0", "").isEmpty()) return; if ("0g".equ... | buildVisitor |
36,523 | void (@NotNull GrLiteral literal) { super.visitLiteralExpression(literal); @NonNls final String text = literal.getText(); if (!text.startsWith("0")) return; if (text.replaceAll("0", "").isEmpty()) return; if ("0g".equals(text) || "0G".equals(text)) return; if ("0i".equals(text) || "0I".equals(text)) return; if ("0l".eq... | visitLiteralExpression |
36,524 | String (Object... args) { return GroovyBundle.message("inspection.message.result.increment.or.decrement.expression.used"); } | buildErrorString |
36,525 | BaseInspectionVisitor () { return new Visitor(); } | buildVisitor |
36,526 | void (@NotNull GrUnaryExpression grUnaryExpression) { super.visitUnaryExpression(grUnaryExpression); final IElementType tokenType = grUnaryExpression.getOperationTokenType(); if (!GroovyTokenTypes.mINC.equals(tokenType) && !GroovyTokenTypes.mDEC.equals(tokenType)) { return; } if (PsiUtil.isExpressionUsed(grUnaryExpress... | visitUnaryExpression |
36,527 | String (Object... args) { return GroovyBundle.message("inspection.message.gstring.used.as.maps.key"); } | buildErrorString |
36,528 | BaseInspectionVisitor () { return new Visitor(); } | buildVisitor |
36,529 | void (@NotNull GrNamedArgument namedArgument) { PsiElement parent = namedArgument.getParent(); if (!(parent instanceof GrListOrMap) || !((GrListOrMap)parent).isMap()) return; final GrArgumentLabel argumentLabel = namedArgument.getLabel(); if (argumentLabel == null) return; final GrExpression labelExpression = argumentL... | visitNamedArgument |
36,530 | void (@NotNull GrExpression grExpression) { final PsiElement gstringParent = grExpression.getParent(); if (!(gstringParent instanceof GrArgumentList)) return; GrExpression[] arguments = ((GrArgumentList)gstringParent).getExpressionArguments(); if (arguments.length != 2 || !arguments[0].equals(grExpression)) return; fin... | visitExpression |
36,531 | boolean (@NotNull GrExpression expression) { PsiType expressionType = expression.getType(); return expressionType != null && expressionType.equalsToText(GROOVY_LANG_GSTRING); } | isGStringType |
36,532 | String (Object... args) { return GroovyBundle.message("inspection.message.package.name.mismatch"); } | buildErrorString |
36,533 | OptPane () { return pane( checkbox("myCheckScripts", GroovyBundle.message("gr.package.inspection.check.scripts"))); } | getGroovyOptionsPane |
36,534 | BaseInspectionVisitor () { return new BaseInspectionVisitor() { @Override public void visitFile(@NotNull GroovyFileBase file) { if (!(file instanceof GroovyFile)) return; if (!myCheckScripts && file.isScript()) return; String expectedPackage = ExpectedPackageNameProviderKt.inferExpectedPackageName((GroovyFile)file); St... | buildVisitor |
36,535 | void (@NotNull GroovyFileBase file) { if (!(file instanceof GroovyFile)) return; if (!myCheckScripts && file.isScript()) return; String expectedPackage = ExpectedPackageNameProviderKt.inferExpectedPackageName((GroovyFile)file); String actual = file.getPackageName(); if (!expectedPackage.equals(actual)) { PsiElement toH... | visitFile |
36,536 | PsiElement (GroovyFile file) { GrPackageDefinition packageDefinition = file.getPackageDefinition(); if (packageDefinition != null) return packageDefinition; PsiClass[] classes = file.getClasses(); for (PsiClass aClass : classes) { if (!(aClass instanceof SyntheticElement) && aClass instanceof GrTypeDefinition) { return... | getElementToHighlight |
36,537 | String () { return GroovyBundle.message("fix.package.name"); } | getFamilyName |
36,538 | void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiFile file = element.getContainingFile(); ((GroovyFile)file).setPackageName(myNewPackageName); } | applyFix |
36,539 | String (Object... infos) { return GroovyBundle.message("inspection.message.double.negation.ref"); } | buildErrorString |
36,540 | LocalQuickFix (@NotNull PsiElement location) { return new DoubleNegationFix(); } | buildFix |
36,541 | String () { return GroovyBundle.message("intention.family.name.remove.double.negation"); } | getFamilyName |
36,542 | void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final GrUnaryExpression expression = (GrUnaryExpression)element; GrExpression operand = (GrExpression)PsiUtil.skipParentheses(expression.getOperand(), false); if (operand instanceof GrUnaryExpression prefixExpression) { final... | applyFix |
36,543 | BaseInspectionVisitor () { return new DoubleNegationVisitor(); } | buildVisitor |
36,544 | void (@NotNull GrUnaryExpression expression) { final IElementType tokenType = expression.getOperationTokenType(); if (!T_NOT.equals(tokenType)) { return; } checkParent(expression); } | visitUnaryExpression |
36,545 | void (@NotNull GrBinaryExpression expression) { final IElementType tokenType = expression.getOperationTokenType(); if (!T_NEQ.equals(tokenType)) { return; } checkParent(expression); } | visitBinaryExpression |
36,546 | void (GrExpression expression) { PsiElement parent = expression.getParent(); while (parent instanceof GrParenthesizedExpression) { parent = parent.getParent(); } if (!(parent instanceof GrUnaryExpression prefixExpression)) { return; } final IElementType parentTokenType = prefixExpression.getOperationTokenType(); if (!T... | checkParent |
36,547 | String () { // used to enable inspection in tests // remove when inspection class will match its short name return "GroovyUnusedIncOrDec"; } | getShortName |
36,548 | BaseInspectionVisitor () { return new GrUnusedIncDecInspectionVisitor(); } | buildVisitor |
36,549 | void (@NotNull GrUnaryExpression expression) { super.visitUnaryExpression(expression); IElementType opType = expression.getOperationTokenType(); if (opType != GroovyTokenTypes.mINC && opType != GroovyTokenTypes.mDEC) return; GrExpression operand = expression.getOperand(); if (!(operand instanceof GrReferenceExpression)... | visitUnaryExpression |
36,550 | String () { return myMessage; } | getFamilyName |
36,551 | void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { GrUnaryExpression expr = findUnaryExpression(element); if (expr == null) return; expr.replaceWithExpression(expr.getOperand(), true); } | applyFix |
36,552 | String () { return myMessage; } | getFamilyName |
36,553 | void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { GrUnaryExpression expr = findUnaryExpression(element); if (expr == null) return; GrExpression prefix = GroovyPsiElementFactory.getInstance(project) .createExpressionFromText(expr.getOperationToken().getText() + expr.getOperan... | applyFix |
36,554 | GrUnaryExpression (@NotNull PsiElement element) { PsiElement parent = element.getParent(); IElementType opType = element.getNode().getElementType(); if (opType != GroovyTokenTypes.mINC && opType != GroovyTokenTypes.mDEC) return null; return ObjectUtils.tryCast(parent, GrUnaryExpression.class); } | findUnaryExpression |
36,555 | String (Object... args) { return GroovyBundle.message("inspection.message.negated.if.condition.expression"); } | buildErrorString |
36,556 | BaseInspectionVisitor () { return new Visitor(); } | buildVisitor |
36,557 | void (@NotNull GrIfStatement grIfStatement) { super.visitIfStatement(grIfStatement); final GrExpression condition = grIfStatement.getCondition(); if (condition == null) { return; } if (!BoolUtils.isNegation(condition)) { return; } if (grIfStatement.getElseBranch() == null || grIfStatement.getThenBranch() == null) { ret... | visitIfStatement |
36,558 | int () { return m_limit; } | getLimit |
36,559 | String (Object... args) { return GroovyBundle.message("inspection.message.overly.complex.arithmetic.expression"); } | buildErrorString |
36,560 | BaseInspectionVisitor () { return new Visitor(); } | buildVisitor |
36,561 | void (@NotNull GrBinaryExpression expression) { super.visitBinaryExpression(expression); checkExpression(expression); } | visitBinaryExpression |
36,562 | void (@NotNull GrUnaryExpression expression) { super.visitUnaryExpression(expression); checkExpression(expression); } | visitUnaryExpression |
36,563 | void (@NotNull GrParenthesizedExpression expression) { super.visitParenthesizedExpression(expression); checkExpression(expression); } | visitParenthesizedExpression |
36,564 | void (GrExpression expression) { if (isParentArithmetic(expression)) { return; } if (!isArithmetic(expression)) { return; } if (containsStringConcatenation(expression)) { return; } final int numTerms = countTerms(expression); if (numTerms <= getLimit()) { return; } registerError(expression); } | checkExpression |
36,565 | int (GrExpression expression) { if (expression == null) { return 0; } if (!isArithmetic(expression)) { return 1; } if (expression instanceof GrBinaryExpression binaryExpression) { final GrExpression lhs = binaryExpression.getLeftOperand(); final GrExpression rhs = binaryExpression.getRightOperand(); return countTerms(l... | countTerms |
36,566 | boolean (GrExpression expression) { final PsiElement parent = expression.getParent(); if (!(parent instanceof GrExpression)) { return false; } return isArithmetic((GrExpression) parent); } | isParentArithmetic |
36,567 | boolean (GrExpression expression) { if (expression instanceof GrBinaryExpression binaryExpression) { final IElementType sign = binaryExpression.getOperationTokenType(); return arithmeticTokens.contains(sign); } else if (expression instanceof GrUnaryExpression unaryExpression) { final IElementType sign = unaryExpression... | isArithmetic |
36,568 | boolean (GrExpression expression) { if (isString(expression)) { return true; } if (expression instanceof GrBinaryExpression binaryExpression) { final GrExpression lhs = binaryExpression.getLeftOperand(); if (containsStringConcatenation(lhs)) { return true; } final GrExpression rhs = binaryExpression.getRightOperand(); ... | containsStringConcatenation |
36,569 | boolean (GrExpression expression) { if (expression == null) { return false; } final PsiType type = expression.getType(); if (type == null) { return false; } return type.equalsToText(JAVA_LANG_STRING); } | isString |
36,570 | String (Object... args) { return GroovyBundle.message("inspection.message.nested.ref.statement"); } | buildErrorString |
36,571 | BaseInspectionVisitor () { return new Visitor(); } | buildVisitor |
36,572 | void (@NotNull GrSwitchStatement switchStatement) { super.visitSwitchStatement(switchStatement); final GrSwitchStatement containingSwitch = PsiTreeUtil.getParentOfType(switchStatement, GrSwitchStatement.class); if (containingSwitch == null) { return; } registerStatementError(switchStatement); } | visitSwitchStatement |
36,573 | BaseInspectionVisitor () { return new PointlessBooleanExpressionVisitor(); } | buildVisitor |
36,574 | String (Object... args) { return GroovyBundle.message("pointless.boolean.problem.descriptor"); } | buildErrorString |
36,575 | String (GrBinaryExpression expression) { final IElementType sign = expression.getOperationTokenType(); final GrExpression lhs = expression.getLeftOperand(); final GrExpression rhs = expression.getRightOperand(); if (rhs == null) { return null; } final String rhsText = rhs.getText(); final String lhsText = lhs.getText()... | calculateSimplifiedBinaryExpression |
36,576 | String (GrExpression exp) { if (ComparisonUtils.isComparison(exp)) { final GrBinaryExpression binaryExpression = (GrBinaryExpression)exp; final IElementType sign = binaryExpression.getOperationTokenType(); final String negatedComparison = ComparisonUtils.getNegatedComparison(sign); final GrExpression lhs = binaryExpres... | createStringForNegatedExpression |
36,577 | String (GrUnaryExpression expression) { final GrExpression operand = expression.getOperand(); if (isUnaryNot(operand)) { return booleanLiteral(((GrUnaryExpression)operand).getOperand()); } else { return negateBooleanLiteral(operand); } } | calculateSimplifiedPrefixExpression |
36,578 | String (GrExpression operand) { if (isTrue(operand)) { return "false"; } else if (isFalse(operand)) { return "true"; } else { throw new IllegalStateException(operand.getText()); } } | negateBooleanLiteral |
36,579 | String (GrExpression operand) { if (isTrue(operand)) { return "true"; } else if (isFalse(operand)) { return "false"; } else { throw new IllegalStateException(operand.getText()); } } | booleanLiteral |
36,580 | LocalQuickFix (@NotNull PsiElement location) { return new BooleanLiteralComparisonFix(); } | buildFix |
36,581 | String () { return GroovyBundle.message("pointless.boolean.quickfix"); } | getFamilyName |
36,582 | void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { if (element instanceof GrBinaryExpression expression) { final String replacementString = calculateSimplifiedBinaryExpression(expression); GrInspectionUtil.replaceExpression(expression, replacementString); } else { final GrUna... | applyFix |
36,583 | void (@NotNull GrBinaryExpression expression) { if (isFake(expression)) return; final IElementType sign = expression.getOperationTokenType(); if (!booleanTokens.contains(sign)) { return; } final GrExpression rhs = expression.getRightOperand(); if (rhs == null) { return; } final GrExpression lhs = expression.getLeftOper... | visitBinaryExpression |
36,584 | void (@NotNull GrUnaryExpression expression) { final IElementType sign = expression.getOperationTokenType(); if (!sign.equals(T_NOT)) { return; } final GrExpression operand = expression.getOperand(); if (isBooleanLiteral(operand)) { final PsiElement parent = expression.getParent(); if (parent instanceof GrExpression &&... | visitUnaryExpression |
36,585 | boolean (IElementType sign, GrExpression rhs, GrExpression lhs) { if (sign.equals(T_EQ) || sign.equals(T_NEQ)) { return equalityExpressionIsPointless(lhs, rhs); } else if (sign.equals(T_LAND)) { return andExpressionIsPointless(lhs, rhs); } else if (sign.equals(T_LOR)) { return orExpressionIsPointless(lhs, rhs); } else ... | isPointless |
36,586 | boolean (GrExpression lhs, GrExpression rhs) { return ((isTrue(lhs) || isFalse(lhs)) && isBoolean(rhs)) || ((isTrue(rhs) || isFalse(rhs)) && isBoolean(lhs)); } | equalityExpressionIsPointless |
36,587 | boolean (GrExpression expression) { final PsiType type = expression.getType(); return PsiTypes.booleanType().equals(type); } | isBoolean |
36,588 | boolean (GrExpression lhs, GrExpression rhs) { return isTrue(lhs) || isTrue(rhs); } | andExpressionIsPointless |
36,589 | boolean (GrExpression lhs, GrExpression rhs) { return isFalse(lhs) || isFalse(rhs); } | orExpressionIsPointless |
36,590 | boolean (GrExpression lhs, GrExpression rhs) { return isTrue(lhs) || isTrue(rhs) || isFalse(lhs) || isFalse(rhs); } | xorExpressionIsPointless |
36,591 | boolean (GrExpression arg) { return arg instanceof GrUnaryExpression && ((GrUnaryExpression)arg).getOperationTokenType() == T_NOT; } | isUnaryNot |
36,592 | boolean (GrExpression arg) { return isFalse(arg) || isTrue(arg); } | isBooleanLiteral |
36,593 | boolean (GrExpression expression) { if (expression == null) { return false; } if (!(expression instanceof GrLiteral)) { return false; } @NonNls final String text = expression.getText(); return "true".equals(text); } | isTrue |
36,594 | boolean (GrExpression expression) { if (expression == null) { return false; } if (!(expression instanceof GrLiteral)) { return false; } @NonNls final String text = expression.getText(); return "false".equals(text); } | isFalse |
36,595 | BaseInspectionVisitor () { return new BaseInspectionVisitor() { @Override public void visitReferenceExpression(@NotNull GrReferenceExpression referenceExpression) { super.visitReferenceExpression(referenceExpression); if (!PsiUtil.isLValue(referenceExpression)) return; final PsiElement resolved = referenceExpression.re... | buildVisitor |
36,596 | void (@NotNull GrReferenceExpression referenceExpression) { super.visitReferenceExpression(referenceExpression); if (!PsiUtil.isLValue(referenceExpression)) return; final PsiElement resolved = referenceExpression.resolve(); if (!PsiUtil.isLocalVariable(resolved)) return; final PsiType checked = GrReassignedLocalVarsChe... | visitReferenceExpression |
36,597 | boolean (GrReferenceExpression referenceExpression, PsiType checked, GrControlFlowOwner varFlowOwner, GrControlFlowOwner refFlorOwner) { return varFlowOwner != refFlorOwner && !TypesUtil.isAssignable(referenceExpression.getType(), checked, referenceExpression); } | isOtherScopeAndType |
36,598 | String (GrControlFlowOwner refFlorOwner) { String flowDescription; if (refFlorOwner instanceof GrClosableBlock) { flowDescription = GroovyBundle.message("closure"); } else if (refFlorOwner instanceof GrAnonymousClassDefinition) { flowDescription = GroovyBundle.message("anonymous.class"); } else { flowDescription = Groo... | getFlowDescription |
36,599 | String (Object... args) { return GroovyBundle.message("inspection.message.call.to.ref.can.be.keyed.access"); } | buildErrorString |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.