-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bugfix/npe_long_line_rule
- Loading branch information
Showing
11 changed files
with
40 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/utils/FileUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Utility methods to work with file paths. | ||
*/ | ||
|
||
package org.cqfn.diktat.ruleset.utils | ||
|
||
internal const val SRC_DIRECTORY_NAME = "src" | ||
|
||
/** | ||
* Splits [this] string by file path separator | ||
* | ||
* @return list of path parts | ||
*/ | ||
fun String.splitPathToDirs(): List<String> = | ||
this.replace("\\", "/") | ||
.replace("//", "/") | ||
.split("/") | ||
|
||
/** | ||
* Checks if [this] String is a name of a kotlin script file by checking whether file extension equals 'kts' | ||
* | ||
* @return true if this is a kotlin script file name, false otherwise | ||
*/ | ||
fun String.isKotlinScript() = endsWith(".kts") | ||
|
||
/** | ||
* Checks if [this] String is a name of a gradle kotlin script file by checking whether file extension equals 'gradle.kts' | ||
* | ||
* @return true if this is a gradle kotlin script file name, false otherwise | ||
*/ | ||
fun String.isGradleScript() = endsWith("gradle.kts") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters