-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf98a30
commit 91192f9
Showing
10 changed files
with
95 additions
and
0 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
44 changes: 44 additions & 0 deletions
44
doc-generator/src/main/scala/codacy/codesniffer/docsgen/parsers/VaimoUKParser.scala
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,44 @@ | ||
package codacy.codesniffer.docsgen.parsers | ||
|
||
import codacy.codesniffer.docsgen.VersionsHelper | ||
import scala.util.matching.Regex | ||
|
||
import better.files.File | ||
import com.codacy.plugins.api.results.Pattern | ||
|
||
import scala.annotation.nowarn | ||
|
||
class VaimoUKParser extends DocsParser { | ||
|
||
override val repositoryURL = "https://bitbucket.org/vaimo/uk-phpcs-standards.git" | ||
|
||
override val checkoutCommit: String = VersionsHelper.vaimoUK | ||
|
||
|
||
override val sniffRegex: Regex = """.*(Vaimo)\/Sniffs\/(.*?)\/(.*?)Sniff.php""".r | ||
|
||
@nowarn("msg=match may not be exhaustive") | ||
override def patternIdPartsFor(relativizedFilePath: String): PatternIdParts = { | ||
val sniffRegex(vaimoVersion, sniffType, patternName) = relativizedFilePath | ||
PatternIdParts(vaimoVersion, sniffType, patternName) | ||
} | ||
|
||
override def descriptionWithDocs(rootDir: File, | ||
patternIdParts: PatternIdParts, | ||
patternFile: File | ||
): (Pattern.Description, Option[String]) = { | ||
(description(patternIdParts, rootDir), | ||
this.parseExtendedDescription("Vaimo\\Sniffs\\Custom", "Vaimo", patternIdParts, rootDir) | ||
) | ||
} | ||
|
||
private[this] def description(patternIdParts: PatternIdParts, rootDir: File): Pattern.Description = { | ||
val caseRegexPattern = """((?<=\p{Ll})\p{Lu}|\p{Lu}(?=\p{Ll}))""".r | ||
val patternName = caseRegexPattern.replaceAllIn(patternIdParts.patternName, " $1").trim | ||
val sniffName = caseRegexPattern.replaceAllIn(patternIdParts.sniffType, " $1").trim | ||
val title = Pattern.Title(s"$sniffName: $patternName") | ||
val extended = this.parseDescription("Vaimo\\Sniffs\\Custom", "Vaimo", patternIdParts, rootDir) | ||
Pattern.Description(patternIdParts.patternId, title, extended, None, Set.empty) | ||
} | ||
} | ||
|
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 @@ | ||
Custom: Array Access |
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 @@ | ||
Custom: Fix Multiline If |
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 @@ | ||
Custom: Legacy Docblock Tags |
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 @@ | ||
Custom: No Php Cs Disable |
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