Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit d4b0d02

Browse files
authored
[client] Add linting and formatting to circl-ci (#72)
* Add linting and formatting to circl-ci * Remove old black command * Add vscode to gitignore * Allow sub folder to be modules * Rewrite main __init__.py
1 parent 680e656 commit d4b0d02

21 files changed

+113
-66
lines changed

.circleci/config.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
version: 2.1
22

33
jobs:
4+
ensure_formatting:
5+
docker:
6+
- image: circleci/python:3.7.7
7+
working_directory: ~/repo
8+
steps:
9+
- checkout
10+
- run:
11+
name: install dependencies
12+
command: sudo pip3 install black
13+
- run:
14+
name: confirm black version
15+
command: black --version
16+
- run:
17+
name: run black check
18+
command: black --check .
19+
linter:
20+
docker:
21+
- image: alpine/flake8
22+
working_directory: ~/repo
23+
steps:
24+
- checkout
25+
- run:
26+
name: flake8
27+
command: flake8 --ignore=E,W ~/repo
428
build:
529
working_directory: ~/opencti-client
630
docker:
@@ -10,9 +34,6 @@ jobs:
1034
- run:
1135
name: install dependencies
1236
command: pip3 install -r requirements.txt --user
13-
- run:
14-
name: install dependencies
15-
command: black --check .
1637
- run:
1738
name: build
1839
command: python3 setup.py sdist
@@ -30,7 +51,7 @@ jobs:
3051
at: ~/opencti-client
3152
- run:
3253
name: install dependencies
33-
command: pip3 install -r requirements.txt --user
54+
command: pip3 install -r requirements.txt --user
3455
- run:
3556
name: verify git tag vs. version
3657
command: python3 setup.py verify
@@ -48,6 +69,11 @@ jobs:
4869
command: twine upload dist/*
4970

5071
workflows:
72+
version: 2
73+
check-code:
74+
jobs:
75+
- ensure_formatting
76+
- linter
5177
opencti_client_python:
5278
jobs:
5379
- build:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pycti.egg-info
77
logs
88
test.py
99
.idea
10+
.vscode
1011
*.iml
1112
examples/*.json
1213
examples/*.pdf

examples/add_organization_to_sector.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# coding: utf-8
22

3-
import datetime
4-
53
from pycti import OpenCTIApiClient
64

75
# Variables

examples/add_tag_to_malware.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# coding: utf-8
22

3-
from dateutil.parser import parse
43
from pycti import OpenCTIApiClient
54

65
# Variables

examples/add_tool_usage_to_intrusion-set.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# coding: utf-8
22

3-
import datetime
4-
from dateutil.parser import parse
5-
63
from pycti import OpenCTIApiClient
74

85
# Variables

examples/create_incident_with_ttps_and_indicators.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# coding: utf-8
22

3-
import datetime
43
from dateutil.parser import parse
54

65
from pycti import OpenCTIApiClient

examples/create_indicator_of_campaign.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# coding: utf-8
22

3-
import datetime
4-
53
from dateutil.parser import parse
64
from pycti import OpenCTIApiClient
75

examples/delete_intrusion_set.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# coding: utf-8
22

3-
import json
43
from pycti import OpenCTIApiClient
54

65
# Variables

examples/delete_relation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# coding: utf-8
22

3-
import json
43
from pycti import OpenCTIApiClient
54

65
# Variables

examples/export_async_of_indicators.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# coding: utf-8
22

3-
import json
43
from pycti import OpenCTIApiClient
54

65
# Variables

0 commit comments

Comments
 (0)