Skip to content

Commit

Permalink
Adding Ruff linting
Browse files Browse the repository at this point in the history
  • Loading branch information
onefastsnail committed Aug 11, 2024
1 parent b867246 commit 2fca79c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/2015.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ jobs:
pip install poetry
poetry install
- name: Run lint
run: poetry run ruff check

- name: Run tests
run: poetry run pytest
29 changes: 28 additions & 1 deletion 2015/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions 2015/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.12"
pytest = "^8.3.2"
ruff = "^0.5.7"


[build-system]
Expand Down
18 changes: 9 additions & 9 deletions 2015/solutions/day2/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ def part_1(raw_input: List[str]) -> int:
total = 0

for line in raw_input:
l, w, h = list(map(lambda x: int(x), line.split("x")))
length, width, height = list(map(lambda x: int(x), line.split("x")))

s1 = l * w
s2 = w * h
s3 = h * l
s1 = length * width
s2 = width * height
s3 = height * length

total = total + s1 * 2 + s2 * 2 + s3 * 2 + min(s1, s2, s3)

Expand All @@ -20,12 +20,12 @@ def part_2(raw_input: List[str]) -> int:
total = 0

for line in raw_input:
l, w, h = list(map(lambda x: int(x), line.split("x")))
length, width, height = list(map(lambda x: int(x), line.split("x")))

volume = l * w * h
s1 = 2 * (l + w)
s2 = 2 * (w + h)
s3 = 2 * (h + l)
volume = length * width * height
s1 = 2 * (length + width)
s2 = 2 * (width + height)
s3 = 2 * (height + length)

total = total + volume + min(s1, s2, s3)

Expand Down

0 comments on commit 2fca79c

Please sign in to comment.