Skip to content

Commit 18e86da

Browse files
committed
code-climate: fix string-literal-comments
1 parent e9e87a1 commit 18e86da

File tree

31 files changed

+293
-256
lines changed

31 files changed

+293
-256
lines changed

strictdoc/backend/reqif/p01_sdoc/sdoc_to_reqif_converter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,10 @@ def _convert_section_to_spec_object(
445445
)
446446
attributes.append(title_attribute)
447447

448-
"""
449-
If MIDs is enabled and this section has an MID, use it for
450-
SPEC-OBJECT IDENTIFIER.
451-
"""
448+
#
449+
# If MIDs is enabled and this section has an MID, use it for
450+
# SPEC-OBJECT IDENTIFIER.
451+
#
452452
enable_mid = context.enable_mid and parent_document.config.enable_mid
453453
section_identifier: str
454454
if enable_mid and section.reserved_mid is not None:

strictdoc/backend/sdoc_source_code/models/source_file_info.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ def __init__(self, g_parts: List):
2929
self.source_file: Optional[SourceFile] = None
3030
self.functions: List[Function] = []
3131

32-
"""
33-
{
34-
"REQ-001": [RangeMarker(...), ...],
35-
"REQ-002": [RangeMarker(...), ...],
36-
}
37-
"""
32+
#
33+
# { # noqa: ERA001
34+
# "REQ-001": [RangeMarker(...), ...], # noqa: ERA001
35+
# "REQ-002": [RangeMarker(...), ...], # noqa: ERA001
36+
# } # noqa: ERA001
3837
self.ng_map_reqs_to_markers = {}
3938

4039
self.ng_map_names_to_markers: Dict[str, List] = {}

strictdoc/backend/sdoc_source_code/test_reports/junit_xml_reader.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ def read_from_string(
168168
)
169169
test_suite_section.section_contents.append(testcase_node)
170170

171-
"""
172-
Parse individual <testcase> elements.
173-
"""
171+
#
172+
# Parse individual <testcase> elements.
173+
#
174174

