language
stringclasses
1 value
code
stringlengths
407
33.3k
instruction
stringclasses
1 value
flaws
listlengths
1
17
flaw_count
int64
1
17
python
# coding: utf-8 from __future__ import absolute_import import warnings import textwrap from ruamel.yaml.compat import utf8 if False: # MYPY from typing import Any, Dict, Optional, List, Text # NOQA __all__ = [ 'FileMark', 'StringMark', 'CommentMark', 'YAMLError', 'MarkedYAMLError', 'ReusedAnchorWarn...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 24 }, { "issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 45 }, { "i...
10
python
'''Character counting as a fold''' from functools import reduce from itertools import repeat from os.path import expanduser # charCounts :: String -> Dict Char Int def charCounts(s): '''A dictionary of (character, frequency) mappings ''' def tally(dct, c): dct[c] = 1 + dct[c] if c in dct e...
Review this code and list any quality issues.
[ { "issue": "Function 'tabulated.go' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 146 } ]
1
python
from __future__ import absolute_import from pants.base.build_environment import get_scm from pants.base.payload import Payload from pants.base.payload_field import PrimitiveField from pants.build_graph.target import Target class DockerTargetBase(Target): def __init__(self, address=None, payload=None, image_name=Non...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 9 } ]
1
python
try: from configparser import RawConfigParser except ImportError: from ConfigParser import RawConfigParser import logging import os import re import socket import threading from stomp.backward import * log = logging.getLogger('testutils.py') config = RawConfigParser() config.read(os.path.join(os.path.dirnam...
Review this code and list any quality issues.
[ { "issue": "Function 'run' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 149 }, { "issue": "Function 'write' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor...
2
python
''' GridWorldMDPClass.py: Contains the GridWorldMDP class. ''' # Python imports. from __future__ import print_function import random import sys import os import numpy as np # Other imports. from simple_rl.mdp.MDPClass import MDP from simple_rl.tasks.grid_world.GridWorldStateClass import GridWorldState # Fix input to...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 26 }, { "issue": "Function '_is_goal_state_action' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "majo...
7
python
import numpy as np import cvxpy as cp import dccp import matplotlib.pyplot as plt from matplotlib.patches import Polygon from sklearn.base import BaseEstimator, ClassifierMixin, TransformerMixin from sklearn.utils.multiclass import unique_labels from sklearn.metrics import pairwise_distances from sklearn.utils.validati...
Review this code and list any quality issues.
[ { "issue": "Function 'decision_boundary' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 17 }, { "issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 67 }...
6
python
from nevada.Common.Connector import * from typing import List import jsonpickle import json class AdFieldObject: def __init__(self, json_def=None): if type(json_def) is str: json_def = json.loads(json_def) s = json_def self.pc_display = None if 'pc' not in s else self.pc_display...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 7 }, { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line":...
7
python
# -*- coding: utf-8 -*- import pandas as pd from jqdatasdk import auth, logout, finance, query from zvt.recorders.joinquant.common import to_jq_entity_id from zvt import zvt_env from zvt.api import TIME_FORMAT_DAY, get_str_schema from zvt.contract.api import df_to_db from zvt.contract.recorder import TimeSeriesDataRec...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 15 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 24 }, { "issue": "Function 'record' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 39 } ]
2
python
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 18 }, { "issue": "Function '__init__' is 57 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
3
python
""" The main class to obtain the compensation parameters from the clients, aggregate them, and share the aggregation results with the server Copyright 2021 Reza NasiriGerdeh. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in co...
Review this code and list any quality issues.
[ { "issue": "Function 'add_client_parameters' is 34 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 87 }, { "issue": "Function 'aggregate_client_parameters' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions....
4
python
import math from pathlib import Path import numba import numpy as np from spconv.spconv_utils import ( non_max_suppression_cpu, rotate_non_max_suppression_cpu) from second.core import box_np_ops from second.core.non_max_suppression.nms_gpu import rotate_iou_gpu def nms_cc(dets, thresh): scores = de...
Review this code and list any quality issues.
[ { "issue": "Function 'nms_jit' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 31 }, { "issue": "Function 'nms_jit' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "l...
5
python
import os win32_defines = ["#define _GLFW_WIN32 1", "#ifdef _MSC_VER\n#define _CRT_SECURE_NO_WARNINGS\n#endif", "#define LSH_GLFW_USE_HYBRID_HPG", "#ifdef LSH_GLFW_USE_HYBRID_HPG\n#define _GLFW_USE_HYBRID_HPG 1\n#endif", "#define _UNICODE", ...
Review this code and list any quality issues.
[ { "issue": "Function 'include_headers' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 42 } ]
1
python
import ldap3 from allauth.socialaccount.models import SocialAccount from django.conf import settings from base.management import BaseCommand def init_ldap(): server = ldap3.Server("ldap://ads.mwn.de") connection = ldap3.Connection( server, "CN=%s,OU=Users,ou=TU,ou=IAM,dc=ads,dc=mwn,dc=de" % ...
Review this code and list any quality issues.
[ { "issue": "Function 'handle' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 37 }, { "issue": "Function 'handle' is 37 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "lin...
2
python
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Review this code and list any quality issues.
[ { "issue": "Function 'import_data_sample' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 19 } ]
1
python
import numpy as np import torch from sklearn.metrics import roc_auc_score from tqdm import tqdm import config as c from model import get_cs_flow_model, save_model, FeatureExtractor, nf_forward from utils import * def train(train_loader, test_loader): model = get_cs_flow_model() optimizer = torch.optim.Adam(mo...
Review this code and list any quality issues.
[ { "issue": "Function 'train' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 10 }, { "issue": "Function 'train' is 61 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", ...
2
python
import random from thehive4pyextended import TheHiveApiExtended from thehive4py.query import Eq from st2common.runners.base_action import Action __all__ = [ 'RunAnalyzerOnDataTypeAction' ] class RunAnalyzerOnDataTypeAction(Action): def run(self, case_id, data_type, analyzer_name, linked_task_name=None): ...
Review this code and list any quality issues.
[ { "issue": "Function 'run' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 12 }, { "issue": "Function 'run' is 38 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 12...
3
python
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : program_translator.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 09/30/2018 # # This file is part of NSCL-PyTorch. # Distributed under terms of the MIT license. """ Tools for translating programs into different formats. """ from copy im...
Review this code and list any quality issues.
[ { "issue": "Function 'clevr_to_nsclseq' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 34 }, { "issue": "Function 'clevr_to_nsclseq' is 56 lines long. Functions over 25 lines are harder to test and maintain.", "seve...
2
python
#!/usr/bin/env python from io import BufferedWriter, FileIO import os from ajaxuploader.backends.base import AbstractUploadBackend from django.conf import settings from panda.api import DataUploadResource, RelatedUploadResource, UserResource from panda.models import Dataset, DataUpload, RelatedUpload, UserProxy cla...
Review this code and list any quality issues.
[ { "issue": "Function 'upload_complete' is 33 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 65 } ]
1
python
# -*- coding: utf-8 -*- """Methods to generalize any graph for its path analysis.""" import logging from typing import Dict, Tuple, Any, List from networkx import DiGraph, isolates __all__ = [ 'generate_reduced_graph', ] logger = logging.getLogger(__name__) def remove_isolated_nodes(graph: DiGraph): """R...
Review this code and list any quality issues.
[ { "issue": "Function 'generate_reduced_graph' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 55 }, { "issue": "Function 'generate_reduced_graph' is 49 lines long. Functions over 25 lines are harder to test and maintain.", ...
2
python
import logging from collections import Counter, defaultdict import aiogram from aiogram import Bot, types from aiogram.utils.emoji import emojize from detector import Detector from gwevents import Events, time_ago from keyboard import InlineKeyboard from permanentset import PermanentSet class GraceBot(Bot): def ...
Review this code and list any quality issues.
[ { "issue": "Function 'send_event_info' is 35 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 78 } ]
1
python
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 31 }, { "issue": "Function '__init__' is 45 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
5
python
from flask import g, abort, redirect, request, render_template, send_from_directory, url_for from http import HTTPStatus from os import getenv, path from lnbits.core import core_app from lnbits.decorators import check_user_exists, validate_uuids from lnbits.settings import SERVICE_FEE from ..crud import ( create_...
Review this code and list any quality issues.
[ { "issue": "Function 'wallet' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 48 } ]
1
python
import os import json import torch import numpy as np from torch.utils import data from PIL import Image from ptsemseg.utils import recursive_glob from ptsemseg.augmentations import Compose, RandomHorizontallyFlip, RandomRotate class mapillaryVistasLoader(data.Dataset): def __init__( self, root, ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 13 }, { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 13 } ]
2
python
# Max Non Negative SubArray # https://www.interviewbit.com/problems/max-non-negative-subarray/ # # Find out the maximum sub-array of non negative numbers from an array. # The sub-array should be continuous. That is, a sub-array created by choosing # the second and fourth element and skipping the third element is invali...
Review this code and list any quality issues.
[ { "issue": "Function 'maxset' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 25 } ]
1
python
import time import json import argparse import os import sys import logging import shutil from datetime import datetime import glob import random from scipy.stats import mannwhitneyu from scipy.stats import spearmanr import numpy as np from sklearn.metrics import roc_auc_score, precision_recall_curve, auc import te...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 44 }, { "issue": "Function 'train_single_gpu._save_res' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": ...
6
python
"""Useful command to download and clean data from OpenFoodfact.""" import requests keys = [ "id", "product_name_fr", "nutrition_grade_fr", "url", "image_front_url", "image_ingredients_url", ] class RequestData: """The class fetch the data and save it in to a json file.""" def __init_...
Review this code and list any quality issues.
[ { "issue": "Function '_data_exist' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 101 } ]
1
python
from PyInquirer import prompt, Separator # The menus displays a list of checkboxes, which allows the user to select the separators and modules he wants to use def separators_menu(self): # Get a list of all existing separators separators = self.config["separators"] separators_menu = [ { ...
Review this code and list any quality issues.
[ { "issue": "Function 'services_menu' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 27 }, { "issue": "Function 'services_menu' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "mi...
2
python
import shutil import tempfile from django.core.cache import cache from http import HTTPStatus from django.conf import settings from django.core.files.uploadedfile import SimpleUploadedFile from django.contrib.auth import get_user_model from django.test import Client, TestCase, override_settings from django.urls import ...
Review this code and list any quality issues.
[ { "issue": "Function 'setUpClass' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 26 } ]
1
python
#!/usr/bin/env python # Copyright 2018, Rackspace US, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
Review this code and list any quality issues.
[ { "issue": "Function 'bonding_ifaces_check' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 25 }, { "issue": "Function 'bonding_ifaces_check' is 34 lines long. Functions over 25 lines are harder to test and maintain.", "...
2
python
import posthoganalytics import requests from dateutil.relativedelta import relativedelta from django.utils import timezone from ee.clickhouse.client import sync_execute from ee.models.license import License from posthog.models import User def send_license_usage(): license = License.objects.first_valid() if n...
Review this code and list any quality issues.
[ { "issue": "Function 'send_license_usage' is 33 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 11 } ]
1
python
from typing import Callable class Solution: def setZeroes(self, matrix: list[list[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" first_column_zero = False for row in matrix: for j, cell in enumerate(row): if cell != 0: ...
Review this code and list any quality issues.
[ { "issue": "Function 'setZeroes' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 5 } ]
1
python
import torch import numpy as np from torch.hub import load_state_dict_from_url from nnfabrik.utility.nn_helpers import load_state_dict from nntransfer.models.resnet import resnet_builder from nntransfer.models.utils import get_model_parameters from nntransfer.models.vgg import vgg_builder from nntransfer.models.lene...
Review this code and list any quality issues.
[ { "issue": "Function 'classification_model_builder' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 24 }, { "issue": "Function 'classification_model_builder' is 77 lines long. Functions over 25 lines are harder to test a...
2
python
# -*- coding: utf-8 -*- from collections import ChainMap from datetime import timedelta from itertools import chain from wtforms import Form from wtforms.csrf.session import SessionCSRF from wtforms.meta import DefaultMeta from wtforms.validators import DataRequired, StopValidation from wtforms.fields.core import Fiel...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 128 }, { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line...
2
python
import myutils_cython import numpy as np, numpy.random as ra, scipy.linalg as sla from tqdm import tqdm def rankone(X,Z,y,r,R=.1, C=.1, tolPred=0.01, tolTh=0.01, maxIter=400, verbose=False): """ matrix recovery with rank-one measurements using Burer-Monteiro approach measurement model: (X[i,:] @ Theta) @ ...
Review this code and list any quality issues.
[ { "issue": "Function 'rankone' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 5 }, { "issue": "Function 'rankone' is 46 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", ...
3
python
from .openvr_mod_cfg import OpenVRModCfgSetting, OpenVRModSettings class FsrSettings(OpenVRModSettings): cfg_key = 'fsr' format = 'cfg' def __init__(self): self.enabled = OpenVRModCfgSetting( key='enabled', name='Enabled', category='FSR Settings', d...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' is 193 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": 8 } ]
1
python
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 54 }, { "issue": "Function '_to_rule' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 162 } ]
2
python
""" Plotting utilities for example notebooks """ import matplotlib.pyplot as plt import numpy as np def plot_image(image=None, mask=None, ax=None, factor=3.5/255, clip_range=(0, 1), **kwargs): """ Utility function for plotting RGB images and masks. """ if ax is None: _, ax = plt.subplots(nrows=1, ...
Review this code and list any quality issues.
[ { "issue": "Function 'plot_image' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 8 }, { "issue": "Function 'plot_image' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "li...
2
python
"""Support for Xiaomi Mi Flora BLE plant sensor.""" from datetime import timedelta import logging import btlewrap from btlewrap import BluetoothBackendException from miflora import miflora_poller import voluptuous as vol from homeassistant.components.sensor import ( PLATFORM_SCHEMA, STATE_CLASS_MEASUREMENT, ...
Review this code and list any quality issues.
[ { "issue": "Function 'async_setup_platform' is 40 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 86 }, { "issue": "Function '__init__' has 10 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "lin...
4
python
# Copyright (c) 2014 The Bitcoin Core developers # Copyright (c) 2014-2015 The Dash developers # Copyright (c) 2019 The Vzuh developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Helpful routines for regression testing...
Review this code and list any quality issues.
[ { "issue": "Function 'initialize_chain' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 77 }, { "issue": "Function 'initialize_chain' is 40 lines long. Functions over 25 lines are harder to test and maintain.", "severit...
4
python
# Deepforest Preprocessing model """The preprocessing module is used to reshape data into format suitable for training or prediction. For example cutting large tiles into smaller images. """ import os import numpy as np import pandas as pd import slidingwindow from PIL import Image import torch import warnings import...
Review this code and list any quality issues.
[ { "issue": "Function 'select_annotations' is 42 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 54 }, { "issue": "Function 'split_raster' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.", "severity"...
4
python
""" Only the most essential features to :class:`csgo.client.CSGOClient` are found here. Every other feature is inherited from the :mod:`csgo.features` package and it's submodules. """ import logging import gevent import google.protobuf from steam.core.msg import GCMsgHdrProto from steam.client.gc import GameCoordinato...
Review this code and list any quality issues.
[ { "issue": "Function '_set_connection_status' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 122 }, { "issue": "Function '_send' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", ...
3
python
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import json import warnings import pulumi import pulumi.runtime from typing import Union from .. import utilities, tables class Kubern...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 77 }, { "issue": "Function '__init__' is 42 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
4
python
import emmental import numpy as np from fonduer import Meta from emmental.modules.embedding_module import EmbeddingModule from emmental.data import EmmentalDataLoader from emmental.model import EmmentalModel from emmental.learner import EmmentalLearner from fonduer.learning.utils import collect_word_counter from fondu...
Review this code and list any quality issues.
[ { "issue": "Function 'get_methods.train_model' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 23 }, { "issue": "Function 'get_methods.train_model' is 58 lines long. Functions over 25 lines are harder to test and maintain.",...
5
python
## # Copyright (c) 2012-2017 Apple Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 30 } ]
1
python
# -*- coding: utf-8 -*- # Copyright (c) 2011 Plivo Team. See LICENSE for details from gevent import monkey monkey.patch_all() import grp import os import pwd import signal import sys import optparse from flask import Flask import gevent from gevent.wsgi import WSGIServer from gevent.pywsgi import WSGIServer as PyWSG...
Review this code and list any quality issues.
[ { "issue": "Function 'create_logger' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 85 }, { "issue": "Function 'create_logger' is 44 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "m...
4
python
# This file was automatically generated by SWIG (http://www.swig.org). # Version 3.0.8 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info if version_info >= (2, 6, 0): def swig_import_helper(): from os.path imp...
Review this code and list any quality issues.
[ { "issue": "Function '_swig_setattr_nondynamic' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 39 }, { "issue": "Function '_swig_setattr_nondynamic' has 5 parameters. Consider using a parameter object to reduce arity.", ...
3
python
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os import sys import shutil import asyncio from azure_functions_worker import protos from azure_functions_worker import testutils async def vertify_nested_namespace_import(): test_env = {} request = protos.Fu...
Review this code and list any quality issues.
[ { "issue": "Function 'vertify_nested_namespace_import' is 28 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 12 } ]
1
python
from unittest import TestCase from pykechain.utils import is_url, is_valid_email, Empty, get_in_chunks from tests.classes import SixTestCase class TestIsURL(SixTestCase): def test_is_url_returns_true_on_valid_url(self): addresses = [ u"http://foobar.dk", u"http://foobar.museum/foo...
Review this code and list any quality issues.
[ { "issue": "Function 'test_is_url_returns_true_on_valid_url' is 47 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 8 }, { "issue": "Function 'test_is_url_returns_False_on_failed_url' is 57 lines long. Functions over 25 lines are harder to test ...
2
python
#! /usr/bin/python #-*- coding:utf-8 -* import os import conf from web.models import Shelter, ShelterPicture from bootstrap import db from PIL import Image def create_shelters_thumbnails(): shelters = Shelter.query.all() pictures = ShelterPicture.query.all() for picture in pictures: filepath...
Review this code and list any quality issues.
[ { "issue": "Function 'create_shelters_thumbnails' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 11 }, { "issue": "Function 'create_shelters_thumbnails' is 26 lines long. Functions over 25 lines are harder to test and maint...
2
python
""" Copyright (c) 2022 Huawei Technologies Co.,Ltd. openGauss is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W...
Review this code and list any quality issues.
[ { "issue": "Function 'test_guc' is 42 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 53 } ]
1
python
import torch from . import _base from . import utils from .so2 import SO2Matrix class SE2Matrix(_base.SEMatrixBase): """See :mod:`liegroups.SE2`""" dim = 3 dof = 3 RotationType = SO2Matrix def adjoint(self): rot_part = self.rot.as_matrix() if rot_part.dim() < 3: rot_p...
Review this code and list any quality issues.
[ { "issue": "Function 'inv_left_jacobian' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 62 }, { "issue": "Function 'left_jacobian' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", ...
3
python
import biokbase.narrative.clients as clients from biokbase.narrative.app_util import ( app_version_tags, check_tag, app_param ) import json from jinja2 import Template from IPython.display import HTML class SpecManager(object): __instance = None app_specs = dict() type_specs = dict() def...
Review this code and list any quality issues.
[ { "issue": "Function 'available_apps' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 69 }, { "issue": "Function '_repr_html_' is 49 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line...
3
python
#!/usr/bin/python # pure python keytool import os import sys import json import base64 import hashlib import datetime assert sys.version_info < (3,0), "Python 2.7 required" TZ = '+02:00' b = 256 q = 2**255 - 19 l = 2**252 + 27742317777372353535851937790883648493 def H(m): return hashlib.sha512(m).digest() def ...
Review this code and list any quality issues.
[ { "issue": "Function 'verify_file' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 189 }, { "issue": "Function 'main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity":...
2
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 19 08:11:51 2021 @author: vik748 """ import json import numpy as np import matplotlib.pyplot as plt import sys,os import pandas as pd def tracks_histogram(recon_file, tracks_file, ax, model_num=0, bins=np.linspace(2,15,14)): ''' How the tra...
Review this code and list any quality issues.
[ { "issue": "Function 'tracks_histogram' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 14 } ]
1
python
import logging import urllib from typing import Any, Dict, List import tornado.web from django import http from django.core import signals from django.core.handlers import base from django.core.handlers.wsgi import WSGIRequest, get_script_name from django.urls import set_script_prefix from django.http import HttpReque...
Review this code and list any quality issues.
[ { "issue": "Function 'finish_handler' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 40 }, { "issue": "Function 'zulip_finish' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", ...
2
python
#! /usr/bin/env python3 # Copyright (c) 2021 Dave McCoy (dave.mccoy@cospandesign.com) # # NAME is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # any later version. # # NAME...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 49 }, { "issue": "Function 'main' is 82 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", "...
2
python
from __future__ import print_function from keras.models import Sequential from keras.layers.embeddings import Embedding from keras.layers.core import Activation, Dense, Merge, Permute, Dropout from keras.layers.recurrent import LSTM from keras.datasets.data_utils import get_file from keras.preprocessing.sequence import...
Review this code and list any quality issues.
[ { "issue": "Function 'parse_stories' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 39 } ]
1
python
''' A rouch implementation of the following paper M. Nickel+, "Poincaré Embeddings for Learning Hierarchical Representations", NeurIPS2017 https://arxiv.org/pdf/1705.08039.pdf ''' import argparse from pathlib import Path import itertools import math import numpy as np import torch import torch.nn as nn import torch.op...
Review this code and list any quality issues.
[ { "issue": "Function 'train' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 87 } ]
1
python
#!/usr/bin/env python # -*- coding: utf-8 -*- def main(): from setuptools import setup version_dict = {} init_filename = "boxtree/version.py" exec(compile(open(init_filename, "r").read(), init_filename, "exec"), version_dict) setup(name="boxtree", version=version_dict["VERS...
Review this code and list any quality issues.
[ { "issue": "Function 'main' is 41 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 5 } ]
1
python
from typing import List, Optional import aiosqlite from shamrock.types.blockchain_format.coin import Coin from shamrock.types.blockchain_format.sized_bytes import bytes32 from shamrock.types.coin_record import CoinRecord from shamrock.types.full_block import FullBlock from shamrock.util.db_wrapper import DBWrapper fr...
Review this code and list any quality issues.
[ { "issue": "Function 'create' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 26 }, { "issue": "Function 'new_block' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "...
3
python
import streamlit as st import plotly.express as px import pandas as pd import pickle import os import base64 from io import BytesIO from datetime import datetime def to_excel(df): output = BytesIO() writer = pd.ExcelWriter(output, engine='xlsxwriter') df.to_excel(writer, index=False, sheet_name='Sheet1') ...
Review this code and list any quality issues.
[ { "issue": "Function 'main' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 46 } ]
1
python
def frequencyQueries(queries): collection = {} cumOperationThree = [] for i in range(0, len(queries)): operation = queries[i][0] numToAdd = queries[i][1] if operation == 1: if numToAdd in collection.keys(): collection[numToAdd] += 1 else: ...
Review this code and list any quality issues.
[ { "issue": "Function 'frequencyQueries' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 2 } ]
1
python
from datetime import timedelta from typing import Any, Dict, Optional, Sequence from physlearn.names import DataBaseName, LabelType, NonSignalDataType, SignalType from physlearn.typing import Array class Signal: """A signal base class. Args: start_time: The time from the beginning of the record until ...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 24 }, { "issue": "Function 'signal_like_this' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", ...
7
python
import tensorflow as tf import os import time import json import pandas as pd """ Script to train a sequential NN. Takes a df, filters based on `condition` (default None), and separates into test/train based on time NN trains on training data, all results output to disk """ def train_test_split(df,filter_cond...
Review this code and list any quality issues.
[ { "issue": "Function 'train_test_split' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 21 }, { "issue": "Function 'write_outputs' has 9 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 92...
3
python
from sqllite import CDataBase as sqllite from kademliaGetSet import CDataBase import socket from isolated_functions import * instance_kade = None class CSQLLite(): def __init__(self): global instance_kade if instance_kade is None: node_identifier = socket.gethostbyname(socket.gethostn...
Review this code and list any quality issues.
[ { "issue": "Function 'save' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 25 } ]
1
python
"""Initialising Optimisers""" import torch def create_optimisers( optim_enc, optim_dec, lr_enc, lr_dec, mom_enc, mom_dec, wd_enc, wd_dec, param_enc, param_dec, ): """Create optimisers for encoder, decoder Args: optim_enc (str) : type of optimiser for encoder ...
Review this code and list any quality issues.
[ { "issue": "Function 'create_optimisers' is 29 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical", "line": 6 }, { "issue": "Function 'create_optimisers' has 10 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", ...
2
python
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities __...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 33 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 20 }, { "issue": "Function '__init__' is 49 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "critical...
4
python
import asyncio from datetime import datetime from string import hexdigits from time import time import aiohttp import aiohttp_jinja2 from aiohttp import web async def handle_command(payload, user_id, state_manager): if payload in {'/start', '/close'} and state_manager: await state_manager.drop_active_dia...
Review this code and list any quality issues.
[ { "issue": "Function 'handle_api_request' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 22 }, { "issue": "Function 'handle_api_request' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "seve...
4
python
import datetime import os from airflow.models.dag import DAG from airflow.operators.bash_operator import BashOperator from airflow.utils.dates import days_ago from dagster import DagsterEventType, execute_pipeline from dagster.core.instance import AIRFLOW_EXECUTION_DATE_STR from dagster.core.storage.compute_log_manage...
Review this code and list any quality issues.
[ { "issue": "Function 'check_compute_logs' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 30 } ]
1
python
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
Review this code and list any quality issues.
[ { "issue": "Function 'invite' has 6 parameters. Consider using a parameter object to reduce arity.", "severity": "major", "line": 55 }, { "issue": "Function 'join' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 65 }, { "issue":...
6
python
""" This file belongs to https://github.com/bitkeks/python-netflow-v9-softflowd. The test packets (defined below as hex streams) were extracted from "real" softflowd exports based on a sample PCAP capture file. Copyright 2016-2020 Dominik Pataky <software+pynetflow@dpataky.eu> Licensed under MIT License. See LICENSE....
Review this code and list any quality issues.
[ { "issue": "Function 'generate_packets' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 91 } ]
1
python
# coding: utf-8 """ SendinBlue API SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at h...
Review this code and list any quality issues.
[ { "issue": "Function 'to_dict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 74 } ]
1
python
import sense_hat from sense_hat import SenseHat import time from enum import Enum class Colors(Enum): Green = (0, 255, 0) Yellow = (255, 255, 0) Blue = (0, 0, 255) Red = (255, 0, 0) White = (255,255,255) Nothing = (0,0,0) Pink = (255,105, 180) Orange = (255,165, 0) class DisplayManager...
Review this code and list any quality issues.
[ { "issue": "Function 'displayImage' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 181 } ]
1
python
import os import sys sys.path.append( '../' ) from rtfng import * def MakeExample1() : doc = Document() ss = doc.StyleSheet section = Section() doc.Sections.append( section ) # text can be added directly to the section # a paragraph object is create as needed section.append...
Review this code and list any quality issues.
[ { "issue": "Function 'MakeExample1' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 7 } ]
1
python
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use ...
Review this code and list any quality issues.
[ { "issue": "Function 'follow' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 42 }, { "issue": "Function 'forget_follower' has 5 parameters. Consider using a parameter object to reduce arity.", "severity": "minor", "line": 106 }, { ...
4
python
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 23 }, { "issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", ...
2
python
# Auto-generated at 2021-09-27T17:12:33.419763+08:00 # from: Justice Lobby Service (1.33.0) # Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved. # This is licensed software from AccelByte Inc, for limitations # and restrictions contact your company contract manager. # pylint: disable=duplicate-code # pylin...
Review this code and list any quality issues.
[ { "issue": "Function 'to_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 58 }, { "issue": "Function 'create_from_dict' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "sev...
2
python
# extract and plot each detected face in a photograph from facenet_pytorch import MTCNN from cv2 import cv2 from PIL import Image import numpy as np from matplotlib import pyplot as plt from tqdm.notebook import tqdm import os import tensorflow as tf from torchvision import models import torch from torchvision import t...
Review this code and list any quality issues.
[ { "issue": "Function 'getface_from_video' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 15 } ]
1
python
from scheme import * from scheme.supplemental import ObjectReference from spire.runtime.runtime import Runtime from spire.support.daemon import * SCHEMA = Structure({ 'detached': Boolean(default=True), 'gid': Text(nonnull=True), 'pidfile': Text(nonnull=True), 'uid': Text(nonnull=True), }) class Runti...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 15 } ]
1
python
# Open3D: www.open3d.org # The MIT License (MIT) # See license file or visit www.open3d.org for details # examples/Python/Utility/file.py from os import listdir, makedirs from os.path import exists, isfile, join, splitext import shutil import re def sorted_alphanum(file_list_ordered): convert = lambda text: int...
Review this code and list any quality issues.
[ { "issue": "Function 'get_file_list' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 19 } ]
1
python
# Copyright (c) 2021. # The copyright lies with Timo Hirsch-Hoffmann, the further use is only permitted with reference to source import urllib.request from RiotGames.API.RiotApi import RiotApi class Match(RiotApi): __timeline_by_match_id_url: str = "https://{}.api.riotgames.com/lol/match/v4/timelines/by-matc...
Review this code and list any quality issues.
[ { "issue": "Function 'matchlist_by_account_id' has 9 parameters. Consider using a parameter object to reduce arity.", "severity": "critical", "line": 32 } ]
1
python
# -*- coding: utf-8 -*- """ sphinxjp.themes.revealjs.directives ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :author: tell-k <ffk2005@gmail.com> :copyright: tell-k. All Rights Reserved. """ from docutils import nodes from docutils.parsers.rst import directives from docutils.parsers.rst.roles import se...
Review this code and list any quality issues.
[ { "issue": "Function 'run' is 32 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 71 }, { "issue": "Function 'visit_revealjs' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical",...
3
python
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
Review this code and list any quality issues.
[ { "issue": "Function 'to_cv_sigma' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 43 }, { "issue": "Function 'to_cv_win_size' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.", "s...
14
python
import codecs import math from Model.EngHindiDataPreprocess import config, EnglishTokenizer as ENG_Tok, HindiTokenizer as HIN_TOK, \ IndicTokenizer as IND_TOK from nltk import word_tokenize from Model.EngHindiDataPreprocess import config def load_data_sp(path): with codecs.open(path, encoding='utf-8') as f: ...
Review this code and list any quality issues.
[ { "issue": "Function 'convert_seq_to_int' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 99 } ]
1
python
import boto3 from zipfile import ZipFile import json import csv from retention_times import memory_retention, magnetic_retention, table_name from math import ceil def read_s3(Session, event): """This method gets an object from an AWS S3 bucket (Backup previously made by the plugin AWS S3) and prepares the dat...
Review this code and list any quality issues.
[ { "issue": "Function 'read_s3' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 9 }, { "issue": "Function 'read_s3' is 49 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "l...
4
python
import asyncio import tempfile import urllib.parse from django.conf import settings from django.http import FileResponse from core.models import CodeSignToken from core.utils import get_core_settings, get_mesh_device_id, get_mesh_ws_url from tacticalrmm.constants import MeshAgentIdent def get_agent_url(arch: str, p...
Review this code and list any quality issues.
[ { "issue": "Function 'generate_linux_install' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 38 }, { "issue": "Function 'generate_linux_install' is 47 lines long. Functions over 25 lines are harder to test and maintain.", ...
3
python
try: import logo as logo_print except ModuleNotFoundError: missingfile = str(input("The program is missing a file. Continue anyways? ")) if missingfile.lower() == "yes" or "y" or "yea": pass else: os.exit(0) try: from bs4 import BeautifulSoup import requests, time, re, os, rando...
Review this code and list any quality issues.
[ { "issue": "Function 'print_status' has cyclomatic complexity 32 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 28 }, { "issue": "Function 'print_status' is 87 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "...
2
python
import pytest from graphql.type import ( GraphQLArgument, GraphQLEnumType, GraphQLEnumValue, GraphQLField, GraphQLInputObjectField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLString, ) from ..dynamic import Dynamic from ..enum import Enum from ..field im...
Review this code and list any quality issues.
[ { "issue": "Function 'test_objecttype' is 27 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 60 }, { "issue": "Function 'test_interface' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "...
3
python
#!/usr/bin/env python2 # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * try: ...
Review this code and list any quality issues.
[ { "issue": "Function 'run_test' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 22 }, { "issue": "Function 'run_test' is 86 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", ...
2
python
from pathlib import Path from typer import Option, Argument from basis.cli.services.deploy import deploy_graph_version from basis.cli.services.graph_components import create_graph_component from basis.cli.services.lookup import IdLookup from basis.cli.services.output import sprint, abort_on_error from basis.cli.servi...
Review this code and list any quality issues.
[ { "issue": "Function 'upload' is 44 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 18 } ]
1
python
# -*- coding: utf-8 -*- """ tests.unit.cloud ~~~~~~~~~~~~~~~~ """ from __future__ import absolute_import, print_function, unicode_literals import salt.cloud from tests.support.unit import TestCase class CloudTest(TestCase): def test_vm_config_merger(self): """ Validate the vm's config is ...
Review this code and list any quality issues.
[ { "issue": "Function 'test_vm_config_merger' is 49 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 13 } ]
1
python
import math import numpy as np from skimage.morphology.convex_hull import convex_hull_image from scipy.ndimage.morphology import binary_dilation def check_grasp_margin(target_mask_heightmap, depth_heightmap): margin_mask = binary_dilation(target_mask_heightmap, iterations=10).astype(np.float32)-target_mask_heigh...
Review this code and list any quality issues.
[ { "issue": "Function 'check_push_target_oriented' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 19 }, { "issue": "Function 'check_push_target_oriented' is 31 lines long. Functions over 25 lines are harder to test and maint...
5
python
import hashlib from ecdsa.curves import Ed25519, SECP256k1 from .principal import Principal import ecdsa class Identity: def __init__(self, privkey = "", type = "ed25519", anonymous = False): privkey = bytes(bytearray.fromhex(privkey)) self.anonymous = anonymous if anonymous: r...
Review this code and list any quality issues.
[ { "issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 8 }, { "issue": "Function '__init__' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "...
2
python
from common_fixtures import * # NOQA from selenium import webdriver from selenium.webdriver.phantomjs.service import Service as PhantomJSService from requests.auth import AuthBase # test the github auth workflow USER_SCOPE = 'github_user' TEAM_SCOPE = 'github_team' ORG_SCOPE = 'github_org' class NewService(PhantomJS...
Review this code and list any quality issues.
[ { "issue": "Function 'config' is 30 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line": 27 }, { "issue": "Function 'github_request_code' is 41 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "minor", "line...
6
python
from helpers import * from plots import * from col_type_detector import * # from configs import * import warnings def generate_flomaster_plot(df, x="None", y=[], group_by=None, plot_type=None, x_axis=None, y_axis=None, title=None): """ Function generates interactive plot for given dataframe and columns ...
Review this code and list any quality issues.
[ { "issue": "Function 'generate_flomaster_plot' has cyclomatic complexity 46 (threshold: 5). Consider breaking it into smaller functions.", "severity": "critical", "line": 8 }, { "issue": "Function 'generate_flomaster_plot' is 90 lines long. Functions over 25 lines are harder to test and maintain...
3
python
from collections import defaultdict import pyvex from ..knowledge_plugins.xrefs import XRef, XRefType from ..engines.light import SimEngineLight, SimEngineLightVEXMixin from .propagator.vex_vars import VEXTmp from .propagator.values import Top from . import register_analysis from .analysis import Analysis from .forw...
Review this code and list any quality issues.
[ { "issue": "Function '_handle_Store' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 44 }, { "issue": "Function '_handle_data_offset_refs' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functio...
5
python
""" Copyright (c) Facebook, Inc. and its affiliates. """ import logging from typing import Dict, Tuple, Any, Optional from .dialogue_object import DialogueObject from memory_nodes import ObjectNode, RewardNode from .interpreter_helper import interpret_reference_object, ErrorWithResponse class PutMemoryHandler(Dialo...
Review this code and list any quality issues.
[ { "issue": "Function 'handle_triple' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 44 }, { "issue": "Function 'handle_triple' is 26 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "mi...
2
python
#!/usr/bin/env python3 # pyfu/flat.py """ Method for calculating the correction for the relative transmissions of the fibres using extracted sky flats. The OBJTYP term "flatness" was created to distinguish this correction from that of a true flatfield. """ import numpy as np import logging from astropy.io impo...
Review this code and list any quality issues.
[ { "issue": "Function 'main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 24 }, { "issue": "Function 'main' is 70 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "major", "line": ...
2
python
""" le script principale sert à annoter un répertoire de fichiers xml de recettes """ import glob import re import os from oper_utils import xml_to_recipe_annotated from Ner_classifieur_annote import load_crf_model, predict_text, transform_to_xml_annote from NER_ingredient_detector import get_content_from_xmlfile from...
Review this code and list any quality issues.
[ { "issue": "Function 'transform_doc_to_xml' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.", "severity": "major", "line": 26 }, { "issue": "Function 'parcours_corpus_annote' is 27 lines long. Functions over 25 lines are harder to test and maintain.", ...
2
python
# # Copyright 2018 Joachim Lusiardi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
Review this code and list any quality issues.
[ { "issue": "Function 'create_session' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.", "severity": "minor", "line": 58 }, { "issue": "Function 'create_session' is 31 lines long. Functions over 25 lines are harder to test and maintain.", "severity": "...
4