Skip to content

Commit 8b78391

Browse files
chg: added .pre-commit-config.yaml
1 parent de4dfea commit 8b78391

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+537
-242
lines changed

.pre-commit-config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
repos:
2+
- repo: https://github.com/asottile/pyupgrade
3+
rev: v2.31.1
4+
hooks:
5+
- id: pyupgrade
6+
args: ["--py37-plus"]
7+
- repo: https://github.com/asottile/reorder_python_imports
8+
rev: v3.0.1
9+
hooks:
10+
- id: reorder-python-imports
11+
additional_dependencies: ["setuptools>60.9"]
12+
- repo: https://github.com/psf/black
13+
rev: 22.3.0
14+
hooks:
15+
- id: black
16+
- repo: https://github.com/PyCQA/flake8
17+
rev: 4.0.1
18+
hooks:
19+
- id: flake8
20+
additional_dependencies:
21+
- flake8-bugbear
22+
- flake8-implicit-str-concat
23+
args: ["--max-line-length=127"]
24+
- repo: https://github.com/pre-commit/pre-commit-hooks
25+
rev: v4.1.0
26+
hooks:
27+
- id: fix-byte-order-marker
28+
- id: trailing-whitespace
29+
- id: end-of-file-fixer

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
You are welcome to contribute to the MONARC Stats Service project.
22
There are many ways to contribute and participate.
33

4+
Before starting to contribute please install the Git hook scripts:
5+
6+
```bash
7+
$ git clone https://github.com/monarc-project/stats-service
8+
$ cd stats-service/
9+
$ poetry install
10+
$ pre-commit install
11+
```
12+
413
Feel free to fork the code, play with it, make some patches and send us the pull
514
requests.
615

COPYING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,4 +658,4 @@ specific requirements.
658658
You should also get your employer (if you work as a programmer) or school,
659659
if any, to sign a "copyright disclaimer" for the program, if necessary.
660660
For more information on this, and how to apply and follow the GNU AGPL, see
661-
<http://www.gnu.org/licenses/>.
661+
<http://www.gnu.org/licenses/>.

docs/admin.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Update Stats Service
4343
4444
$ curl -H "X-API-KEY: 5USubuFK_FXB7fXoMq_Nt0CHRo9SxQW0J_FarVG5fCJmXckz6T1qgE2wtV_aFiGTGvBi1Xr45-CayfgpC-_MMA" http://127.0.0.1:5000/admin/update.json
4545
{
46-
"output": "b'Already up to date.\\n'b'\\n'b'> stats-service@0.4.0 postinstall\\n'b'> cd statsservice/static/ ; ln -sf ../../node_modules npm_components\\n'b'\\n'b'\\n'b'added 11 packages, and audited 12 packages in 777ms\\n'b'\\n'b'2 packages are looking for funding\\n'b' run `npm fund` for details\\n'b'\\n'b'found 0 vulnerabilities\\n'b'Installing dependencies from lock file\\n'b'\\n'b'No dependencies to install or update\\n'b'\\n'b'Installing the current project: statsservice (0.4.0)\\n'b'\\xe2\\x9c\\xa8 \\xf0\\x9f\\x8c\\x9f \\xe2\\x9c\\xa8\\n'b'\\x1b[0;32mStats Service updated. You can now restart the service.\\x1b[0m Examples:\\n'b' sudo systemctl restart statsservice.service\\n'b' sudo systemctl restart apache2.service\\n'",
46+
"output": "b'Already up to date.\\n'b'\\n'b'> stats-service@0.4.0 postinstall\\n'b'> cd statsservice/static/ ; ln -sf ../../node_modules npm_components\\n'b'\\n'b'\\n'b'added 11 packages, and audited 12 packages in 777ms\\n'b'\\n'b'2 packages are looking for funding\\n'b' run `npm fund` for details\\n'b'\\n'b'found 0 vulnerabilities\\n'b'Installing dependencies from lock file\\n'b'\\n'b'No dependencies to install or update\\n'b'\\n'b'Installing the current project: statsservice (0.4.0)\\n'b'\\xe2\\x9c\\xa8 \\xf0\\x9f\\x8c\\x9f \\xe2\\x9c\\xa8\\n'b'\\x1b[0;32mStats Service updated. You can now restart the service.\\x1b[0m Examples:\\n'b' sudo systemctl restart statsservice.service\\n'b' sudo systemctl restart apache2.service\\n'",
4747
"result": "OK"
4848
}
4949

docs/architecture.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Architecture
22
============
33

4-
High level architecture
4+
High level architecture
55
-----------------------
66

77
.. image:: _static/architecture-stats-organization-level.png
@@ -113,7 +113,7 @@ Scenario 2
113113

114114
The Stats Service is installed on a dedicated server.
115115

