Skip to content

Commit 25a9d93

Browse files
committed
ci: Update semgrep job
1 parent 44e0bde commit 25a9d93

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

.github/workflows/security.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,17 @@ jobs:
2323
runs-on: ubuntu-latest
2424
if: "!startsWith(github.event.head_commit.message, 'bump:')"
2525
container:
26-
image: returntocorp/semgrep:latest
26+
image: returntocorp/semgrep:1.128.1@sha256:fca58525689355641019c05ab49dcc5bc3a1eb7e044f35014ee39594b5aa4fc1
2727
steps:
2828
- uses: actions/checkout@v4
29+
- name: Cache Python files
30+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.1
31+
with:
32+
path: ~/.cache/semgrep
33+
key: semgrep-${{ runner.os }}
34+
retention-days: 30
35+
restore-keys: |
36+
semgrep-${{ runner.os }}
2937
- name: Run Semgrep
3038
run: |
31-
semgrep scan --config auto
39+
semgrep scan --config auto --error

eval/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from eval.classified_articles import NON_RELEVANT_ARTICLES, RELEVANT_ARTICLES
88
from eval.constants import DEFAULT_EVAL_CONFIG_SECTION
9-
from eval.evaluator import eval
9+
from eval.evaluator import evaluate
1010
from eval.utils import EvalConfig, EvalFileConfig
1111

1212

@@ -68,7 +68,7 @@ def run(
6868
}
6969
)
7070

71-
eval(
71+
evaluate(
7272
score_threshold=eval_config.score_threshold,
7373
relevant_articles=RELEVANT_ARTICLES,
7474
non_relevant_articles=NON_RELEVANT_ARTICLES,

eval/evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
logger = logging.getLogger("eval")
1111

1212

13-
def eval(
13+
def evaluate(
1414
prompt: str,
1515
score_threshold: int,
1616
relevant_articles: set[Article],

tests/eval/test_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class TestEvalCli:
11-
@patch("eval.cli.eval")
11+
@patch("eval.cli.evaluate")
1212
@patch("eval.cli.load_dotenv")
1313
@patch("eval.cli.EvalFileConfig.get_config_from_file")
1414
@patch("eval.cli.PromptConfig.get_config_from_file")
@@ -36,7 +36,7 @@ def test_env_file_parameter(self, m_prompt: Mock, m_config: Mock, m_load_dotenv:
3636
assert result.exit_code == 0
3737
assert m_load_dotenv.call_args == call("custom.env")
3838

39-
@patch("eval.cli.eval")
39+
@patch("eval.cli.evaluate")
4040
@patch("eval.cli.load_dotenv")
4141
@patch("eval.cli.EvalFileConfig.get_config_from_file")
4242
@patch("eval.cli.PromptConfig.get_config_from_file")

0 commit comments

Comments
 (0)