Skip to content

Commit f929eb8

Browse files
committed
chore: resolve hang issue with running isort as pre-commit hook
Signed-off-by: Paul Horton <[email protected]>
1 parent 46f7c0b commit f929eb8

7 files changed

+30
-32
lines changed

.isort.cfg

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## read the docs: https://pycqa.github.io/isort/docs/configuration/options.html
33
## keep in sync with flake8 config - in `tox.ini` file
44
known_first_party = cyclonedx
5-
skip_gitignore = true
5+
skip_gitignore = false
66
skip_glob =
77
build/*,dist/*,__pycache__,.eggs,*.egg-info*,
88
*_cache,*.cache,
@@ -15,3 +15,6 @@ ensure_newline_before_comments = true
1515
include_trailing_comma = true
1616
line_length = 120
1717
multi_line_output = 3
18+
src_paths =
19+
cyclonedx
20+
tests

.pre-commit-config.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ repos:
77
entry: poetry run tox -e mypy
88
pass_filenames: false
99
language: system
10-
# - repo: local
11-
# hooks:
12-
# - id: system
13-
# name: isort
14-
# entry: poetry run isort
15-
# pass_filenames: false
16-
# language: system
10+
- repo: local
11+
hooks:
12+
- id: system
13+
name: isort
14+
entry: poetry run isort -c .
15+
pass_filenames: false
16+
language: system
1717
- repo: local
1818
hooks:
1919
- id: system

tests/test_component.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@
2020
from os.path import dirname, join
2121
from unittest import TestCase
2222

23-
from data import get_component_setuptools_simple, get_component_setuptools_simple_no_version
24-
2523
# See https://github.com/package-url/packageurl-python/issues/65
2624
from packageurl import PackageURL # type: ignore
2725

2826
from cyclonedx.model import sha1sum
2927
from cyclonedx.model.bom import Bom
3028
from cyclonedx.model.component import Component
29+
from data import get_component_setuptools_simple, get_component_setuptools_simple_no_version
3130

3231
FIXTURES_DIRECTORY = 'fixtures/xml/1.4'
3332

tests/test_model_component.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@
2222
from unittest import TestCase
2323
from unittest.mock import Mock, patch
2424

25-
from data import (
26-
get_component_setuptools_simple,
27-
get_component_setuptools_simple_no_version,
28-
get_component_toml_with_hashes_with_references,
29-
get_issue_1,
30-
get_issue_2,
31-
get_pedigree_1,
32-
get_swid_1,
33-
get_swid_2,
34-
)
35-
3625
from cyclonedx.exception.model import NoPropertiesProvidedException
3726
from cyclonedx.model import (
3827
AttachedText,
@@ -55,6 +44,16 @@
5544
Pedigree,
5645
)
5746
from cyclonedx.model.issue import IssueClassification, IssueType
47+
from data import (
48+
get_component_setuptools_simple,
49+
get_component_setuptools_simple_no_version,
50+
get_component_toml_with_hashes_with_references,
51+
get_issue_1,
52+
get_issue_2,
53+
get_pedigree_1,
54+
get_swid_1,
55+
get_swid_2,
56+
)
5857
from tests.data import reorder
5958

6059

tests/test_model_issue.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@
1919

2020
from unittest import TestCase
2121

22-
from data import get_issue_1, get_issue_2
23-
2422
from cyclonedx.exception.model import NoPropertiesProvidedException
2523
from cyclonedx.model import XsUri
2624
from cyclonedx.model.issue import IssueClassification, IssueType, IssueTypeSource
25+
from data import get_issue_1, get_issue_2
2726
from tests.data import reorder
2827

2928

tests/test_output_json.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
from os.path import dirname, join
2121
from unittest.mock import Mock, patch
2222

23+
from cyclonedx.exception.model import UnknownComponentDependencyException
24+
from cyclonedx.exception.output import FormatNotSupportedException
25+
from cyclonedx.model.bom import Bom
26+
from cyclonedx.output import OutputFormat, SchemaVersion, get_instance
2327
from data import (
2428
MOCK_UUID_1,
2529
MOCK_UUID_2,
@@ -42,11 +46,6 @@
4246
get_bom_with_services_complex,
4347
get_bom_with_services_simple,
4448
)
45-
46-
from cyclonedx.exception.model import UnknownComponentDependencyException
47-
from cyclonedx.exception.output import FormatNotSupportedException
48-
from cyclonedx.model.bom import Bom
49-
from cyclonedx.output import OutputFormat, SchemaVersion, get_instance
5049
from tests.base import BaseJsonTestCase
5150
from tests.data import get_bom_for_issue_275_components
5251

tests/test_output_xml.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
from os.path import dirname, join
2121
from unittest.mock import Mock, patch
2222

23+
from cyclonedx.exception.model import UnknownComponentDependencyException
24+
from cyclonedx.model.bom import Bom
25+
from cyclonedx.output import SchemaVersion, get_instance
2326
from data import (
2427
MOCK_UUID_1,
2528
MOCK_UUID_2,
@@ -44,10 +47,6 @@
4447
get_bom_with_services_complex,
4548
get_bom_with_services_simple,
4649
)
47-
48-
from cyclonedx.exception.model import UnknownComponentDependencyException
49-
from cyclonedx.model.bom import Bom
50-
from cyclonedx.output import SchemaVersion, get_instance
5150
from tests.base import BaseXmlTestCase
5251
from tests.data import get_bom_for_issue_275_components
5352

0 commit comments

Comments
 (0)