-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add language parameter to inspect only one specific language (#178) * Add language parameter to inspect only one specific language * Fix linters * Move language version enum to separated module to avoid circular imports in application_config * Move language assignment to ApplicationConfig * Fix flake * Fix imports order * Fix tests * Update actions/checkout * Fix docker image * Add new argument into readme file --------- Co-authored-by: Artur <atnartur@users.noreply.github.com>
- Loading branch information
Showing
13 changed files
with
96 additions
and
68 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
1.4.2 | ||
1.4.3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from enum import Enum, unique | ||
from typing import Dict, List | ||
|
||
from hyperstyle.src.python.review.common.file_system import Extension | ||
|
||
|
||
@unique | ||
class LanguageVersion(Enum): | ||
JAVA_7 = 'java7' | ||
JAVA_8 = 'java8' | ||
JAVA_9 = 'java9' | ||
JAVA_11 = 'java11' | ||
JAVA_15 = 'java15' | ||
JAVA_17 = 'java17' | ||
PYTHON_3 = 'python3' | ||
KOTLIN = 'kotlin' | ||
JS = 'javascript' | ||
GO = 'go' | ||
|
||
@classmethod | ||
def values(cls) -> List[str]: | ||
return [member.value for member in cls.__members__.values()] | ||
|
||
@classmethod | ||
def language_to_extension_dict(cls) -> Dict['LanguageVersion', Extension]: | ||
return { | ||
cls.JAVA_7: Extension.JAVA, | ||
cls.JAVA_8: Extension.JAVA, | ||
cls.JAVA_9: Extension.JAVA, | ||
cls.JAVA_11: Extension.JAVA, | ||
cls.JAVA_15: Extension.JAVA, | ||
cls.JAVA_17: Extension.JAVA, | ||
cls.PYTHON_3: Extension.PY, | ||
cls.KOTLIN: Extension.KT, | ||
cls.JS: Extension.JS, | ||
cls.GO: Extension.GO, | ||
} | ||
|
||
def extension_by_language(self) -> Extension: | ||
return self.language_to_extension_dict()[self] | ||
|
||
def is_java(self) -> bool: | ||
return ( | ||
self == LanguageVersion.JAVA_7 | ||
or self == LanguageVersion.JAVA_8 | ||
or self == LanguageVersion.JAVA_9 | ||
or self == LanguageVersion.JAVA_11 | ||
or self == LanguageVersion.JAVA_15 | ||
or self == LanguageVersion.JAVA_17 | ||
) | ||
|
||
@classmethod | ||
def from_value(cls, value: str, default=None): | ||
try: | ||
return LanguageVersion(value) | ||
except ValueError: | ||
return default |
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