[DOCs] Made the filters for ERC/DRC vs globals more clear
- Now the KiBot ones doesn't mention KiCad versions - If the user uses Wxxx for the `error` in the KiBot ones we filter xxx - Added text to clarify how to get rid of W058 warnings - Also now we report warning counts when all filtered Related to #214
This commit is contained in:
parent
599ddcfc5b
commit
49b21c8e93
12
README.md
12
README.md
|
|
@ -362,12 +362,16 @@ This section is used to specify tasks that will be executed before generating an
|
||||||
- `erc_warnings`: [boolean=false] Option for `run_erc`. ERC warnings are considered errors.
|
- `erc_warnings`: [boolean=false] Option for `run_erc`. ERC warnings are considered errors.
|
||||||
- `fill_zones`: [boolean=false] Fill all zones again and save the PCB.
|
- `fill_zones`: [boolean=false] Fill all zones again and save the PCB.
|
||||||
- `filters`: [list(dict)] A list of entries to filter out ERC/DRC messages.
|
- `filters`: [list(dict)] A list of entries to filter out ERC/DRC messages.
|
||||||
|
Note that ignored errors will become KiBot warnings (i.e. `(W058) ...`).
|
||||||
|
To farther ignore these warnings use the `filters` option in the `global` section.
|
||||||
* Valid keys:
|
* Valid keys:
|
||||||
- `error`: [string=''] Error id we want to exclude. A name for KiCad 6 or a number for KiCad 5, but always a string.
|
- `error`: [string=''] Error id we want to exclude.
|
||||||
|
A name for KiCad 6 or a number for KiCad 5, but always a string.
|
||||||
- *error_number*: Alias for number.
|
- *error_number*: Alias for number.
|
||||||
- `filter`: [string=''] Name for the filter, for documentation purposes.
|
- `filter`: [string=''] Name for the filter, for documentation purposes.
|
||||||
- *filter_msg*: Alias for filter.
|
- *filter_msg*: Alias for filter.
|
||||||
- `number`: [number=0] Error number we want to exclude. KiCad 5 only.
|
- `number`: [number=0] Error number we want to exclude.
|
||||||
|
KiCad 5 only.
|
||||||
- `regex`: [string=''] Regular expression to match the text for the error we want to exclude.
|
- `regex`: [string=''] Regular expression to match the text for the error we want to exclude.
|
||||||
- *regexp*: Alias for regex.
|
- *regexp*: Alias for regex.
|
||||||
- `ignore_unconnected`: [boolean=false] Option for `run_drc`. Ignores the unconnected nets. Useful if you didn't finish the routing.
|
- `ignore_unconnected`: [boolean=false] Option for `run_drc`. Ignores the unconnected nets. Useful if you didn't finish the routing.
|
||||||
|
|
@ -700,11 +704,11 @@ global:
|
||||||
- `field_3D_model`: [string='_3D_model'] Name for the field controlling the 3D models used for a component.
|
- `field_3D_model`: [string='_3D_model'] Name for the field controlling the 3D models used for a component.
|
||||||
- `filters`: [list(dict)] KiBot warnings to be ignored.
|
- `filters`: [list(dict)] KiBot warnings to be ignored.
|
||||||
* Valid keys:
|
* Valid keys:
|
||||||
- `error`: [string=''] Error id we want to exclude. A name for KiCad 6 or a number for KiCad 5, but always a string.
|
- `error`: [string=''] Error id we want to exclude.
|
||||||
- *error_number*: Alias for number.
|
- *error_number*: Alias for number.
|
||||||
- `filter`: [string=''] Name for the filter, for documentation purposes.
|
- `filter`: [string=''] Name for the filter, for documentation purposes.
|
||||||
- *filter_msg*: Alias for filter.
|
- *filter_msg*: Alias for filter.
|
||||||
- `number`: [number=0] Error number we want to exclude. KiCad 5 only.
|
- `number`: [number=0] Error number we want to exclude.
|
||||||
- `regex`: [string=''] Regular expression to match the text for the error we want to exclude.
|
- `regex`: [string=''] Regular expression to match the text for the error we want to exclude.
|
||||||
- *regexp*: Alias for regex.
|
- *regexp*: Alias for regex.
|
||||||
- `hide_excluded`: [boolean=false] Default value for the `hide_excluded` option of various PCB outputs.
|
- `hide_excluded`: [boolean=false] Default value for the `hide_excluded` option of various PCB outputs.
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ preflight:
|
||||||
# [boolean=false] Fill all zones again and save the PCB.
|
# [boolean=false] Fill all zones again and save the PCB.
|
||||||
fill_zones: true
|
fill_zones: true
|
||||||
# [list(dict)] A list of entries to filter out ERC/DRC messages.
|
# [list(dict)] A list of entries to filter out ERC/DRC messages.
|
||||||
|
# Note that ignored errors will become KiBot warnings (i.e. `(W058) ...`).
|
||||||
|
# To farther ignore these warnings use the `filters` option in the `global` section.
|
||||||
filters:
|
filters:
|
||||||
- filter: 'Filter description'
|
- filter: 'Filter description'
|
||||||
error: '10'
|
error: '10'
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ from .gs import GS
|
||||||
from .optionable import Optionable
|
from .optionable import Optionable
|
||||||
from .kicad.config import expand_env
|
from .kicad.config import expand_env
|
||||||
from .macros import macros, document # noqa: F401
|
from .macros import macros, document # noqa: F401
|
||||||
from .pre_filters import FiltersOptions
|
from .pre_filters import FiltersOptions, FilterOptionsKiBot
|
||||||
from .log import get_logger, set_filters
|
from .log import get_logger, set_filters
|
||||||
from .misc import W_MUSTBEINT
|
from .misc import W_MUSTBEINT
|
||||||
from .kicad.config import KiConf
|
from .kicad.config import KiConf
|
||||||
|
|
@ -241,6 +241,7 @@ class Globals(FiltersOptions):
|
||||||
The KIPRJMOD is also available for expansion """
|
The KIPRJMOD is also available for expansion """
|
||||||
self.set_doc('filters', " [list(dict)] KiBot warnings to be ignored ")
|
self.set_doc('filters', " [list(dict)] KiBot warnings to be ignored ")
|
||||||
self._filter_what = 'KiBot warnings'
|
self._filter_what = 'KiBot warnings'
|
||||||
|
self.filters = FilterOptionsKiBot
|
||||||
self._unkown_is_error = True
|
self._unkown_is_error = True
|
||||||
self._error_context = 'global '
|
self._error_context = 'global '
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,12 +87,13 @@ class MyLogger(logging.Logger):
|
||||||
pos_end = buf.find(')')
|
pos_end = buf.find(')')
|
||||||
if pos_end > 0:
|
if pos_end > 0:
|
||||||
num_str = buf[2:pos_end]
|
num_str = buf[2:pos_end]
|
||||||
|
id = buf[1:pos_end]
|
||||||
if num_str[0] == 'C':
|
if num_str[0] == 'C':
|
||||||
number = int(buf[3:pos_end])+1000
|
number = int(buf[3:pos_end])+1000
|
||||||
else:
|
else:
|
||||||
number = int(num_str)
|
number = int(num_str)
|
||||||
for f in filters:
|
for f in filters:
|
||||||
if f.number == number and f.regex.search(buf):
|
if (f.number == number or f.error == id) and f.regex.search(buf):
|
||||||
MyLogger.n_filtered += 1
|
MyLogger.n_filtered += 1
|
||||||
return
|
return
|
||||||
MyLogger.warn_cnt += 1
|
MyLogger.warn_cnt += 1
|
||||||
|
|
@ -125,7 +126,7 @@ class MyLogger(logging.Logger):
|
||||||
super(self.__class__, self).debug(msg, *args, **kwargs)
|
super(self.__class__, self).debug(msg, *args, **kwargs)
|
||||||
|
|
||||||
def log_totals(self):
|
def log_totals(self):
|
||||||
if MyLogger.warn_cnt:
|
if MyLogger.warn_cnt or MyLogger.warn_tcnt:
|
||||||
filt_msg = ''
|
filt_msg = ''
|
||||||
if MyLogger.n_filtered:
|
if MyLogger.n_filtered:
|
||||||
filt_msg = ', {} filtered'.format(MyLogger.n_filtered)
|
filt_msg = ', {} filtered'.format(MyLogger.n_filtered)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ from .log import get_logger
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class FilterOptions(Optionable):
|
class FilterOptionsKiBot(Optionable):
|
||||||
""" Valid options for a filter entry """
|
""" Valid options for a filter entry """
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
@ -27,9 +27,9 @@ class FilterOptions(Optionable):
|
||||||
self.filter_msg = None
|
self.filter_msg = None
|
||||||
""" {filter} """
|
""" {filter} """
|
||||||
self.error = ''
|
self.error = ''
|
||||||
""" Error id we want to exclude. A name for KiCad 6 or a number for KiCad 5, but always a string """
|
""" Error id we want to exclude """
|
||||||
self.number = 0
|
self.number = 0
|
||||||
""" Error number we want to exclude. KiCad 5 only """
|
""" Error number we want to exclude """
|
||||||
self.error_number = None
|
self.error_number = None
|
||||||
""" {number} """
|
""" {number} """
|
||||||
self.regex = ''
|
self.regex = ''
|
||||||
|
|
@ -38,6 +38,14 @@ class FilterOptions(Optionable):
|
||||||
""" {regex} """
|
""" {regex} """
|
||||||
|
|
||||||
|
|
||||||
|
class FilterOptions(FilterOptionsKiBot):
|
||||||
|
""" Valid options for a filter entry """
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.add_to_doc('error', 'A name for KiCad 6 or a number for KiCad 5, but always a string')
|
||||||
|
self.add_to_doc('number', 'KiCad 5 only')
|
||||||
|
|
||||||
|
|
||||||
class FiltersOptions(Optionable):
|
class FiltersOptions(Optionable):
|
||||||
""" A list of filter entries """
|
""" A list of filter entries """
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
@ -78,7 +86,9 @@ class FiltersOptions(Optionable):
|
||||||
|
|
||||||
@pre_class
|
@pre_class
|
||||||
class Filters(BasePreFlight): # noqa: F821
|
class Filters(BasePreFlight): # noqa: F821
|
||||||
""" [list(dict)] A list of entries to filter out ERC/DRC messages """
|
""" [list(dict)] A list of entries to filter out ERC/DRC messages.
|
||||||
|
Note that ignored errors will become KiBot warnings (i.e. `(W058) ...`).
|
||||||
|
To farther ignore these warnings use the `filters` option in the `global` section """
|
||||||
def __init__(self, name, value):
|
def __init__(self, name, value):
|
||||||
f = FiltersOptions()
|
f = FiltersOptions()
|
||||||
f.set_tree({'filters': value})
|
f.set_tree({'filters': value})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue