Skip to content

Commit ef8cddc

Browse files
chore: flake8 pre commit (#345)
Add flake8 to pre-commit checks
1 parent ef3c8b3 commit ef8cddc

19 files changed

+149
-69
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ repos:
1313
hooks:
1414
- id: docformatter
1515
args: [--in-place]
16+
- repo: https://github.com/PyCQA/flake8
17+
rev: 5.0.4
18+
hooks:
19+
- id: flake8

tests/integration/_search.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
import context
1617
import os.path as op
1718
import sys
1819
import time
1920

20-
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
21-
import context
2221
from splunklib import client
2322
from splunklib import results as splunklib_results
2423

24+
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
25+
2526

2627
def search(session_key, query):
2728
service = client.connect(host=context.host, token=session_key)

tests/integration/data/solnlib_demo/bin/solnlib_demo_collector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import uuid
33

44
from solnlib import log
5-
from solnlib.modular_input import *
5+
from solnlib.modular_input import ModularInput, Argument
66

77
# Set log context
88
log.Logs.set_context(namespace="solnlib_demo", root_logger_log_file="collector")

tests/integration/test__kvstore.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# limitations under the License.
1515
#
1616

17+
import context
1718
import json
1819
import os.path as op
1920
import sys
@@ -22,11 +23,11 @@
2223

2324
import pytest
2425

25-
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
26-
import context
2726
from splunklib import binding, client
2827
from splunklib.binding import HTTPError
2928

29+
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
30+
3031

3132
def test_kvstore():
3233
session_key = context.get_session_key()

tests/integration/test_acl.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
# limitations under the License.
1515
#
1616

17+
import context
1718
import os.path as op
1819
import sys
20+
from solnlib import acl
1921

2022
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
21-
import context
22-
23-
from solnlib import acl
2423

2524

2625
def test_acl_manager():

tests/integration/test_conf_manager.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414
# limitations under the License.
1515
#
1616

17+
import context
1718
import os.path as op
1819
import sys
20+
import pytest
21+
from solnlib import conf_manager
1922
from unittest import mock
2023

21-
import pytest
2224

2325
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
24-
import context
25-
26-
from solnlib import conf_manager
2726

2827

2928
def _build_conf_manager(session_key: str) -> conf_manager.ConfManager:

tests/integration/test_credentials.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@
1414
# limitations under the License.
1515
#
1616

17+
import context
1718
import os.path as op
1819
import sys
1920
from typing import Optional
20-
2121
import pytest
22+
from solnlib import credentials
2223

2324
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
24-
import context
25-
26-
from solnlib import credentials
2725

2826

2927
def _build_credential_manager(

tests/integration/test_hec_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
# limitations under the License.
1515
#
1616

17+
import context
1718
import os.path as op
1819
import sys
1920

20-
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
21-
import context
22-
2321
from solnlib import hec_config
2422

23+
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
24+
2525

2626
def test_hec_config():
2727
session_key = context.get_session_key()

tests/integration/test_hec_event_writer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
import context
1617
import os.path as op
1718
import sys
1819
import time
1920

20-
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
21-
import context
2221
from _search import search
2322

2423
from solnlib.modular_input import event_writer as hew
2524

25+
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
26+
2627

2728
def test_hec_event_writer():
2829
session_key = context.get_session_key()

tests/integration/test_logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
import context
1617
import os.path as op
1718
import sys
1819
import time
20+
from _search import search
1921

2022
sys.path.insert(0, op.dirname(op.dirname(op.abspath(__file__))))
21-
import context
22-
from _search import search
2323

2424

2525
def test_CVE_2023_32712():

0 commit comments

Comments
 (0)