<commit_before>package com.cedricziel.idea.typo3.translation.codeInspection;

import com.cedricziel.idea.typo3.translation.codeInspection.quickfix.CreateMissingTranslationQuickFix;
import com.cedricziel.idea.typo3.util.TranslationUtil;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.php.lang.inspections.PhpInspection;
import com.jetbrains.php.lang.psi.elements.ConcatenationExpression;
import com.jetbrains.php.lang.psi.elements.StringLiteralExpression;
import com.jetbrains.php.lang.psi.visitors.PhpElementVisitor;
import org.jetbrains.annotations.NotNull;

public class TranslationMissingInspection extends PhpInspection {

    public static final String MESSAGE = "Missing translation key";

    @NotNull
    @Override
    public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
        return new PhpElementVisitor() {
            @Override
            public void visitPhpStringLiteralExpression(StringLiteralExpression expression) {
                if (expression == null || expression.getParent() instanceof ConcatenationExpression) {
                    return;
                }

                String contents = expression.getContents();
                if (TranslationUtil.isTranslationKeyString(contents) && !TranslationUtil.keyExists(problemsHolder.getProject(), contents)) {
                    problemsHolder.registerProblem(expression, MESSAGE, new CreateMissingTranslationQuickFix(contents));
                }
            }
        };
    }
}<commit_msg>Do not propose "Create translation QuickFix", not ready yet<commit_after>package com.cedricziel.idea.typo3.translation.codeInspection;

import com.cedricziel.idea.typo3.util.TranslationUtil;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.php.lang.inspections.PhpInspection;
import com.jetbrains.php.lang.psi.elements.ConcatenationExpression;
import com.jetbrains.php.lang.psi.elements.StringLiteralExpression;
import com.jetbrains.php.lang.psi.visitors.PhpElementVisitor;
import org.jetbrains.annotations.NotNull;

public class TranslationMissingInspection extends PhpInspection {

    public static final String MESSAGE = "Missing translation key";

    @NotNull
    @Override
    public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
        return new PhpElementVisitor() {
            @Override
            public void visitPhpStringLiteralExpression(StringLiteralExpression expression) {
                if (expression == null || expression.getParent() instanceof ConcatenationExpression) {
                    return;
                }

                String contents = expression.getContents();
                if (TranslationUtil.isTranslationKeyString(contents) && !TranslationUtil.keyExists(problemsHolder.getProject(), contents)) {
                    // new CreateMissingTranslationQuickFix(contents)
                    problemsHolder.registerProblem(expression, MESSAGE);
                }
            }
        };
    }
}
{'fraction_non_alphanumeric': 0.08079512664315486, 'fraction_numerical': 0.0016030779095864058, 'mean_word_length': 3.4892086330935252, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3442195', 'n_tokens_mistral': 831, 'n_tokens_neox': 786, 'n_words': 142}