Showing 3,604 of 10,782 total issues
Function post
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def post(self, exploration_id: str) -> None:
"""Handles POST requests.
Args:
exploration_id: str. The ID of the exploration.
- 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 getCustomizationArgsWarnings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getCustomizationArgsWarnings(
customizationArgs: RatioExpressionInputCustomizationArgs
): Warning[] {
var isNonNegativeInt = function (number: number) {
return number % 1 === 0 && number >= 0;
- 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 setMode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
setMode(mode: number): void {
this.state.currentMode = mode;
if (this.isMobile) {
if (this.state.currentMode === this._MODES.ADD_EDGE) {
this.helpText = 'I18N_INTERACTIONS_GRAPH_EDGE_INITIAL_HELPTEXT';
- 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 onTouchInitialVertex
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
onTouchInitialVertex(index: number): void {
if (this.state.currentMode === this._MODES.ADD_EDGE) {
if (this.canAddEdge) {
this.beginAddEdge(index);
this.helpText = 'I18N_INTERACTIONS_GRAPH_EDGE_FINAL_HELPTEXT';
- 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 getEdgeColor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getEdgeColor(index: number): string {
if (!this.interactionIsActive) {
return this.DEFAULT_COLOR;
}
if (
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get(self) -> None:
"""Handles GET requests."""
assert self.normalized_request is not None
exp_ids = self.normalized_request['stringified_exp_ids']
include_private_exps = self.normalized_request.get(
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
init(): void {
this.initButtons();
this.state.currentMode = this.buttons[0].mode;
if (this.isMobile) {
if (this.state.currentMode === this._MODES.ADD_EDGE) {
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get(self, exploration_id: str) -> None:
"""Handles GET requests."""
assert self.normalized_request is not None
collection_id = self.normalized_request.get('collection_id')
include_system_recommendations = self.normalized_request[
- 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 test_story_publish_and_unpublish
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def test_story_publish_and_unpublish(self) -> None:
# Check that admins can publish a story.
self.login(self.CURRICULUM_ADMIN_EMAIL)
csrf_token = self.get_new_csrf_token()
- 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 _generate_dummy_skill_and_questions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _generate_dummy_skill_and_questions(self) -> None:
"""Generate and loads the database with a skill and 15 questions
linked to the skill.
Raises:
- 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_package_file_contents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_package_file_contents(
package: str, filepath: str, *, binary_mode: bool = False
) -> Union[str, bytes]:
"""Open file and return its contents. This needs to be used for files that
are loaded by the Python code directly, like constants.ts or
- 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 areAdjacencyMatricesEqualWithPermutation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
areAdjacencyMatricesEqualWithPermutation(
adj1: AdjacencyMatrix,
adj2: AdjacencyMatrix,
permutation: number[]
): boolean {
- 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 predict
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
predict(classifierBuffer: ArrayBuffer, textInput: InteractionAnswer): number {
// The model_json attribute in TextClassifierFrozenModel class can't be
// changed to camelcase since the class definition is automatically compiled
// with the help of protoc.
const classifierData = JSON.parse(
- 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 isAcyclic
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private isAcyclic(graph: GraphAnswer): boolean {
// Uses depth first search to ensure that we never have an edge to an
// ancestor in the search tree.
var nodeStatus = graph.vertices.map(() => {
return this.gus.DFS_STATUS.UNVISITED;
- 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 getCustomizationArgsWarnings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getCustomizationArgsWarnings(
customizationArgs: EndExplorationCustomizationArgs
): Warning[] {
var warningsList = [];
this.baseInteractionValidationServiceInstance.requireCustomizationArguments(
- 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 onToggleCheckbox
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
onToggleCheckbox(): void {
this.newQuestion = false;
this.selectionCount = Object.keys(this.userSelections).filter(
obj => this.userSelections[obj]
).length;
- 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 hasDuplicates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private hasDuplicates(answer: SetInputAnswer): boolean {
for (var i = 0; i < answer.length; i++) {
for (var j = 0; j < i; j++) {
if (eq(answer[i], answer[j])) {
return true;
- 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 submitAnswer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
submitAnswer(): void {
try {
if (
this.answer.trim() === '' &&
this.currentInteractionService.showNoResponseError()
- 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 initMarkers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private initMarkers(editor) {
var doc = editor.getDoc();
// The -1 here is because prepended code ends with a newline.
var preCodeNumLines = this.preCode.split('\n').length - 1;
- 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 validateNumericString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
validateNumericString(
value: string,
decimalSeparator: string
): string | undefined {
value = value.toString().trim();
- 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"