Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
TannazVhdBMWExt committed Sep 27, 2024
1 parent cecd9f9 commit 6bb136b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
3 changes: 2 additions & 1 deletion lobster/tools/coda/coda.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def parse_config_file(file_name: str) -> dict:
if (OUTPUT not in config_dict.keys() or
CODEBEAMER_URL not in config_dict.keys()):
raise ValueError(f'Please follow the right config file structure! '
f'Missing attribute "{OUTPUT}" and "{CODEBEAMER_URL}"')
f'Missing attribute "{OUTPUT}" and '
f'"{CODEBEAMER_URL}"')

output_config_dict = config_dict.get(OUTPUT)

Expand Down
13 changes: 7 additions & 6 deletions lobster/tools/coda/parser/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ def __init__(self, codebeamer_url = ''):

self.CODEBEAMER_LINK = codebeamer_url + "/issue/"
self.REQUIREMENT = re.compile(r".*[@\\]requirement\s+"
r"([\s*/]*(((CB-#)|({}))\d+)\s*,?)+"
.format(self.CODEBEAMER_LINK))
r"([\s*/]*(((CB-#)|({}))\d+)\s*,?)+"
.format(self.CODEBEAMER_LINK))
self.REQUIREMENT_TAG_HTTP = ((r"([@\\]requirement(\s+"
r"(CB-#\d+\s+)*({}\d+\s*,?\s*/*\*?)+)+)")
.format(self.CODEBEAMER_LINK))
self.REQUIREMENT_TAG_HTTP_NAMED = r"({}(?P<number>\d+))".format(self.CODEBEAMER_LINK)
r"(CB-#\d+\s+)*({}\d+\s*,?\s*/*\*?)+)+)")
.format(self.CODEBEAMER_LINK))
self.REQUIREMENT_TAG_HTTP_NAMED = (r"({}(?P<number>\d+))"
.format(self.CODEBEAMER_LINK))

NON_EXISTING_INFO = "---"

Expand Down Expand Up @@ -61,4 +62,4 @@ def __init__(self, codebeamer_url = ''):
# TESTMETHODS = re.compile(r"(@testmethods\s+
# )((" + "|".join(VALID_TESTMETHODS) +
# ")([,]? (" + "|".join(VALID_TESTMETHODS) + "))*)+")
TEST = re.compile(r"(@test\s+)([^@]+)")
TEST = re.compile(r"(@test\s+)([^@]+)")
6 changes: 4 additions & 2 deletions lobster/tools/coda/parser/requirements_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ def collect_test_cases_for_test_files(test_files: List[Path],
test_cases = []

for file in set(test_files):
file_test_cases = ParserForRequirements.collect_test_cases(file, codebeamer_url)
file_test_cases = (
ParserForRequirements.collect_test_cases(file, codebeamer_url))
test_cases.extend(file_test_cases)

return test_cases

@staticmethod
def collect_test_cases(file: Path, codebeamer_url: str = "") -> List[TestCase]:
def collect_test_cases(file: Path, codebeamer_url: str = "") \
-> List[TestCase]:
"""
Parse a source file for test cases
Expand Down
11 changes: 9 additions & 2 deletions lobster/tools/coda/parser/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ def _get_testmethod_tag(self) -> List[str]:
the value is dropped from the list
"""
test_methods_list = []
test_methods = self._add_multiline_attribute(self.constants.TESTMETHODS)
test_methods = (
self._add_multiline_attribute(self.constants.TESTMETHODS))
for test_method in test_methods.split():
if test_method in self.constants.VALID_TESTMETHODS:
test_methods_list.append(test_method)
Expand Down Expand Up @@ -290,7 +291,13 @@ def try_parse(file, lines, start_idx, codebeamer_url = ""):
lines -- lines to parse
start_idx -- index into lines where to start parsing
"""
return TestCase.try_parse_general(file, lines, start_idx, TestCase, codebeamer_url)
return TestCase.try_parse_general(
file,
lines,
start_idx,
TestCase,
codebeamer_url
)

@staticmethod
def try_parse_general(file, lines, start_idx, case, codebeamer_url):
Expand Down

0 comments on commit 6bb136b

Please sign in to comment.