Showing 81 of 81 total issues
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function build
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function fit_vocab
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def fit_vocab(
Avoid deeply nested control flow statements. Open
Open
if selection not in metrics:
raise KeyError(
f'Main metric {selection} is not a configured metric; '
f'available options are: {metrics.keys()}'
)
Function build
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build(
Function load_from_checkpoint
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def load_from_checkpoint(
Avoid deeply nested control flow statements. Open
Open
if selection not in metrics:
raise KeyError(
f'Main metric {selection} is not a configured metric; '
f'available options are: {list(metrics.keys())}'
)
Function predict
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def predict(
self,
source: List[str],
target: List[str],
alignments: List[str] = 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
Avoid deeply nested control flow statements. Open
Open
if word in v.stoi:
self.itos.append(word)
else:
Function forward
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def forward(self, batch_inputs, include_target_logits=False):
target_embeddings = self.embeddings[const.TARGET](batch_inputs[const.TARGET])
source_embeddings = self.embeddings[const.SOURCE](batch_inputs[const.SOURCE])
target_lengths = batch_inputs[const.TARGET].lengths
- 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 load_from_checkpoint
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def load_from_checkpoint(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function fit_vocab
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def fit_vocab(
Function fit_vocab
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def fit_vocab(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function forward
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def forward(self, embeddings_a, lengths_a, mask_a, embeddings_b, lengths_b):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function split_outputs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def split_outputs(
Function forward
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def forward(