116-
116+
117117
Scenario 3
118118
''''''''''
119119

@@ -138,9 +138,9 @@ Important notes
138138
`General Settings / Sharing statistics <https://www.monarc.lu/documentation/user-guide/#global-dashboard>`_
139139
view of your MONARC instance
140140
(`see here <https://www.monarc.lu/documentation/user-guide/images/GlobalDashboardGlobalSetting.png>`_).
141-
141+
142142
However, stats must always be collected in your local Stats Service instance.
143-
This is required for the proper functioning of the global dashboard of your MONARC instance.
143+
This is required for the proper functioning of the global dashboard of your MONARC instance.
144144

145145

146146
.. note::

docs/command-line-interface.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ Pulling data from a central stats server.
268268
threat). [required]
269269
270270
--help Show this message and exit.
271-
271+
272272
273273
Delete stats
274274
~~~~~~~~~~~~

docs/conf.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@
33
# This file only contains a selection of the most common options. For a full
44
# list see the documentation:
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6-
76
# -- Path setup --------------------------------------------------------------
8-
97
# If extensions (or modules to document with autodoc) are in another directory,
108
# add these directories to sys.path here. If the directory is relative to the
119
# documentation root, use os.path.abspath to make it absolute, like shown here.
1210
#
1311
# import os
1412
# import sys
1513
# sys.path.insert(0, os.path.abspath('.'))
16-
17-
1814
# -- Project information -----------------------------------------------------
1915

2016
project = "MONARC Stats Service"
@@ -105,15 +101,15 @@
105101
(
106102
"index",
107103
"MONARC_Stats_Service.tex",
108-
u"MONARC Stats Service",
109-
u"CASES Luxembourg",
104+
"MONARC Stats Service",
105+
"CASES Luxembourg",
110106
"howto",
111107
),
112108
]
113109

114110
latex_show_urls = True
115111
latex_show_pagerefs = True
116112

117-
ADDITIONAL_PREAMBLE = """
113+
ADDITIONAL_PREAMBLE = r"""
118114
\setcounter{tocdepth}{3}
119115
"""

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ software which is providing:
1414
`MONARC <https://github.com/monarc-project/MonarcAppFO>`_ instances and to **return**
1515
these statistics with different filters and aggregation methods;
1616
* a dashboard that summarizes the **current cybersecurity landscape**. The charts are
17-
based on the statistics collected.
17+
based on the statistics collected.
1818

1919
This software can be deployed just next to a MONARC instance or on a
2020
dedicated server.

docs/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ Connect to the session:
310310
183221.statsservice (02/25/21 10:56:59) (Detached)
311311
1 Socket in /var/run/screen/S-cedric.
312312
$ screen -xS 183221.statsservice
313-
$
313+
$
314314
315315
316316

docs/stats.rst

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -119,59 +119,59 @@ Risks
119119
"current": {
120120
"informational": {
121121
"High risks": {
122-
"2020-10-01": 8.0,
122+
"2020-10-01": 8.0,
123123
"2020-10-12": 8.0
124-
},
124+
},
125125
"Low risks": {
126-
"2020-10-01": 66.0,
126+
"2020-10-01": 66.0,
127127
"2020-10-12": 12.0
128-
},
128+
},
129129
"Medium risks": {
130-
"2020-10-01": 27.0,
130+
"2020-10-01": 27.0,
131131
"2020-10-12": 27.0
132132
}
133-
},
133+
},
134134
"operational": {
135135
"High risks": {
136-
"2020-10-01": 10.0,
136+
"2020-10-01": 10.0,
137137
"2020-10-12": 10.0
138-
},
138+
},
139139
"Low risks": {
140-
"2020-10-01": 18.0,
140+
"2020-10-01": 18.0,
141141
"2020-10-12": 18.0
142-
},
142+
},
143143
"Medium risks": {
144-
"2020-10-01": 0.0,
144+
"2020-10-01": 0.0,
145145
"2020-10-12": 0.0
146146
}
147147
}
148-
},
148+
},
149149
"residual": {
150150
"informational": {
151151
"High risks": {
152-
"2020-10-01": 1.0,
152+
"2020-10-01": 1.0,
153153
"2020-10-12": 1.0
154-
},
154+
},
155155
"Low risks": {
156-
"2020-10-01": 74.0,
156+
"2020-10-01": 74.0,
157157
"2020-10-12": 74.0
158-
},
158+
},
159159
"Medium risks": {
160-
"2020-10-01": 26.0,
160+
"2020-10-01": 26.0,
161161
"2020-10-12": 26.0
162162
}
163-
},
163+
},
164164
"operational": {
165165
"High risks": {
166-
"2020-10-01": 0.0,
166+
"2020-10-01": 0.0,
167167
"2020-10-12": 0.0
168-
},
168+
},
169169
"Low risks": {
170-
"2020-10-01": 28.0,
170+
"2020-10-01": 28.0,
171171
"2020-10-12": 28.0
172-
},
172+
},
173173
"Medium risks": {
174-
"2020-10-01": 0.0,
174+
"2020-10-01": 0.0,
175175
"2020-10-12": 0.0
176176
}
177177
}
@@ -185,25 +185,25 @@ Risks
185185
{
186186
"current": {
187187
"informational": {
188-
"High risks": 8.0,
189-
"Low risks": 30.0,
188+
"High risks": 8.0,
189+
"Low risks": 30.0,
190190
"Medium risks": 27.0
191-
},
191+
},
192192
"operational": {
193-
"High risks": 10.0,
194-
"Low risks": 18.0,
193+
"High risks": 10.0,
194+
"Low risks": 18.0,
195195
"Medium risks": 0.0
196196
}
197-
},
197+
},
198198
"residual": {
199199
"informational": {
200-
"High risks": 1.0,
201-
"Low risks": 74.0,
200+
"High risks": 1.0,
201+
"Low risks": 74.0,
202202
"Medium risks": 26.0
203-
},
203+
},
204204
"operational": {
205-
"High risks": 0.0,
206-
"Low risks": 28.0,
205+
"High risks": 0.0,
206+
"Low risks": 28.0,
207207
"Medium risks": 0.0
208208
}
209209
}

0 commit comments

Comments
 (0)