Showing 125 of 211 total issues
Function DeselectSubject
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function DeselectSubject(
subjectToBeDeselected: Subject,
allSubjects: Subject[],
state: IMasterState
): IMasterState {
Function GenerateNewState
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected GenerateNewState(state: IMasterState): IMasterState {
const targetSubject = find(state.SubjectListState.Subjects, {
Code: this.subjectCode,
}) as Subject;
let selectedSlotsCount = 0;
Function findSisterSlots
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function findSisterSlots(
slotsOfCurrentTimetable: IRawSlot[],
allSlots: IRawSlot[]
): IRawSlot[] {
const currentSlotsAsBigSlots = slotsOfCurrentTimetable.map((x) =>
Function moveElement
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function moveElement(layout, l, x, y, isUserAction, preventCollision, compactType, cols) {
if (l.static) return layout;
// Short-circuit if nothing to do.
if (l.y === y && l.x === x) return layout;
Function GenerateNewState
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected GenerateNewState(state: IMasterState): IMasterState {
const [filtrate, residue] = Filter(
state.TimetableListState.FiltrateTimetables,
this.clickedState
);
Function Legend
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Legend = (props: ILegendProps) => {
const background = () => {
switch (props.type) {
case "red":
return ColorOfDefinitelyOccupied;
Function LoadSlotsFromUrl
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const LoadSlotsFromUrl = (
downloadUrl: string,
fileType: string,
started: () => void,
successed: (loadedSlots: IRawSlot[]) => void,
Function Defilter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function Defilter(
residueTimetables: IGroupedTimetable[],
clickedTimeConstraint: number[]
): [IGroupedTimetable[], IGroupedTimetable[]] {
if (clickedTimeConstraint.length !== 7) {
- 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 GenerateAlternateSlotViewsAndDayColumn
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function GenerateAlternateSlotViewsAndDayColumn(
slots: ISlotViewModel[],
handleSelectSlotChoice: (slotUid: number, newSlotChoice: number) => void,
handleGoToThisAlternateSlot: (slotUid: number) => void,
isShowingAlternativeSlotOf: ISlotViewModel
Function GetDayColumn
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private GetDayColumn(): JSX.Element[] {
const days = [" ", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"];
const firstDivStyle: React.CSSProperties = {
borderRight: "1px solid",
display: "table",
Function constructor
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor(props: ISelectCourseViewDispatchProps) {
super(props);
this.state = {
currentSuggestions: [],
redirect: false,
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public render() {
const paperStyle: React.CSSProperties = {
overflowY: "auto",
paddingTop: "15px",
paddingRight: "40px",
Function compactItem
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function compactItem(compareWith, l, compactType, cols) {
var compactV = compactType === 'vertical';
var compactH = compactType === 'horizontal';
if (compactV) {
// Bottom 'y' possible is the bottom of the layout.
Function GenerateNewState
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected GenerateNewState(state: IMasterState): IMasterState {
const route = state.SettingsState.SearchByConsideringWeekNumber
? "ungeneralized"
: "generalized";
const router = new DataRouter<ObjectStore<RawSlot>>();
Function StringifyTotalMatrix
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function StringifyTotalMatrix(totalMatrix: STCBox[]): string {
const getRow = () => Array(TimePeriod.GetNumberOfHalfHours());
const data = [
getRow(),
getRow(),
Function GenerateNewState
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected GenerateNewState(state: IMasterState): IMasterState {
const sourceSlot = state.TimetableListState.SlotViewModelStore.GetOne(
this.sourceSlotUid
);
if (!sourceSlot) {
Function synchronizeLayoutWithChildren
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function synchronizeLayoutWithChildren(initialLayout, children, cols, compactType) {
return initialLayout; // Added this line
initialLayout = initialLayout || [];
// Generate one layout item per child.
Function moveElement
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function moveElement(layout, l, x, y, isUserAction, preventCollision, compactType, cols) {
Function GetTimeRow
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private GetTimeRow(): JSX.Element[] {
const divStyle: React.CSSProperties = {
borderBottom: "1px solid",
borderRight: "1px solid",
height: "20.5px",
- 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 PartitionizeByKey
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function PartitionizeByKey<T>(input: T[], keyName: string): T[][] {
if (input.length === 0) {
return [];
}
const result = new Array<T[]>();
- 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"