Showing 543 of 559 total issues
Avoid too many return
statements within this function. Open
return socketio_webhook
Avoid too many return
statements within this function. Open
return response.text("success")
Avoid too many return
statements within this function. Open
return telegram_webhook
Avoid too many return
statements within this function. Open
return response.text("success")
Avoid too many return
statements within this function. Open
return 1 if target else -1
Avoid too many return
statements within this function. Open
return 0
Function create_report_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_report_file() -> None:
data = {}
for dirpath, dirnames, files in os.walk(os.environ["RESULT_DIR"]):
for f in files:
if f not in TASK_MAPPING.keys():
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function main
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def main() -> None:
"""Run as standalone python application."""
parse_last_positional_argument_as_model_path()
arg_parser = create_argument_parser()
cmdline_arguments = arg_parser.parse_args()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function send_all_to_datadog
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send_all_to_datadog() -> None:
results = []
for dirpath, dirnames, files in os.walk(os.environ["RESULT_DIR"]):
for f in files:
if any(f.endswith(valid_name) for valid_name in TASK_MAPPING.keys()):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_local_model
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_local_model(model_path: Text = DEFAULT_MODELS_PATH) -> Text:
"""Returns verified path to local model archive.
Args:
model_path: Path to the zipped model. If it's a directory, the latest
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function apply_mask_and_scaling
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def apply_mask_and_scaling(
self, loss: tf.Tensor, mask: Optional[tf.Tensor]
) -> tf.Tensor:
"""Scales the loss and applies the mask if necessary.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function convert_to_data_format
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def convert_to_data_format(
features: Union[
List[List[Dict[Text, List["Features"]]]], List[Dict[Text, List["Features"]]]
],
fake_features: Optional[Dict[Text, List["Features"]]] = None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _rasa_predict
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _rasa_predict(
self, batch_in: Tuple[np.ndarray, ...]
) -> Dict[Text, Union[np.ndarray, Dict[Text, Any]]]:
"""Custom prediction method that builds tf graph on the first call.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _sparse_feature_sizes_have_increased
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _sparse_feature_sizes_have_increased(
new_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
old_sparse_feature_sizes: Dict[Text, Dict[Text, List[int]]],
) -> bool:
"""Checks if the sizes of sparse features have increased during fine-tuning.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function Grid
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
grid-column-gap: ${({ spacious, tiny, noGap }) =>
noGap ? 0 : spacious ? '5rem' : tiny ? '.75rem' : '1.875rem'};
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _features_as_token_ids
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _features_as_token_ids(
self, features: List[Union[tf.Tensor, tf.SparseTensor]]
) -> Optional[tf.Tensor]:
"""Creates dense labels (token IDs) used for negative sampling in MLM."""
# If there are dense features, we use them as labels - taking the first dense
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validate_outdoor_seating
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_outdoor_seating(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _anonymizer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _anonymizer(
_: structlog.BoundLogger, __: str, event_dict: Dict[str, Any]
) -> Dict[str, Any]:
"""Anonymizes event dict."""
anonymizable_keys = [
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _init_from_dict
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _init_from_dict(self, _dict: Dict[Text, Any], parent_directory: Text) -> None:
imports = _dict.get("imports") or []
imports = [os.path.join(parent_directory, i) for i in imports]
# clean out relative paths
imports = [os.path.abspath(i) for i in imports]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function require_response_keys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def require_response_keys(
responses: List[Dict[Text, Any]], _: Dict, __: Text
) -> Union[SchemaError, bool]:
"""Validates that response dicts have either the "text" key or the "custom" key."""
for response in responses:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"