Skip to content

Commit fed0277

Browse files
authored
License check fix & cleanup (#10)
1 parent bf535c0 commit fed0277

File tree

6 files changed

+22
-70
lines changed

6 files changed

+22
-70
lines changed

cortado/cli.py

+6-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
# or more contributor license agreements. Licensed under the Elastic License
3+
# 2.0; you may not use this file except in compliance with the Elastic License
4+
# 2.0.
5+
16
import logging
27
import sys
38

49
import structlog
510
import typer
611
import json
712

8-
from pathlib import Path
913
from collections import Counter
1014

1115
from rich import box
1216
from rich.table import Table
1317
from rich.console import Console
1418
from rich.text import Text
1519

16-
from cortado import mapping, rules
20+
from cortado import rules
1721
from cortado.rules import RuleMaturity, RuleRelease
1822
from cortado.rtas import get_registry, HashRta
1923
from cortado.utils import configure_logging
@@ -70,21 +74,6 @@ def print_rtas(as_json: bool = False):
7074
console.print(table)
7175

7276

73-
@app.command()
74-
def generate_mapping(mapping_file: Path = mapping.DEFAULT_MAPPING_FILE):
75-
"""
76-
Generate a mapping file that contains rule to RTA relations.
77-
"""
78-
_log = log.bind(path=str(mapping_file))
79-
_log.info("Generating rule-to-RTA mapping file")
80-
81-
data = mapping.generate_mapping()
82-
with open(mapping_file, "w") as f:
83-
json.dump(data, f, sort_keys=True, indent=4)
84-
85-
_log.info("Mapping file saved")
86-
87-
8877
@app.command()
8978
def get_coverage(
9079
rules_glob: Annotated[str | None, typer.Option(help="A path glob that resolves into rule paths")] = None,

cortado/main.py

-1
This file was deleted.

cortado/mapping.py

-50
This file was deleted.

cortado/rules.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
# or more contributor license agreements. Licensed under the Elastic License
3+
# 2.0; you may not use this file except in compliance with the Elastic License
4+
# 2.0.
5+
16
import glob
27
import tomli
38
import structlog

cortado/utils.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
# or more contributor license agreements. Licensed under the Elastic License
3+
# 2.0; you may not use this file except in compliance with the Elastic License
4+
# 2.0.
5+
16
import logging
27
from typing import Any
38

scripts/check-license.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FILE_GLOB=$1
1+
DIR_PATH=$1
22

33
LICENSE_BODY_FILE="scripts/license-header.txt"
44
LICENSE_LINES=$(wc -l $LICENSE_BODY_FILE | xargs | cut -f1 -d ' ')
@@ -9,7 +9,11 @@ rc=0
99
counter_failed=0
1010
counter_all=0
1111

12-
for x in $FILE_GLOB; do
12+
echo "Checking .py files in $DIR_PATH"
13+
14+
for x in $(find $DIR_PATH -name "*.py"); do
15+
16+
# echo "Checking $x"
1317

1418
counter_all=$((counter_all+1))
1519

0 commit comments

Comments
 (0)