Showing 125 of 211 total issues
Function onDragHandler
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
GridItem.prototype.onDragHandler = function onDragHandler(handlerName) {
var _this2 = this;
return function (e, _ref2) {
var node = _ref2.node,
Function GenerateNewState
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected GenerateNewState(state: IMasterState): IMasterState {
const visualizer = state.AlgorithmVisualizerState.isEnabled
? new FindTimetableVisualizer()
: new NullFindTimetableVisualizer();
Function compactItem
has a Cognitive Complexity of 12 (exceeds 5 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.
- 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 validateLayout
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function validateLayout(layout, contextName) {
contextName = contextName || "Layout";
var subProps = ['x', 'y', 'w', 'h'];
if (!Array.isArray(layout)) throw new Error(contextName + " must be an array!");
for (var _i8 = 0, len = layout.length; _i8 < len; _i8++) {
- 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 render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public render() {
if (this.state.redirect) {
return <Redirect push={true} to="/play" />;
}
return (
Function OtherStuffDrawer
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const OtherStuffDrawer = (props: IOtherStuffDrawerProps) => {
const routerLink = (icon: any, text: string, to: string) => (
<Link style={linkStyle} to={to}>
<ListItem button={true} onClick={props.onItemClick}>
<ListItemIcon>{icon}</ListItemIcon>
Function Save
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected Save(timetable: Timetable) {
let html = (document.getElementById("timetable-view") as HTMLElement)
.outerHTML;
html = html.replace("display: none", "display: inline"); // display timetable summary
const data = `
Function ReleaseDisabledSubjectsIfPossible
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ReleaseDisabledSubjectsIfPossible(
selectedSubjects: Subject[],
allSubjects: Subject[]
): void {
const disabledSubjects = allSubjects.filter((s) => s.ClashReport !== null);
Function StackPanelProofOfConcept
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const StackPanelProofOfConcept = () => {
return (
<div>
<StackPanel
style={{
Function GenerateNewState
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected GenerateNewState(state: IMasterState): IMasterState {
const newClickedTimeConstraint =
state.SetTimeConstraintState.ClickedTimeConstraint.slice();
newClickedTimeConstraint[this.clickedBox.Day] ^= this.clickedBox.TimePeriod;
const newUidsOfClickedBox =
Function mapDispatchToProps
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const mapDispatchToProps = (dispatch: any): ITimetableListViewDispatchProps => {
const triggerfulDispatch = (action: MasterStateAction) => {
dispatch(action);
dispatch(new FindAlternativeSlotsOfCurrentSlots());
};
Function SelectSubject
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function SelectSubject(
subjectToBeSelected: Subject,
allSubjects: Subject[],
state: IMasterState
): IMasterState {
Function ParseRawSlotToSubject
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ParseRawSlotToSubject(slots: RawSlot[]): Subject[] {
const result = Array<Subject>();
const dic = new Array<IKeyValue<string, RawSlot[]>>();
slots
.filter((x) => IsReasonable(x) && IsParsable(x))
Function CreateEvent
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function CreateEvent(slot: RawSlot, semesterStartDate: Date) {
const semStartDate = new Date(semesterStartDate.getTime());
if (semStartDate.getDay() !== 1) {
throw new Error(
"Expected semesterStartDay to be Monday but was " +
Function correctBounds
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function correctBounds(layout, bounds) {
var collidesWith = getStatics(layout);
for (var _i4 = 0, len = layout.length; _i4 < len; _i4++) {
var l = layout[_i4];
// Overflows right
- 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 GenerateSlotAndDayLayouts
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function GenerateSlotAndDayLayouts(
rawSlots: ISlotViewModel[],
xOffset: number,
yOffset: number
): [ReactGridLayout.Layout[], ReactGridLayout.Layout[]] {
Function GetTimeRow
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private GetTimeRow(): JSX.Element[] {
const divStyle: React.CSSProperties = {
borderBottom: "1px solid",
borderRight: "1px solid",
height: "20.5px",
Function placeholder
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
ReactGridLayout.prototype.placeholder = function placeholder() {
var activeDrag = this.state.activeDrag;
if (!activeDrag) return null;
var _props3 = this.props,
Function slotViews
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const slotViews = slots.map((x, index) => {
return (
// "s" means "Slot"
<div key={"s" + index}>
<SlotView
Function GeneralizeSlot
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function GeneralizeSlot(originalSlots: RawSlot[]): RawSlot[] {
const slots = originalSlots.map(clone) as IRawSlot[];
const results = new Array<RawSlot>();
results.push(slots[0]);
let generalized: boolean;