175175
xml_testcase_list: List[Any] = xml_testsuite_.find_all(
176176
"testcase", recursive=False
@@ -216,16 +216,16 @@ def read_from_string(
216216
elif xml_skipped_or_none is not None:
217217
test_case_node_status = "SKIPPED"
218218

219-
"""
220-
Different tools produce different outputs when it comes to how
221-
the test names and paths are stored. Each tool's output is
222-
handled separately below.
223-
"""
219+
#
220+
# Different tools produce different outputs when it comes to how
221+
# the test names and paths are stored. Each tool's output is
222+
# handled separately below.
223+
#
224224
if xml_format == JUnitXMLFormat.LLVM_LIT:
225-
"""
226-
Example produced by LLVM LIT:
227-
<testcase classname="StrictDoc integration tests.tests/integration" name="test.ignored.itest" time="5.50"/>
228-
"""
225+
#
226+
# Example produced by LLVM LIT:
227+
# <testcase classname="StrictDoc integration tests.tests/integration" name="test.ignored.itest" time="5.50"/>
228+
#
229229

230230
rel_path_to_test_suite = (
231231
project_config.test_report_root_dict.get(

strictdoc/core/project_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def __init__(
145145

146146
# Settings derived from the command-line parameters.
147147

148-
# Common settings
148+
# Common settings.
149149
self.input_paths: Optional[List[str]] = None
150150
self.output_dir: str = "output"
151151

strictdoc/core/traceability_index.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -918,12 +918,12 @@ def validate_node_against_anchors(
918918
for node_anchor_ in node.get_anchors():
919919
existing_node_anchor_uids.add(node_anchor_.value)
920920

921-
"""
922-
Validation 1: Assert all UIDs are either:
923-
a) new
924-
b) exist in this node
925-
c) raise a duplication error.
926-
"""
921+
#
922+
# Validation 1: Assert all UIDs are either:
923+
# a) new
924+
# b) exist in this node
925+
# c) raise a duplication error.
926+
#
927927
for anchor_uid in new_anchor_uids:
928928
if (
929929
self.graph_database.has_link(
@@ -943,10 +943,10 @@ def validate_node_against_anchors(
943943
f"{node_with_duplicate_anchor.get_display_title()}."
944944
)
945945

946-
"""
947-
Validation 2: Check that removed anchors do not have any incoming
948-
links.
949-
"""
946+
#
947+
# Validation 2: Check that removed anchors do not have any incoming
948+
# links.
949+
#
950950
to_be_removed_anchor_uids = existing_node_anchor_uids - new_anchor_uids
951951
for to_be_removed_anchor_uid_ in to_be_removed_anchor_uids:
952952
to_be_removed_anchor: Anchor = self.graph_database.get_link_value(

strictdoc/core/traceability_index_builder.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ def create(
188188

189189
traceability_index.document_tree.attach_source_tree(source_tree)
190190

191-
"""
192-
Resolve all modification dates to support the incremental generation of
193-
all artifacts.
194-
"""
191+
#
192+
# Resolve all modification dates to support the incremental generation of
193+
# all artifacts.
194+
#
195195

196196
file_dependency_manager = traceability_index.file_dependency_manager
197197

@@ -303,9 +303,9 @@ def create_from_document_tree(
303303

304304
document: SDocDocument
305305
for document in document_tree.document_list:
306-
"""
307-
First, resolve all grammars that are imported from grammar files.
308-
"""
306+
#
307+
# First, resolve all grammars that are imported from grammar files.
308+
#
309309
if document.grammar.import_from_file is not None:
310310
document_grammar: Optional[DocumentGrammar] = (
311311
document_tree.get_grammar_by_filename(
@@ -491,11 +491,11 @@ def create_from_document_tree(
491491

492492
requirement: SDocNode = node
493493

494-
"""
495-
At this point, we resolve LINKs, and the expectation is that
496-
all UIDs or ANCHORS (they also have UIDs) are registered at the
497-
previous pass.
498-
"""
494+
#
495+
# At this point, we resolve LINKs, and the expectation is that
496+
# all UIDs or ANCHORS (they also have UIDs) are registered at the
497+
# previous pass.
498+
#
499499
for node_field_ in node.enumerate_fields():
500500
for part in node_field_.parts:
501501
if isinstance(part, InlineLink):

strictdoc/core/transforms/update_grammar_element.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ def perform(self) -> bool:
4949
if field.field_name != existing_field.title:
5050
renamed_fields_lookup[field.field_name] = existing_field.title
5151

52-
"""
53-
Convert the form object to an updated grammar element.
54-
"""
52+
#
53+
# Convert the form object to an updated grammar element.
54+
#
5555
updated_element: GrammarElement = (
5656
form_object.convert_to_grammar_element(document.grammar)
5757
)
5858

59-
"""
60-
Compare if anything was changed in the new grammar.
61-
"""
59+
#
60+
# Compare if anything was changed in the new grammar.
61+
#
6262
document_grammar_field_names = updated_element.get_field_titles()
6363

6464
existing_document_grammar_field_names = (

strictdoc/export/html/form_objects/requirement_form_object.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,10 @@ def validate(
596596
assert isinstance(traceability_index, TraceabilityIndex)
597597
assert isinstance(context_document, SDocDocument)
598598

599-
"""
600-
MID uniqueness check.
601-
FIXME: MID uniqueness if a node is updated.
602-
"""
599+
#
600+
# MID uniqueness check.
601+
# FIXME: MID uniqueness if a node is updated.
602+
#
603603
if self.is_new and "MID" in self.fields:
604604
new_node_mid = self.fields["MID"][0].field_value
605605
if len(new_node_mid) > 0:
@@ -616,9 +616,9 @@ def validate(
616616
),
617617
)
618618

619-
"""
620-
UID uniqueness check.
621-
"""
619+
#
620+
# UID uniqueness check.
621+
#
622622
new_node_uid_or_none: Optional[str] = None
623623
if "UID" in self.fields:
624624
new_node_uid = self.fields["UID"][0].field_value
@@ -641,10 +641,10 @@ def validate(
641641
),
642642
)
643643

644-
"""
645-
Ensure that UID doesn't have any incoming links if it is going to be
646-
renamed or removed.
647-
"""
644+
#
645+
# Ensure that UID doesn't have any incoming links if it is going to be
646+
# renamed or removed.
647+
#
648648
if self.existing_requirement_uid is not None:
649649
if (
650650
new_node_uid_or_none is None
@@ -670,11 +670,11 @@ def validate(
670670
),
671671
)
672672

673-
"""
674-
STATEMENT or another content field (DESCRIPTION, CONTENT) checks:
675-
- Must be not empty.
676-
- Must be valid RST.
677-
"""
673+
#
674+
# STATEMENT or another content field (DESCRIPTION, CONTENT) checks:
675+
# - Must be not empty.
676+
# - Must be valid RST.
677+
#
678678
requirement_element = self.grammar.elements_by_type[self.element_type]
679679
statement_field_name = requirement_element.content_field[0]
680680
requirement_statement = self.fields[statement_field_name][0].field_value

strictdoc/export/html/generators/traceability_matrix.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ def export(
4848
if relation_type_ not in discovered_relation_types:
4949
del known_relations[relation_type_]
5050

51-
"""
52-
Validate that all config-provided relation tuples are actually present
53-
in the existing documents.
54-
A typical config entry may look like this:
55-
[
56-
("Parent", None),
57-
("Parent", "Refines"),
58-
("Parent", "REQUIREMENT_FOR"),
59-
("File", None)
60-
]
61-
"""
51+
#
52+
# Validate that all config-provided relation tuples are actually present
53+
# in the existing documents.
54+
# A typical config entry may look like this:
55+
# [ # noqa: ERA001
56+
# ("Parent", None), # noqa: ERA001
57+
# ("Parent", "Refines"), # noqa: ERA001
58+
# ("Parent", "REQUIREMENT_FOR"), # noqa: ERA001
59+
# ("File", None) # noqa: ERA001
60+
# ] # noqa: ERA001
61+
#
6262
config_relation_tuples = (
6363
project_config.traceability_matrix_relation_columns
6464
if project_config.traceability_matrix_relation_columns is not None
@@ -69,11 +69,11 @@ def export(
6969
bucket = known_relations[config_relation_tuple_[0]]
7070
assert config_relation_tuple_[1] in bucket
7171

72-
"""
73-
After the config values have been validated, merge both the
74-
config-provided list of relation tuples with the list that was
75-
discovered from the existing documents.
76-
"""
72+
#
73+
# After the config values have been validated, merge both the
74+
# config-provided list of relation tuples with the list that was
75+
# discovered from the existing documents.
76+
#
7777
known_relations_list = list(config_relation_tuples)
7878
for relation_type_, bucket_ in known_relations.items():
7979
for relation_role_, _ in bucket_.items():

strictdoc/export/html/generators/view_objects/traceability_matrix_view_object.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,17 @@ def export(
9696
if relation_type_ not in discovered_relation_types:
9797
del known_relations[relation_type_]
9898

99-
"""
100-
Validate that all config-provided relation tuples are actually present
101-
in the existing documents.
102-
A typical config entry may look like this:
103-
[
104-
("Parent", None),
105-
("Parent", "Refines"),
106-
("Parent", "REQUIREMENT_FOR"),
107-
("File", None)
108-
]
109-
"""
99+
#
100+
# Validate that all config-provided relation tuples are actually present
101+
# in the existing documents.
102+
# A typical config entry may look like this:
103+
# [ # noqa: ERA001
104+
# ("Parent", None), # noqa: ERA001
105+
# ("Parent", "Refines"), # noqa: ERA001
106+
# ("Parent", "REQUIREMENT_FOR"), # noqa: ERA001
107+
# ("File", None) # noqa: ERA001
108+
# ] # noqa: ERA001
109+
#
110110
config_relation_tuples = (
111111
project_config.traceability_matrix_relation_columns
112112
if project_config.traceability_matrix_relation_columns is not None
@@ -117,11 +117,11 @@ def export(
117117
bucket = known_relations[config_relation_tuple_[0]]
118118
assert config_relation_tuple_[1] in bucket
119119

120-
"""
121-
After the config values have been validated, merge both the
122-
config-provided list of relation tuples with the list that was
123-
discovered from the existing documents.
124-
"""
120+
#
121+
# After the config values have been validated, merge both the
122+
# config-provided list of relation tuples with the list that was
123+
# discovered from the existing documents.
124+
#
125125
known_relations_list = list(config_relation_tuples)
126126
for relation_type_, bucket_ in known_relations.items():
127127
for relation_role_, _ in bucket_.items():

0 commit comments

Comments
 (0)