Skip to content
This repository has been archived by the owner on Oct 7, 2023. It is now read-only.

List concatenation is not consistent #32

Closed
trag1c opened this issue Feb 7, 2023 · 0 comments · Fixed by #33
Closed

List concatenation is not consistent #32

trag1c opened this issue Feb 7, 2023 · 0 comments · Fixed by #33
Labels
priority: 1 (low) tag: good first issue Good for newcomers topic: code style Related to code style type: report Something is being reported

Comments

@trag1c
Copy link
Contributor

trag1c commented Feb 7, 2023

src/pyvism/runtime/errors.py has two occurrences of list concatenation:

# a + [b]
def _get_ruler_size(self) -> int:
	return len(str(max(line.number for line in self.info_lines + [self.error_line]))) + 1
# [*a, b]
@property
def lines(self) -> list[MessageLine]:
	return sorted([*self.info_lines, self.error_line], key=lambda line: line.number)

I believe it should be consistent and only one of the ways should be used. In my (and ruff's) opinion, it should be the latter as it's faster and easier to read.

@qexat qexat changed the title Make list concatenation consistent List concatenation is not consistent Feb 7, 2023
@qexat qexat added tag: good first issue Good for newcomers topic: code style Related to code style type: report Something is being reported labels Feb 7, 2023
@qexat qexat linked a pull request Feb 7, 2023 that will close this issue
@qexat qexat closed this as completed in #33 Feb 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: 1 (low) tag: good first issue Good for newcomers topic: code style Related to code style type: report Something is being reported
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants