Skip to content

Commit

Permalink
Fix various new lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
florianschanda committed Aug 15, 2024
1 parent 5baaa4d commit 4af3bb2
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 10 deletions.
7 changes: 5 additions & 2 deletions miss_hit/mh_copyright.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## ##
## MATLAB Independent, Small & Safe, High Integrity Tools ##
## ##
## Copyright (C) 2021-2022, Florian Schanda ##
## Copyright (C) 2021-2024, Florian Schanda ##
## ##
## This file is part of MISS_HIT. ##
## ##
Expand Down Expand Up @@ -220,6 +220,7 @@ def process_wp(cls, wp):
merged_line_is_block = None
killed_lines = []
new_range = None
merged_line_copy_notice = None
for line_no in sorted(cinfos):
cinfo = cinfos[line_no]
ystart, yend = cinfo.get_range()
Expand Down Expand Up @@ -247,6 +248,8 @@ def process_wp(cls, wp):
# pylint: enable=unsubscriptable-object

if action_taken:
if merged_line_copy_notice is None:
raise ICE("merged_line_copy_notice is None")
replace_line(lines, merged_line, merged_line_is_block,
templates, merged_line_copy_notice,
primary_entity, new_range)
Expand Down Expand Up @@ -367,7 +370,7 @@ def main_handler():
c_data.add_argument("--primary-entity",
default=None,
metavar="COPYRIGHT_HOLDER",
help=("The primary copyright entity."))
help="The primary copyright entity.")
c_data.add_argument("--template-range",
default="%(copy)s %(ystart)u-%(yend)u %(org)s",
metavar="TEMPLATE_TEXT",
Expand Down
1 change: 1 addition & 0 deletions miss_hit_core/cfg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ def parse_style_application(self):
msg += " (did you mean %s?)" % suggestions[0]
self.mh.error(self.ct.location, msg)

# pylint: disable=possibly-used-before-assignment
return Style_Application(rule_name, enabled)

def parse_style_configuration(self):
Expand Down
3 changes: 2 additions & 1 deletion miss_hit_core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## ##
## MATLAB Independent, Small & Safe, High Integrity Tools ##
## ##
## Copyright (C) 2019-2022, Florian Schanda ##
## Copyright (C) 2019-2024, Florian Schanda ##
## Copyright (C) 2019, Zenuity AB ##
## ##
## This file is part of MISS_HIT. ##
Expand Down Expand Up @@ -500,6 +500,7 @@ def register_justification(self, token):
else:
self.warning(token.location,
"invalid justification not recognized")
return

# Add justification
just = self.justifications[token.location.filename]
Expand Down
3 changes: 2 additions & 1 deletion miss_hit_core/m_lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## ##
## MATLAB Independent, Small & Safe, High Integrity Tools ##
## ##
## Copyright (C) 2019-2022, Florian Schanda ##
## Copyright (C) 2019-2024, Florian Schanda ##
## Copyright (C) 2019-2020, Zenuity AB ##
## ##
## This file is part of MISS_HIT. ##
Expand Down Expand Up @@ -545,6 +545,7 @@ def __token(self):
else:
max_digits = 64 // bits_per_digit

# pylint: disable=possibly-used-before-assignment
if len(digits) > max_digits:
self.lex_error(
"too many digits for %u-bit %s literal" %
Expand Down
3 changes: 2 additions & 1 deletion miss_hit_core/m_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## ##
## MATLAB Independent, Small & Safe, High Integrity Tools ##
## ##
## Copyright (C) 2019-2023, Florian Schanda ##
## Copyright (C) 2019-2024, Florian Schanda ##
## Copyright (C) 2019-2020, Zenuity AB ##
## ##
## This file is part of MISS_HIT. ##
Expand Down Expand Up @@ -1221,6 +1221,7 @@ def parse_annotation_static_string_expression(self):

def parse_annotation_pragma(self):
punctuation = []
n_reason = None

self.amatch("KEYWORD", "pragma")
t_pragma = self.ct
Expand Down
6 changes: 3 additions & 3 deletions miss_hit_core/mh_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## ##
## MATLAB Independent, Small & Safe, High Integrity Tools ##
## ##
## Copyright (C) 2020-2022, Florian Schanda ##
## Copyright (C) 2020-2024, Florian Schanda ##
## Copyright (C) 2020, Veoneer System Software GmbH ##
## ##
## This file is part of MISS_HIT. ##
Expand Down Expand Up @@ -1106,7 +1106,7 @@ def main_handler():
"--html",
default=None,
metavar="FILE",
help=("Write HTML metrics report to the file."))
help="Write HTML metrics report to the file.")

clp["output_options"].add_argument(
"--portable-html",
Expand All @@ -1119,7 +1119,7 @@ def main_handler():
"--json",
default=None,
metavar="FILE",
help=("Create JSON metrics report in the given file."))
help="Create JSON metrics report in the given file.")

options = command_line.parse_args(clp)

Expand Down
3 changes: 2 additions & 1 deletion miss_hit_core/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## ##
## MATLAB Independent, Small & Safe, High Integrity Tools ##
## ##
## Copyright (C) 2020, Florian Schanda ##
## Copyright (C) 2020-2024, Florian Schanda ##
## Copyright (C) 2020, Veoneer Sweden AB ##
## ##
## This file is part of MISS_HIT. ##
Expand Down Expand Up @@ -52,6 +52,7 @@

# We need to check this actually exists. Older installs could mask
# option 2 or 3.
# pylint: disable=broad-exception-raised
if not os.path.isfile(RES_URL):
raise Exception

Expand Down
3 changes: 2 additions & 1 deletion miss_hit_core/s_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## ##
## MATLAB Independent, Small & Safe, High Integrity Tools ##
## ##
## Copyright (C) 2020-2022, Florian Schanda ##
## Copyright (C) 2020-2024, Florian Schanda ##
## Copyright (C) 2023, BMW AG ##
## ##
## This file is part of MISS_HIT. ##
Expand Down Expand Up @@ -328,6 +328,7 @@ def parse_block_matlab_function(self, et_block, props, custom_attr):
# more stateflow support in the future.
is_eml = False
et_script = None
# pylint: disable-next=used-before-assignment
for et_eml in et_chart.find("Children").iter("eml"):
for et_item in et_eml:
if et_item.tag == "P":
Expand Down

0 comments on commit 4af3bb2

Please sign in to comment.