Skip to content

Commit b55af35

Browse files
committed
[Changed] W009 and W044 only displayed if --warn-all is used
These two warnings are important, but you'll face them all the time. So now they are displayed only when the user wants all of them.
1 parent fd4e0dc commit b55af35

8 files changed

Lines changed: 30 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- PCB stats (pcb_stats): The KiCad 10 PCB statistics
1414
- CLI:
1515
- --fail-on-warnings: to return error when we detected warning (See #828)
16+
- --warn-all: to display some warnings that you'll find during common use
1617
- Schematic: Support for private text on symbols (#914)
1718
- generic filter: `exclude_kicad_dnp` to exclude components marked as DNP in
1819
KiCad (See #887)
@@ -55,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5556
- `--fail-on-warnings` now ignores filtered warning (as the help suggested)
5657
and you can get the old behavior adding `--fail-on-ignored` (#893)
5758
- 3D models: GitLab URL. Because the old URL is now blocked.
59+
- W009 and W044 warnings promoted to "common use" warnings
5860

5961

6062
## [1.8.5] - 2025-11-26

docs/source/Changelog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Added
2929

3030
- –fail-on-warnings: to return error when we detected warning (See
3131
#828)
32+
- –warn-all: to display some warnings that you’ll find during common
33+
use
3234

3335
- Schematic: Support for private text on symbols (#914)
3436
- generic filter: ``exclude_kicad_dnp`` to exclude components marked as
@@ -89,6 +91,7 @@ Changed
8991
suggested) and you can get the old behavior adding
9092
``--fail-on-ignored`` (#893)
9193
- 3D models: GitLab URL. Because the old URL is now blocked.
94+
- W009 and W044 warnings promoted to “common use” warnings
9295

9396
`1.8.5 <https://github.com/INTI-CMNB/KiBot/compare/v1.8.4...v1.8.5>`__ - 2025-11-26
9497
-----------------------------------------------------------------------------------

docs/source/usage.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Usage:
44
kibot [-b BOARD] [-e SCHEMA] [-c CONFIG] [-d OUT_DIR] [-s PRE]
55
[-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ...
66
[-E DEF] ... [--defs-from-env] [--defs-from-project] [-w LIST] [-D | -W]
7-
[--fail-on-warnings] [-F] [--warn-ci-cd] [--banner N]
7+
[--fail-on-warnings] [-F] [--warn-ci-cd] [--warn-all] [--banner N]
88
[--gui | --internal-check] [-I INJECT] [--variant VAR] ... [TARGET...]
99
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N]
1010
[-E DEF] ... [--defs-from-env] [--config-outs]
@@ -90,6 +90,7 @@ Options:
9090
list of variants
9191
-w, --no-warn LIST Exclude the mentioned warnings (comma sep)
9292
-W, --stop-on-warnings Stop on warnings
93+
--warn-all Enables some common use warnings
9394
--warn-ci-cd Don't disable warnings expected on CI/CD
9495
environments
9596
-x, --example Create a template configuration file

kibot/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
kibot [-b BOARD] [-e SCHEMA] [-c CONFIG] [-d OUT_DIR] [-s PRE]
1212
[-q | -v...] [-L LOGFILE] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ...
1313
[-E DEF] ... [--defs-from-env] [--defs-from-project] [-w LIST] [-D | -W]
14-
[--fail-on-warnings] [-F] [--warn-ci-cd] [--banner N]
14+
[--fail-on-warnings] [-F] [--warn-ci-cd] [--warn-all] [--banner N]
1515
[--gui | --internal-check] [-I INJECT] [--variant VAR] ... [TARGET...]
1616
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N]
1717
[-E DEF] ... [--defs-from-env] [--config-outs]
@@ -97,6 +97,7 @@
9797
list of variants
9898
-w, --no-warn LIST Exclude the mentioned warnings (comma sep)
9999
-W, --stop-on-warnings Stop on warnings
100+
--warn-all Enables some common use warnings
100101
--warn-ci-cd Don't disable warnings expected on CI/CD
101102
environments
102103
-x, --example Create a template configuration file
@@ -535,6 +536,7 @@ def main():
535536
apply_warning_filter(args)
536537
log.stop_on_warnings = args.stop_on_warnings
537538
log.dont_stop = args.dont_stop
539+
log.warn_all = args.warn_all
538540
logger.debugl(2, f'Command line options: {args}')
539541

540542
# Now we have the debug level set we can check (and optionally inform) KiCad info

kibot/kicad/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (c) 2020-2025 Salvador E. Tropea
3-
# Copyright (c) 2020-2025 Instituto Nacional de Tecnología Industrial
2+
# Copyright (c) 2020-2026 Salvador E. Tropea
3+
# Copyright (c) 2020-2026 Instituto Nacional de Tecnología Industrial
44
# License: AGPL-3.0
55
# Project: KiBot (formerly KiPlot)
66
"""
@@ -29,7 +29,7 @@
2929
from ..gs import GS
3030
from .. import log
3131
from ..misc import (W_NOCONFIG, W_NOKIENV, W_NOLIBS, W_NODEFSYMLIB, MISSING_WKS, W_MAXDEPTH, W_3DRESVER, W_LIBTVERSION,
32-
W_LIBTUNK, W_MISLIBTAB, EMBED_PREFIX)
32+
W_LIBTUNK, W_MISLIBTAB, EMBED_PREFIX, W_SILLY)
3333
from .sexpdata import load, SExpData, Symbol, dumps, Sep
3434
from .sexp_helpers import _check_is_symbol_list, _check_integer, _check_relaxed
3535

@@ -372,7 +372,7 @@ def load_ki6_env(cfg):
372372
logger.debug('- KiCad var: {}="{}"'.format(k, v))
373373
KiConf.kicad_env[k] = v
374374
else:
375-
logger.warning(W_NOKIENV + 'KiCad config without environment.vars section')
375+
logger.warning(W_SILLY + W_NOKIENV + 'KiCad config without environment.vars section')
376376

377377
def _look_env_var(base_name, old, only_old, ki6_diff, no_dir):
378378
""" Looks for a KiCad variable definition.

kibot/kiplot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
MOD_VIRTUAL, W_PCBNOSCH, W_NONEEDSKIP, W_WRONGCHAR, name2make, W_TIMEOUT, W_KIAUTO, W_VARSCH,
2929
NO_SCH_FILE, NO_PCB_FILE, W_VARPCB, NO_YAML_MODULE, WRONG_ARGUMENTS, FAILED_EXECUTE, W_VALMISMATCH,
3030
MOD_EXCLUDE_FROM_POS_FILES, MOD_EXCLUDE_FROM_BOM, MOD_BOARD_ONLY, hide_stderr, W_MAXDEPTH, DONT_STOP,
31-
W_BADREF, try_decode_utf8, MISSING_FILES, KICAD_VERSION_9_0_1, W_NOUUIDMAP)
31+
W_BADREF, try_decode_utf8, MISSING_FILES, KICAD_VERSION_9_0_1, W_NOUUIDMAP, W_SILLY)
3232
from .error import PlotError, KiPlotConfigurationError, config_error, KiPlotError
3333
from .config_reader import CfgYamlReader
3434
from .pre_base import BasePreFlight
@@ -1002,6 +1002,7 @@ def solve_schematic(base_dir, a_schematic=None, a_board_file=None, config=None,
10021002
schematic = schematics[0]
10031003
logger.info('Using SCH file: '+os.path.relpath(schematic))
10041004
elif len(schematics) > 1:
1005+
is_silly = W_SILLY
10051006
# Look for a schematic with the same name as the config
10061007
if config:
10071008
if config[0] == '.':
@@ -1035,12 +1036,13 @@ def solve_schematic(base_dir, a_schematic=None, a_board_file=None, config=None,
10351036
break
10361037
else:
10371038
# No way to select one, just take the first
1039+
is_silly = ''
10381040
if GS.ki6:
10391041
schematic = guess_ki6_sch(schematics)
10401042
if not schematic:
10411043
schematic = schematics[0]
10421044
msg = ' if you want to use another use -e option' if sug_e else ''
1043-
logger.warning(W_VARSCH + 'More than one SCH file found in `'+base_dir+'`.\n'
1045+
logger.warning(is_silly+W_VARSCH+'More than one SCH file found in `'+base_dir+'`.\n'
10441046
' Using '+schematic+msg+'.')
10451047
if schematic and not os.path.isfile(schematic):
10461048
GS.exit_with_error("Schematic file not found: "+schematic, NO_SCH_FILE)

kibot/log.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import sys
1616
import traceback
1717
import logging
18-
from .misc import WARN_AS_ERROR
18+
from .misc import WARN_AS_ERROR, W_SILLY
1919
no_colorama = False
2020
try:
2121
from colorama import init as colorama_init, Fore, Back, Style
@@ -39,6 +39,7 @@
3939
recorded_error_msgs = []
4040
re_dk_client_id = re.compile("DIGIKEY_CLIENT_ID=([^']+)")
4141
re_dk_client_secret = re.compile("DIGIKEY_CLIENT_SECRET=([^']+)")
42+
warn_all = False
4243

4344

4445
def get_logger(name=None, indent=None):
@@ -105,6 +106,10 @@ def warning(self, msg, *args, **kwargs):
105106
# buf = buf.getvalue()
106107
# else:
107108
buf = str(msg)
109+
is_silly = False
110+
if buf.startswith(W_SILLY):
111+
buf = buf[len(W_SILLY):]
112+
is_silly = True
108113
# Avoid repeated warnings
109114
if buf in MyLogger.warn_hash:
110115
MyLogger.warn_hash[buf] += 1
@@ -124,6 +129,11 @@ def warning(self, msg, *args, **kwargs):
124129
MyLogger.n_filtered += 1
125130
self.debug('Filtered warning: '+buf, **kwargs)
126131
return
132+
# Are we showing very silly warnings?
133+
# global warn_all
134+
if not warn_all and is_silly:
135+
self.debug('Silly warning: ', **kwargs)
136+
return
127137
MyLogger.warn_cnt += 1
128138
MyLogger.warn_hash[buf] = 1
129139
if sys.version_info >= (3, 8):

kibot/misc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
'RUB', 'TRY', 'AUD', 'BRL', 'CAD', 'CNY', 'HKD', 'IDR', 'ILS', 'INR', 'KRW', 'MXN', 'MYR', 'NZD', 'PHP',
166166
'SGD', 'THB', 'ZAR'}
167167

168+
W_SILLY = '*'
168169
W_VARCFG = '(W001) '
169170
W_VARPCB = '(W002) '
170171
W_PYCACHE = '(W003) '

0 commit comments

Comments
 (0)