Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class RawMetricsOperator(BaseOperator):
"""Raw Metrics Operator."""
name = "raw"
defaults = {
"exclude": None,
"ignore": None,
"summary": False,
"include_ipynb": True,
"ipynb_cells": True,
}
metrics = (
Metric("loc", "Lines of Code", int, MetricType.Informational, sum),
Metric("lloc", "L Lines of Code", int, MetricType.AimLow, sum),
Metric("sloc", "S Lines of Code", int, MetricType.AimLow, sum),
Metric("comments", "Multi-line comments", int, MetricType.AimHigh, sum),
Metric("multi", "Multi lines", int, MetricType.Informational, sum),
Metric("blank", "blank lines", int, MetricType.Informational, sum),
Metric(
"single_comments",
"Single comment lines",
int,
MetricType.Informational,
sum,
),
)
default_metric_index = 0 # LOC
def __init__(self, config, targets):
"""
Instantiate a new raw operator.
name = "raw"
defaults = {
"exclude": None,
"ignore": None,
"summary": False,
"include_ipynb": True,
"ipynb_cells": True,
}
metrics = (
Metric("loc", "Lines of Code", int, MetricType.Informational, sum),
Metric("lloc", "L Lines of Code", int, MetricType.AimLow, sum),
Metric("sloc", "S Lines of Code", int, MetricType.AimLow, sum),
Metric("comments", "Multi-line comments", int, MetricType.AimHigh, sum),
Metric("multi", "Multi lines", int, MetricType.Informational, sum),
Metric("blank", "blank lines", int, MetricType.Informational, sum),
Metric(
"single_comments",
"Single comment lines",
int,
MetricType.Informational,
sum,
),
)
default_metric_index = 0 # LOC
def __init__(self, config, targets):
"""
Instantiate a new raw operator.
:param config: The wily configuration.
:type config: :class:`WilyConfig`
defaults = {
"exclude": None,
"ignore": None,
"min": "A",
"max": "C",
"multi": True,
"show": False,
"sort": False,
"by_function": True,
"include_ipynb": True,
"ipynb_cells": True,
}
metrics = (
Metric("h1", "Unique Operands", int, MetricType.AimLow, sum),
Metric("h2", "Unique Operators", int, MetricType.AimLow, sum),
Metric("N1", "Number of Operands", int, MetricType.AimLow, sum),
Metric("N2", "Number of Operators", int, MetricType.AimLow, sum),
Metric(
"vocabulary", "Unique vocabulary (h1 + h2)", int, MetricType.AimLow, sum
),
Metric("length", "Length of application", int, MetricType.AimLow, sum),
Metric("volume", "Code volume", float, MetricType.AimLow, sum),
Metric("difficulty", "Difficulty", float, MetricType.AimLow, sum),
Metric("effort", "Effort", float, MetricType.AimLow, sum),
)
default_metric_index = 0 # MI
def __init__(self, config, targets):
"""
Instantiate a new HC operator.
class RawMetricsOperator(BaseOperator):
"""Raw Metrics Operator."""
name = "raw"
defaults = {
"exclude": None,
"ignore": None,
"summary": False,
"include_ipynb": True,
"ipynb_cells": True,
}
metrics = (
Metric("loc", "Lines of Code", int, MetricType.Informational, sum),
Metric("lloc", "L Lines of Code", int, MetricType.AimLow, sum),
Metric("sloc", "S Lines of Code", int, MetricType.AimLow, sum),
Metric("comments", "Multi-line comments", int, MetricType.AimHigh, sum),
Metric("multi", "Multi lines", int, MetricType.Informational, sum),
Metric("blank", "blank lines", int, MetricType.Informational, sum),
Metric(
"single_comments",
"Single comment lines",
int,
MetricType.Informational,
sum,
),
)
default_metric_index = 0 # LOC
def __init__(self, config, targets):
"""
"show": False,
"sort": False,
"by_function": True,
"include_ipynb": True,
"ipynb_cells": True,
}
metrics = (
Metric("h1", "Unique Operands", int, MetricType.AimLow, sum),
Metric("h2", "Unique Operators", int, MetricType.AimLow, sum),
Metric("N1", "Number of Operands", int, MetricType.AimLow, sum),
Metric("N2", "Number of Operators", int, MetricType.AimLow, sum),
Metric(
"vocabulary", "Unique vocabulary (h1 + h2)", int, MetricType.AimLow, sum
),
Metric("length", "Length of application", int, MetricType.AimLow, sum),
Metric("volume", "Code volume", float, MetricType.AimLow, sum),
Metric("difficulty", "Difficulty", float, MetricType.AimLow, sum),
Metric("effort", "Effort", float, MetricType.AimLow, sum),
)
default_metric_index = 0 # MI
def __init__(self, config, targets):
"""
Instantiate a new HC operator.
:param config: The wily configuration.
:type config: :class:`WilyConfig`
"""
# TODO : Import config from wily.cfg
logger.debug(f"Using {targets} with {self.defaults} for HC metrics")
"exclude": None,
"ignore": None,
"min": "A",
"max": "C",
"multi": True,
"show": False,
"sort": False,
"by_function": True,
"include_ipynb": True,
"ipynb_cells": True,
}
metrics = (
Metric("h1", "Unique Operands", int, MetricType.AimLow, sum),
Metric("h2", "Unique Operators", int, MetricType.AimLow, sum),
Metric("N1", "Number of Operands", int, MetricType.AimLow, sum),
Metric("N2", "Number of Operators", int, MetricType.AimLow, sum),
Metric(
"vocabulary", "Unique vocabulary (h1 + h2)", int, MetricType.AimLow, sum
),
Metric("length", "Length of application", int, MetricType.AimLow, sum),
Metric("volume", "Code volume", float, MetricType.AimLow, sum),
Metric("difficulty", "Difficulty", float, MetricType.AimLow, sum),
Metric("effort", "Effort", float, MetricType.AimLow, sum),
)
default_metric_index = 0 # MI
def __init__(self, config, targets):
"""
Instantiate a new HC operator.
name = "cyclomatic"
defaults = {
"exclude": None,
"ignore": None,
"min": "A",
"max": "F",
"no_assert": True,
"show_closures": False,
"order": radon.complexity.SCORE,
"include_ipynb": True,
"ipynb_cells": True,
}
metrics = (
Metric(
"complexity",
"Cyclomatic Complexity",
float,
MetricType.AimLow,
statistics.mean,
),
)
default_metric_index = 0 # MI
def __init__(self, config, targets):
"""
Instantiate a new Cyclomatic Complexity operator.
:param config: The wily configuration.
:type config: :class:`WilyConfig`
class RawMetricsOperator(BaseOperator):
"""Raw Metrics Operator."""
name = "raw"
defaults = {
"exclude": None,
"ignore": None,
"summary": False,
"include_ipynb": True,
"ipynb_cells": True,
}
metrics = (
Metric("loc", "Lines of Code", int, MetricType.Informational, sum),
Metric("lloc", "L Lines of Code", int, MetricType.AimLow, sum),
Metric("sloc", "S Lines of Code", int, MetricType.AimLow, sum),
Metric("comments", "Multi-line comments", int, MetricType.AimHigh, sum),
Metric("multi", "Multi lines", int, MetricType.Informational, sum),
Metric("blank", "blank lines", int, MetricType.Informational, sum),
Metric(
"single_comments",
"Single comment lines",
int,
MetricType.Informational,
sum,
),
)
default_metric_index = 0 # LOC
def __init__(self, config, targets):
"""
Instantiate a new raw operator.