Skip to content

Commit ac42c37

Browse files
committed
Pre-commit update
1 parent 999c0a1 commit ac42c37

13 files changed

Lines changed: 79 additions & 82 deletions

.eslintrc.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
env:
2+
browser: true
3+
jquery: true
4+
es6: true
5+
parserOptions:
6+
ecmaVersion: 2018

.github/dependabot.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
version: 2
44
updates:
5-
65
- package-ecosystem: "github-actions"
76
directory: "/"
87
schedule:

.pre-commit-config.yaml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
exclude: ^(src/octoprint/vendor/|src/octoprint/static/js/lib|src/octoprint/static/vendor|tests/static/js/lib|tests/util/_files|docs/|scripts/|translations/|.*\.css|.*\.svg)
1+
exclude: ^(octoprint_firmware_check/translations|extras/|translations/|.*\.css|.*\.svg)
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v2.3.0
4+
rev: v4.4.0
55
hooks:
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
@@ -11,30 +11,42 @@ repos:
1111
- id: check-toml
1212
- id: check-merge-conflict
1313
- id: fix-encoding-pragma
14+
args: ["--remove"]
15+
- repo: https://github.com/asottile/pyupgrade
16+
rev: v3.3.1
17+
hooks:
18+
- id: pyupgrade
19+
args: ["--py37-plus"]
1420
- repo: https://github.com/OctoPrint/codemods
15-
rev: devel
21+
rev: "0.6.3"
1622
hooks:
17-
- id: codemod_dict_to_literal
18-
stages: ["manual"]
19-
- id: codemod_set_to_literal
20-
stages: ["manual"]
2123
- id: codemod_not_in
22-
stages: ["manual"]
2324
- repo: https://github.com/pre-commit/mirrors-isort
24-
rev: v5.5.4
25+
rev: v5.10.1
2526
hooks:
2627
- id: isort
2728
- repo: https://github.com/psf/black
28-
rev: 22.3.0
29+
rev: 23.1.0
2930
hooks:
3031
- id: black
31-
- repo: https://gitlab.com/pycqa/flake8
32-
rev: 3.8.1
32+
args: ["--config", "black.toml"]
33+
additional_dependencies:
34+
- click==8.0.4
35+
- repo: https://github.com/pycqa/flake8
36+
rev: 6.0.0
3337
hooks:
3438
- id: flake8
3539
additional_dependencies:
3640
- flake8-bugbear
3741
- repo: https://github.com/pre-commit/mirrors-prettier
38-
rev: v2.1.2
42+
rev: v3.0.0-alpha.4
3943
hooks:
4044
- id: prettier
45+
- repo: https://github.com/pre-commit/mirrors-eslint
46+
rev: v8.33.0
47+
hooks:
48+
- id: eslint
49+
additional_dependencies:
50+
- eslint@7.19.0
51+
- eslint-plugin-es5@v1.3.0
52+
files: \.js$

black.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[tool.black]
2+
line-length = 90
3+
include = '\.pyi?$'

octoprint_firmware_check/__init__.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import, division, print_function, unicode_literals
3-
41
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
52
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
63

@@ -54,7 +51,6 @@ class FirmwareCheckPlugin(
5451
octoprint.plugin.TemplatePlugin,
5552
octoprint.plugin.SettingsPlugin,
5653
):
57-
5854
# noinspection PyMissingConstructor
5955
def __init__(self):
6056
self._warnings = dict()
@@ -128,10 +124,10 @@ def on_firmware_info_received(self, comm_instance, firmware_name, firmware_data)
128124
self._run_checks(
129125
"m115",
130126
to_unicode(firmware_name, errors="replace"),
131-
dict(
132-
(to_unicode(key, errors="replace"), to_unicode(value, errors="replace"))
127+
{
128+
to_unicode(key, errors="replace"): to_unicode(value, errors="replace")
133129
for key, value in firmware_data.items()
134-
),
130+
},
135131
)
136132

