Skip to content

Conversation

@Ayush10
Copy link

@Ayush10 Ayush10 commented Jan 28, 2026

Summary

Fix all 20 instances of R1710 (inconsistent-return-statements) pylint errors across the codebase.

This is a partial fix for #1007 - focusing on a single, well-defined pylint rule that can be re-enabled after this PR.

Changes

  • Add explicit return None for functions with conditional returns
  • Change elif to else where assert guarantees the condition
  • Add raise ValueError for invalid parameter values in switch-like functions
  • Fix generator function that mixed return [] with yield

Files Modified (18 files)

  • qlib/backtest/profit_attribution.py
  • qlib/backtest/utils.py
  • qlib/contrib/data/utils/sepdf.py
  • qlib/contrib/model/pytorch_adarnn.py
  • qlib/contrib/report/analysis_model/analysis_model_performance.py
  • qlib/contrib/report/analysis_position/*.py (5 files)
  • qlib/contrib/strategy/optimizer/optimizer.py
  • qlib/data/cache.py
  • qlib/data/data.py
  • qlib/utils/index_data.py
  • qlib/workflow/exp.py
  • qlib/workflow/expm.py
  • qlib/workflow/online/update.py
  • qlib/workflow/record_temp.py

Test Plan

  • Verified pylint --enable=R1710 qlib now passes (0 errors)
  • No functional changes - only return statement consistency fixes

Next Steps

After this PR is merged, R1710 can be removed from the disabled list in the Makefile.

Partial fix for #1007

Fix all 20 instances of R1710 (inconsistent-return-statements) pylint
errors across the codebase. This enables the R1710 rule to be removed
from the disabled list in the Makefile.

Changes:
- Add explicit `return None` for functions with conditional returns
- Change `elif` to `else` where assert guarantees the condition
- Add `raise ValueError` for invalid parameter values in switch-like functions
- Fix generator function that mixed `return []` with `yield`

Files modified:
- qlib/backtest/profit_attribution.py
- qlib/backtest/utils.py
- qlib/contrib/data/utils/sepdf.py
- qlib/contrib/model/pytorch_adarnn.py
- qlib/contrib/report/analysis_model/analysis_model_performance.py
- qlib/contrib/report/analysis_position/*.py (5 files)
- qlib/contrib/strategy/optimizer/optimizer.py
- qlib/data/cache.py
- qlib/data/data.py
- qlib/utils/index_data.py
- qlib/workflow/exp.py
- qlib/workflow/expm.py
- qlib/workflow/online/update.py
- qlib/workflow/record_temp.py

Partial fix for microsoft#1007
@Ayush10
Copy link
Author

Ayush10 commented Jan 28, 2026

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant