<commit_before>package org.jetbrains.plugins.scala
package codeInspection
package fileNameInspection


import collection.mutable.ArrayBuffer
import com.intellij.codeHighlighting.HighlightDisplayLevel
import lang.psi.api.ScalaFile
import com.intellij.codeInspection._
import com.intellij.codeInspection.ex.ProblemDescriptorImpl
import com.intellij.psi.PsiFile
import java.lang.String
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScObject, ScTypeDefinition}

/**
 * User: <NAME>
 * Date: 02.07.2009
 */

class FileNameInspection extends LocalInspectionTool {
  def getGroupDisplayName: String = InspectionsUtil.SCALA

  def getDisplayName: String = "File Name Inspection"

  def getShortName: String = "ScalaFileName"

  override def isEnabledByDefault: Boolean = true

  override def getStaticDescription: String = "Inspection for files without type definition with corresponding name"

  override def getID: String = "ScalaFileName"

  override def checkFile(file: PsiFile, manager: InspectionManager, isOnTheFly: Boolean): Array[ProblemDescriptor] = {
    if (!file.isInstanceOf[ScalaFile]) return Array[ProblemDescriptor]()
    val name = file.getName().substring(0, file.getName.length - 6)
    val scalaFile = file.asInstanceOf[ScalaFile]
    var hasProblems = true
    for (clazz <- scalaFile.getClasses) {
      clazz match {
        case o: ScObject if file.getName == "package.scala" && o.isPackageObject => hasProblems = false<commit_msg>Suppress file name inspection in injected code<commit_after>package org.jetbrains.plugins.scala
package codeInspection
package fileNameInspection


import collection.mutable.ArrayBuffer
import com.intellij.codeHighlighting.HighlightDisplayLevel
import lang.psi.api.ScalaFile
import com.intellij.codeInspection._
import com.intellij.codeInspection.ex.ProblemDescriptorImpl
import com.intellij.psi.PsiFile
import java.lang.String
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScObject, ScTypeDefinition}
import com.intellij.lang.injection.InjectedLanguageManager

/**
 * User: <NAME>
 * Date: 02.07.2009
 */

class FileNameInspection extends LocalInspectionTool {
  def getGroupDisplayName: String = InspectionsUtil.SCALA

  def getDisplayName: String = "File Name Inspection"

  def getShortName: String = "ScalaFileName"

  override def isEnabledByDefault: Boolean = true

  override def getStaticDescription: String = "Inspection for files without type definition with corresponding name"

  override def getID: String = "ScalaFileName"

  override def checkFile(file: PsiFile, manager: InspectionManager, isOnTheFly: Boolean): Array[ProblemDescriptor] = {
    if (!file.isInstanceOf[ScalaFile] ||
            InjectedLanguageManager.getInstance(file.getProject).isInjectedFragment(file))
      return Array[ProblemDescriptor]()

    val name = file.getName().substring(0, file.getName.length - 6)
    val scalaFile = file.asInstanceOf[ScalaFile]
    var hasProblems = true
    for (clazz <- scalaFile.getClasses) {
      clazz match {
        case o: ScObject if file.getName == "package.scala" && o.isPackageObject => hasProblems = false
{'fraction_non_alphanumeric': 0.0879156010230179, 'fraction_numerical': 0.00639386189258312, 'mean_word_length': 5.075728155339806, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2148707', 'n_tokens_mistral': 965, 'n_tokens_neox': 903, 'n_words': 220}