137133
##~~ Firmware capability hook handler
@@ -241,14 +237,12 @@ def _run_checks(self, check_type, *args, **kwargs):
241237
break
242238

243239
check.evaluate_timeout()
244-
self._logger.debug("Check {} active? {}".format(check, check.active))
240+
self._logger.debug(f"Check {check} active? {check.active}")
245241

246242
still_active = any(check.active for check in checks) or still_active
247243

248244
self._scan_received = still_active
249-
self._logger.debug(
250-
"Scanning received lines enabled? {}".format(self._scan_received)
251-
)
245+
self._logger.debug(f"Scanning received lines enabled? {self._scan_received}")
252246

253247
if changes:
254248
self._ping_clients()
@@ -267,7 +261,7 @@ def _register_warning(self, warning_type, message, severity, url):
267261
)
268262
self._warnings[warning_type] = dict(message=message, severity=severity, url=url)
269263

270-
logline = "{}. More information at {}".format(message, url)
264+
logline = f"{message}. More information at {url}"
271265
if severity == Severity.INFO:
272266
self._logger.info(logline)
273267
else:

octoprint_firmware_check/checks/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import, division, print_function, unicode_literals
3-
41
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
52
__copyright__ = "Copyright (C) 2019 The OctoPrint Project - Released under terms of the AGPLv3 License"
63

@@ -9,7 +6,7 @@
96
from octoprint.util import monotonic_time
107

118

12-
class Check(object):
9+
class Check:
1310
name = None
1411
url = None
1512

@@ -149,7 +146,7 @@ def received(self, line):
149146
self._active = False
150147

151148

152-
class Severity(object):
149+
class Severity:
153150
INFO = "info"
154151
WARNING = "warning"
155152
CRITICAL = "critical"

octoprint_firmware_check/checks/firmware_broken.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import, division, print_function, unicode_literals
3-
41
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
52
__copyright__ = "Copyright (C) 2020 The OctoPrint Project - Released under terms of the AGPLv3 License"
63

@@ -10,7 +7,7 @@
107
from . import LineCheck, Severity
118

129

13-
class FirmwareBrokenChecks(object):
10+
class FirmwareBrokenChecks:
1411
@classmethod
1512
def as_dict(cls):
1613
return dict(

octoprint_firmware_check/checks/firmware_development.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import, division, print_function, unicode_literals
3-
41
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
52
__copyright__ = "Copyright (C) 2019 The OctoPrint Project - Released under terms of the AGPLv3 License"
63

@@ -12,7 +9,7 @@
129
from . import Check, Severity
1310

1411

15-
class FirmwareDevelopmentChecks(object):
12+
class FirmwareDevelopmentChecks:
1613
@classmethod
1714
def as_dict(cls):
1815
return dict(

octoprint_firmware_check/checks/firmware_hostcommands.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import, division, print_function, unicode_literals
3-
41
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
52
__copyright__ = "Copyright (C) 2021 The OctoPrint Project - Released under terms of the AGPLv3 License"
63

@@ -9,7 +6,7 @@
96
from . import NegativeCapCheck, Severity
107

118

12-
class FirmwareHostcommandsChecks(object):
9+
class FirmwareHostcommandsChecks:
1310
@classmethod
1411
def as_dict(cls):
1512
return {

octoprint_firmware_check/checks/firmware_unsafe.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import, division, print_function, unicode_literals
3-
41
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
52
__copyright__ = "Copyright (C) 2019 The OctoPrint Project - Released under terms of the AGPLv3 License"
63

@@ -10,7 +7,7 @@
107
from . import AuthorCheck, Check, NegativeCapCheck, Severity
118

129

13-
class FirmwareUnsafeChecks(object):
10+
class FirmwareUnsafeChecks:
1411
@classmethod
1512
def as_dict(cls):
1613
return dict(

0 commit comments

Comments
 (0)