Skip to content

Commit

Permalink
[REF] pylint_odoo: Avoid reassigning self.linter.config (#505)
Browse files Browse the repository at this point in the history
Reassign "self.linter.config" variables is not a good practice

Since that it could be used from other jobs and using a dirty value
  • Loading branch information
moylop260 authored Dec 19, 2024
1 parent 789d027 commit 5f810b2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/pylint_odoo/checkers/odoo_addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,12 +1087,12 @@ def visit_dict(self, node):
version_format = manifest_dict.get("version", "")

# Check version format
formatrgx = self.formatversion(version_format)
formatrgx, manifest_version_format_parsed = self.formatversion(version_format)
if version_format and not formatrgx:
self.add_message(
"manifest-version-format",
node=manifest_keys_nodes.get("version") or node,
args=(version_format, self.linter.config.manifest_version_format_parsed),
args=(version_format, manifest_version_format_parsed),
)

# Check manifest-behind-migrations
Expand Down Expand Up @@ -1385,10 +1385,8 @@ def formatversion(self, version_string):
valid_odoo_versions = self.linter.config.valid_odoo_versions
valid_odoo_versions = "|".join(map(re.escape, valid_odoo_versions))
manifest_version_format = self.linter.config.manifest_version_format
self.linter.config.manifest_version_format_parsed = manifest_version_format.format(
valid_odoo_versions=valid_odoo_versions
)
return re.match(self.linter.config.manifest_version_format_parsed, version_string)
manifest_version_format_parsed = manifest_version_format.format(valid_odoo_versions=valid_odoo_versions)
return re.match(manifest_version_format_parsed, version_string), manifest_version_format_parsed

def join_node_args_kwargs(self, node):
"""Method to join args and keywords
Expand Down

0 comments on commit 5f810b2

Please sign in to comment.