Showing 32 of 32 total issues
File zenodo.py
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
import calendar
import datetime as dt
import json
import os
import re
File typer_commands.py
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime as dt
import re
from dataclasses import asdict
from itertools import chain
from pathlib import Path
Similar blocks of code found in 2 locations. Consider refactoring. Open
dotm_df = dog_of_the_month_table.get_full_df().loc[
lambda df: df[DogOfTheMonth.winner.cid].isin(dog_df.index), :
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 44.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
comp_df = competition_table.get_full_df().loc[
lambda df: df[Competition.champion.cid].isin(dog_df.index), :
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 44.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function _parse_module
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _parse_module(self, module):
try:
base_id = CompleteIdBase.from_module_name(module.__name__, self.name)
except NotADzObject:
return
- 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_ns_mappers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _get_ns_mappers(self, data_only=True):
f_args = (self.runtime, self.sql_meta, self.engine, self._batch_size)
_mapped = set()
for ns in self.runtime.metadata.namespaces.values():
_mapped.add((self.runtime.name, ns.name))
- 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 git_run
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def git_run(
Function _ds_cls_to_feat_dicts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _ds_cls_to_feat_dicts(ds_cls: Union[EntityClass, CompositeType]):
feature_dict = get_feature_dict(ds_cls)
ids = []
props = []
for k, cls in feature_dict.items():
- 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__
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(
self,
entity: type[AbstractEntity],
entity_key_table_map: Optional[dict[str, "ScruTable"]] = None,
partitioning_cols: Optional[list[str]] = None,
Function add_obj
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_obj(self, obj):
for cls, l in [
(ScruTable, self.tables),
(SourceUrl, self.source_urls),
(PipelineElement, self.pipeline_elements),
- 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 add_stage
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_stage(cmd, name, outs_no_cache, outs, outs_persist, deps, params):
Function deposit_to_zenodo
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def deposit_to_zenodo(
Function get_data_envs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_data_envs(self, project, ns):
if project == self.name:
return [e.name for e in self.envs]
for iaf in self.imported_projects:
if iaf.name == project:
- 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 register
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def register(
Function __call__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __call__(self, df, parse=True, verbose=True, env=None, **kwargs):
Function import_dvc
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def import_dvc(uri, path, out, rev=None, no_exec=False):
Function validate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate(
Function sql_validation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def sql_validation(constr, env, draw=False, batch_size=2000, verbose=False):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, title, version, lines, private: bool) -> None:
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, conf: Config, private: bool, tag: str, test: bool = True):