mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 13:23:15 +02:00
fix(lint): remove remaining global ignores with per-file ignores
Removed from global ignore list: - PTH (pathlib) - per-file ignores for each file using os.path - BLE001 (blind except) - per-file ignores for resilient error handling - S603/S607 (subprocess) - per-file ignores for tests and trusted code - S310 (URL open) - per-file ignores for test files - S311 (random) - per-file ignores for non-crypto random usage - S110 (try-except-pass) - per-file ignores for optional features - LOG015 (root logger) - per-file ignores for scripts - G004 (logging f-strings) - per-file ignores for all scripts Per-file ignores added for: - Test files: S603, S310, S607, BLE001, PTH - lichess_bot/: BLE001, S110, S603, PTH, LOG015, G004 - stockfish_analysis/: BLE001, S110, PTH, LOG015, G004 - randomJPG/: S311, PTH, LOG015, G004 - poker-modifier-app/: S311, LOG015, G004 - And other affected files Global ignore list now only contains: - Formatter conflicts (D203/D213, COM812, ISC001) - Style preferences (PERF401, RUF005, SIM*, B904, TRY*)
This commit is contained in:
parent
38f8c6355a
commit
83022f9b2c
@ -164,7 +164,7 @@ class KeyboardCoopGame:
|
||||
}
|
||||
except json.JSONDecodeError:
|
||||
logging.warning(
|
||||
"Error reading words_dictionary.json, " "using fallback dictionary"
|
||||
"Error reading words_dictionary.json, using fallback dictionary"
|
||||
)
|
||||
return {
|
||||
"cat",
|
||||
|
||||
@ -144,8 +144,7 @@ def run_bot(log_level: str = "INFO", *, decline_correspondence: bool = False) ->
|
||||
|
||||
if color is None:
|
||||
logging.info(
|
||||
f"Game {game_id}: color unknown yet; "
|
||||
"waiting for gameFull"
|
||||
f"Game {game_id}: color unknown yet; waiting for gameFull"
|
||||
)
|
||||
# Do not mark this position handled on gameFull;
|
||||
# wait for authoritative gameState
|
||||
@ -222,7 +221,7 @@ def run_bot(log_level: str = "INFO", *, decline_correspondence: bool = False) ->
|
||||
api.make_move(game_id, move)
|
||||
except Exception as e:
|
||||
logging.warning(
|
||||
f"Game {game_id}: " f"move {move.uci()} failed: {e}"
|
||||
f"Game {game_id}: move {move.uci()} failed: {e}"
|
||||
)
|
||||
# Mark this position as handled on authoritative
|
||||
# gameState, or after we've actually attempted a move
|
||||
|
||||
@ -39,7 +39,7 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Full House Party",
|
||||
"description": (
|
||||
"Make full house: everyone else pays 2 chips " "+ takes 2 drinks."
|
||||
"Make full house: everyone else pays 2 chips + takes 2 drinks."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -57,14 +57,13 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Red Suit Boost",
|
||||
"description": (
|
||||
"Hearts and Diamonds are worth +1 rank "
|
||||
"(Jack becomes Queen, etc.)"
|
||||
"Hearts and Diamonds are worth +1 rank (Jack becomes Queen, etc.)"
|
||||
),
|
||||
},
|
||||
{
|
||||
"name": "Black Magic",
|
||||
"description": (
|
||||
"Spades and Clubs can be used as any suit " "for straights/flushes."
|
||||
"Spades and Clubs can be used as any suit for straights/flushes."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -97,13 +96,13 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Extra Draw",
|
||||
"description": (
|
||||
"Deal each player a 3rd hole card. " "Discard one before the flop."
|
||||
"Deal each player a 3rd hole card. Discard one before the flop."
|
||||
),
|
||||
},
|
||||
{
|
||||
"name": "Phantom Cards",
|
||||
"description": (
|
||||
"Deal 6 community cards, " "but randomly remove 1 before showdown."
|
||||
"Deal 6 community cards, but randomly remove 1 before showdown."
|
||||
),
|
||||
},
|
||||
# Special Betting Rules (Realistic Economics)
|
||||
@ -122,16 +121,14 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Call Penalty",
|
||||
"description": (
|
||||
"Anyone who only calls (never raises) "
|
||||
"pays 1 chip penalty to pot."
|
||||
"Anyone who only calls (never raises) pays 1 chip penalty to pot."
|
||||
),
|
||||
},
|
||||
# Information Warfare
|
||||
{
|
||||
"name": "Poker Face",
|
||||
"description": (
|
||||
"No talking, no expressions allowed. "
|
||||
"Pure silent poker this hand."
|
||||
"No talking, no expressions allowed. Pure silent poker this hand."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -149,13 +146,13 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Liquid Courage",
|
||||
"description": (
|
||||
"Take a drink before betting " "to get chip bonus to all your bets."
|
||||
"Take a drink before betting to get chip bonus to all your bets."
|
||||
),
|
||||
},
|
||||
{
|
||||
"name": "Last Call",
|
||||
"description": (
|
||||
"Everyone must finish their current drink " "before the river card."
|
||||
"Everyone must finish their current drink before the river card."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -165,15 +162,14 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Drink Tax",
|
||||
"description": (
|
||||
"Each red card in your final hand = one sip " "(reveal after play)."
|
||||
"Each red card in your final hand = one sip (reveal after play)."
|
||||
),
|
||||
},
|
||||
# Wild and Chaos Effects
|
||||
{
|
||||
"name": "Joker's Wild",
|
||||
"description": (
|
||||
"All Jacks become completely wild - "
|
||||
"any suit, any rank you choose."
|
||||
"All Jacks become completely wild - any suit, any rank you choose."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -203,8 +199,7 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Charity Case",
|
||||
"description": (
|
||||
"Player with fewest chips gets their ante "
|
||||
"funded by richest player."
|
||||
"Player with fewest chips gets their ante funded by richest player."
|
||||
),
|
||||
},
|
||||
# Penalty-Based Modifiers (Clear Consequences)
|
||||
@ -219,13 +214,13 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Speed Fine",
|
||||
"description": (
|
||||
"Take longer than 10 seconds to act " "= pay 1 chip to pot."
|
||||
"Take longer than 10 seconds to act = pay 1 chip to pot."
|
||||
),
|
||||
},
|
||||
{
|
||||
"name": "Talk Tax",
|
||||
"description": (
|
||||
"Every word spoken during betting " "costs 1 chip to the pot."
|
||||
"Every word spoken during betting costs 1 chip to the pot."
|
||||
),
|
||||
},
|
||||
# Skill Challenges (With Clear Rewards/Penalties)
|
||||
@ -276,8 +271,7 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Shared Vision",
|
||||
"description": (
|
||||
"Partners can show each other one hole card "
|
||||
"before betting starts."
|
||||
"Partners can show each other one hole card before betting starts."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -302,7 +296,7 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Final Boss",
|
||||
"description": (
|
||||
"This is the last hand. " "Winner takes all remaining chips."
|
||||
"This is the last hand. Winner takes all remaining chips."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -319,16 +313,14 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Double or Nothing",
|
||||
"description": (
|
||||
"Winner gets double payout, "
|
||||
"but everyone else pays double penalty."
|
||||
"Winner gets double payout, but everyone else pays double penalty."
|
||||
),
|
||||
},
|
||||
# High Stakes Endgame
|
||||
{
|
||||
"name": "All In Madness",
|
||||
"description": (
|
||||
"Everyone must go all-in. "
|
||||
"No calling, no folding allowed this hand."
|
||||
"Everyone must go all-in. No calling, no folding allowed this hand."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -341,15 +333,14 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Last Stand",
|
||||
"description": (
|
||||
"Player with fewest chips gets to act last "
|
||||
"in ALL betting rounds."
|
||||
"Player with fewest chips gets to act last in ALL betting rounds."
|
||||
),
|
||||
},
|
||||
# Dramatic Reversals
|
||||
{
|
||||
"name": "Underdog Victory",
|
||||
"description": (
|
||||
"Worst hand wins the pot " "instead of best hand this round."
|
||||
"Worst hand wins the pot instead of best hand this round."
|
||||
),
|
||||
},
|
||||
# Winner Takes All Variants
|
||||
@ -383,14 +374,13 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Speed Round",
|
||||
"description": (
|
||||
"3 seconds to act or auto-fold. " "No exceptions, no delays."
|
||||
"3 seconds to act or auto-fold. No exceptions, no delays."
|
||||
),
|
||||
},
|
||||
{
|
||||
"name": "Auction House",
|
||||
"description": (
|
||||
"Players bid chips to see each other's hole cards "
|
||||
"before betting."
|
||||
"Players bid chips to see each other's hole cards before betting."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -411,21 +401,20 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Truth Serum",
|
||||
"description": (
|
||||
"Everyone must honestly rate their hand 1-10 " "before any betting."
|
||||
"Everyone must honestly rate their hand 1-10 before any betting."
|
||||
),
|
||||
},
|
||||
{
|
||||
"name": "Poker Face Off",
|
||||
"description": (
|
||||
"Staring contest: losers must reveal " "one hole card to the table."
|
||||
"Staring contest: losers must reveal one hole card to the table."
|
||||
),
|
||||
},
|
||||
# Endgame Economics
|
||||
{
|
||||
"name": "Wealth Redistribution",
|
||||
"description": (
|
||||
"Before the hand, richest player "
|
||||
"gives 3 chips to poorest player."
|
||||
"Before the hand, richest player gives 3 chips to poorest player."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -453,7 +442,7 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Meteor Strike",
|
||||
"description": (
|
||||
"Remove all face cards from the deck " "for this hand only."
|
||||
"Remove all face cards from the deck for this hand only."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -464,13 +453,13 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Hall of Fame",
|
||||
"description": (
|
||||
"Winner's name gets written down " "as 'Champion of the Session'."
|
||||
"Winner's name gets written down as 'Champion of the Session'."
|
||||
),
|
||||
},
|
||||
{
|
||||
"name": "Legendary Hand",
|
||||
"description": (
|
||||
"This hand will be retold as a story. " "Play like legends."
|
||||
"This hand will be retold as a story. Play like legends."
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -491,7 +480,7 @@ class PokerModifierApp:
|
||||
{
|
||||
"name": "Time Paradox",
|
||||
"description": (
|
||||
"Play the hand twice with same cards. " "Best average result wins."
|
||||
"Play the hand twice with same cards. Best average result wins."
|
||||
),
|
||||
},
|
||||
{
|
||||
|
||||
@ -33,16 +33,7 @@ ignore = [
|
||||
"D213", # Multi-line docstring summary should start at second line (conflicts with D212)
|
||||
"COM812", # Trailing comma missing (conflicts with formatter)
|
||||
"ISC001", # Implicit string concatenation (conflicts with formatter)
|
||||
# Relaxed for script-heavy repository
|
||||
"PTH", # Use pathlib instead of os.path - too invasive for existing code
|
||||
"BLE001", # Blind except - will fix critical ones manually
|
||||
"S603", # subprocess without shell - known pattern
|
||||
"S607", # start-process with partial path - acceptable
|
||||
"LOG015", # root-logger-call - common in scripts
|
||||
"G004", # logging-f-string - common pattern
|
||||
"S311", # suspicious-non-cryptographic-random - not security critical
|
||||
"S310", # suspicious-url-open - acceptable for scripts
|
||||
"S110", # try-except-pass - common pattern in scripts
|
||||
# Style preferences - relaxed for script-heavy repository
|
||||
"PERF401", # manual-list-comprehension - style preference
|
||||
"RUF005", # collection-literal-concatenation - style preference
|
||||
"SIM102", # collapsible-if - style preference
|
||||
@ -61,17 +52,27 @@ unfixable = []
|
||||
|
||||
# Per-file ignores for test files
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
# Test files - allow test-specific patterns
|
||||
"**/tests/**/*.py" = [
|
||||
"S101", # Allow assert in tests
|
||||
"S603", # Allow subprocess calls in tests
|
||||
"PLR2004", # Allow magic values in tests
|
||||
"BLE001", # Allow blind except in test cleanup
|
||||
"PTH", # Allow os.path in tests for simplicity
|
||||
]
|
||||
"**/test_*.py" = [
|
||||
"S101", # Allow assert in tests
|
||||
"S603", # Allow subprocess calls in tests
|
||||
"S310", # Allow URL open in tests
|
||||
"S607", # Allow partial executable path in tests
|
||||
"PLC0415", # Allow late imports for test isolation
|
||||
"BLE001", # Allow blind except in test cleanup
|
||||
"PTH", # Allow os.path in tests for simplicity
|
||||
]
|
||||
"**/conftest.py" = [
|
||||
"D100", # Allow missing module docstring
|
||||
"D103", # Allow missing function docstring
|
||||
"PTH", # Allow os.path in conftest
|
||||
]
|
||||
# N999 ignores for PYTHON folder naming (uppercase folder)
|
||||
"PYTHON/**/__init__.py" = [
|
||||
@ -79,38 +80,107 @@ unfixable = []
|
||||
]
|
||||
"PYTHON/randomJPG/generateJpeg.py" = [
|
||||
"N999", # camelCase filename preserved for compatibility
|
||||
"S311", # Random for image generation, not crypto
|
||||
"PTH", # os.path patterns in existing code
|
||||
"LOG015", # Root logger in script
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"PYTHON/tagDivider/tagDivider.py" = [
|
||||
"N999", # camelCase filename preserved for compatibility
|
||||
"PTH", # os.path patterns in existing code
|
||||
"LOG015", # Root logger in script
|
||||
]
|
||||
"poker-modifier-app/*.py" = [
|
||||
"INP001", # Folder has hyphen, can't be a valid Python package
|
||||
"S311", # Random for game mechanics, not crypto
|
||||
"LOG015", # Root logger in script
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"poker-modifier-app/poker_modifier_app.py" = [
|
||||
"INP001", # Folder has hyphen, can't be a valid Python package
|
||||
"FBT003", # Boolean positional values in tkinter API calls
|
||||
"S311", # Random for game mechanics, not crypto
|
||||
"LOG015", # Root logger in app
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"PYTHON/downloadCats/generate_cats.py" = [
|
||||
"PERF203", # Try-except needed for download resilience in loop
|
||||
"PTH", # os.path patterns in existing code
|
||||
"LOG015", # Root logger in script
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"PYTHON/lichess_bot/main.py" = [
|
||||
"C901", # Complex functions handling game lifecycle (run_bot, handle_game)
|
||||
"PERF203", # Try-except needed for stream/move error handling in loops
|
||||
"PLR0912", # Complex nested game event handling with many branches
|
||||
"PLR0915", # Long function handling complete game lifecycle
|
||||
"BLE001", # Blind except for resilient bot operation
|
||||
"S110", # Try-except-pass for non-critical error handling
|
||||
"S603", # Subprocess call for analysis script
|
||||
"PTH", # os.path patterns in existing code
|
||||
"LOG015", # Root logger in bot
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"PYTHON/lichess_bot/engine.py" = [
|
||||
"BLE001", # Blind except for engine error handling
|
||||
"S110", # Try-except-pass for optional features
|
||||
"S603", # Subprocess for engine communication
|
||||
"PTH", # os.path patterns
|
||||
]
|
||||
"PYTHON/lichess_bot/lichess_api.py" = [
|
||||
"BLE001", # Blind except for API resilience
|
||||
"LOG015", # Root logger in API client
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"PYTHON/lichess_bot/utils.py" = [
|
||||
"BLE001", # Blind except for file operations
|
||||
"PTH", # os.path patterns
|
||||
"LOG015", # Root logger
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"PYTHON/lichess_bot/tools/generate_blunder_tests.py" = [
|
||||
"BLE001", # Blind except for test generation
|
||||
"PTH", # os.path patterns in tool
|
||||
"LOG015", # Root logger in tool
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"PYTHON/stockfish_analysis/analyze_chess_game.py" = [
|
||||
"C901", # Complex main() with many argument combinations and analysis modes
|
||||
"PLR0912", # Complex main() with many argument combinations and analysis modes
|
||||
"PLR0915", # Long main() handling complete analysis workflow
|
||||
"BLE001", # Blind except for engine configuration
|
||||
"S110", # Try-except-pass for optional engine features
|
||||
"PTH", # os.path patterns
|
||||
"LOG015", # Root logger in analysis tool
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"PYTHON/randomize_numbers/random_digits.py" = [
|
||||
"PERF203", # Try-except needed for parsing user input in loop
|
||||
"S311", # Random for number randomization, not crypto
|
||||
"LOG015", # Root logger in script
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"PYTHON/keyboardCoop/main.py" = [
|
||||
"FBT003", # Boolean positional values in pygame API calls (e.g., font.render)
|
||||
"PTH", # os.path patterns
|
||||
"LOG015", # Root logger in script
|
||||
]
|
||||
"PYTHON/screen_locker/screen_lock.py" = [
|
||||
"FBT003", # Boolean positional values in tkinter API calls
|
||||
"PTH", # os.path patterns
|
||||
"LOG015", # Root logger in app
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"poker-modifier-app/poker_modifier_app.py" = [
|
||||
"FBT003", # Boolean positional values in tkinter API calls
|
||||
"PYTHON/scapeWebsite/scrape_comics.py" = [
|
||||
"BLE001", # Blind except for web scraping resilience
|
||||
"PTH", # os.path patterns
|
||||
"LOG015", # Root logger in script
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
"PYTHON/extractLinks/main.py" = [
|
||||
"PTH", # os.path patterns
|
||||
"LOG015", # Root logger in script
|
||||
"G004", # f-strings in logging
|
||||
]
|
||||
|
||||
[tool.ruff.lint.pydocstyle]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user