Skip to content

Commit

Permalink
Add ruff to the testing
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss committed Jan 28, 2025
1 parent a59ca65 commit a7fd846
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ jobs:
strategy:
matrix:
python-version: ${{ fromJSON(needs.Envvars.outputs.version_matrix) }}
task: [Typecheck, Lint, Yapf, Test]
task: [Typecheck, Lint, Ruff, Yapf, Test]
include:
- task: Typecheck
cmd: pytype -j auto .
- task: Lint
cmd: pylint --rcfile .pylintrc --recursive yes .
- task: Ruff
cmd: pipx run ruff==0.9.3 check
- task: Yapf
cmd: yapf . -drp
- task: Test
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ dm-reverb = "==0.14.0"
pylint = "==3.3.2"
pytest = "==8.3.4"
pytype = "==2024.10.11"
ruff = "==0.9.3"
yapf = "==0.43.0"

[ci]
joblib = "==1.4.2"
shap = "==0.46.0"

14 changes: 6 additions & 8 deletions compiler_opt/es/blackbox_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,12 @@ def __init__(self, train_corpus: corpus.Corpus,
def get_results(
self, pool: FixedWorkerPool, perturbations: List[policy_saver.Policy]
) -> List[concurrent.futures.Future]:
job_args = []
for perturbation in perturbations:
job_args.append({
'modules': self._train_corpus.module_specs,
'function_index_path': self._function_index_path,
'bb_trace_path': self._bb_trace_path,
'tflite_policy': perturbation
})
job_args = [{
'modules': self._train_corpus.module_specs,
'function_index_path': self._function_index_path,
'bb_trace_path': self._bb_trace_path,
'tflite_policy': perturbation
} for perturbation in perturbations]

_, futures = buffered_scheduler.schedule_on_worker_pool(
action=lambda w, args: w.compile_corpus_and_evaluate(**args),
Expand Down
2 changes: 1 addition & 1 deletion compiler_opt/es/blackbox_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def compile(self, policy: policy_saver.Policy,

class ESTraceWorker(worker.Worker):
"""Temporary placeholder worker.
This is a test worker for TraceBlackboxEvaluator that expects a slightly
different interface than other workers.
"""
Expand Down
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# DO always create a tracking issue when allow-listing warnings
# DO NOT disable warnings-as-error: warnings of today are tomorrow's evolvability blocker.
[tool.ruff]
line-length = 103
lint.select = [ "C40", "C9", "E", "F", "PERF", "W" ]
lint.ignore = [ "E722", "E731", "E741", "F401", "PERF203" ]
lint.mccabe.max-complexity = 18

[tool.pytest.ini_options]
# DO always create a tracking issue when allow-listing warnings
# DO NOT disable warnings-as-error: warnings of today are tomorrow's evolvability blocker.
filterwarnings = [
# Treat warnings as errors
"error",
Expand Down

0 comments on commit a7fd846

Please sign in to comment.