Skip to content

Commit

Permalink
Disabled file location check (package-name rule) (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
shyiko committed Oct 2, 2018
1 parent d3449b7 commit bc1d51f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.github.shyiko.ktlint.ruleset.standard

import com.github.shyiko.ktlint.core.KtLint
import com.github.shyiko.ktlint.core.Rule
import org.jetbrains.kotlin.com.intellij.lang.ASTNode
import org.jetbrains.kotlin.psi.KtPackageDirective
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
import java.io.File

/**
* @see [Kotlin Style Guide](https://kotlinlang.org/docs/reference/coding-conventions.html#naming-rules)
Expand All @@ -24,12 +22,15 @@ class PackageNameRule : Rule("package-name") {
if (qualifiedName.isEmpty()) {
return
}
// https://github.com/shyiko/ktlint/issues/280
/*
val filePath = node.psi.containingFile.node.getUserData(KtLint.FILE_PATH_USER_DATA_KEY) ?: return
val fileDir = filePath.substringBeforeLast(File.separatorChar)
.replace('.', File.separatorChar) // kotlinc a/b.c/d/E.kt produces a/b/c/d/E.class
if (!fileDir.endsWith(File.separatorChar + qualifiedName.replace('.', File.separatorChar))) {
emit(node.startOffset, "Package directive doesn't match file location", false)
}
*/
if (qualifiedName.contains('_')) {
emit(node.startOffset, "Package name must not contain underscore", false)
// "package name must be in lowercase" is violated by too many to projects in the wild to forbid
Expand Down

0 comments on commit bc1d51f

Please sign in to comment.