Showing 462 of 1,666 total issues
Function render
has 463 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const canRename = this.canRename();
const isClassroomProgramType = this.props.course.type === 'ClassroomProgramCourse';
const timelineDatesDiffer = this.props.course.start !== this.props.course.timeline_start || this.props.course.end !== this.props.course.timeline_end;
const eventSync = this.props.course.flags.event_sync;
File language_names.js
has 923 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// adapted from https://github.com/meikidd/iso-639-1/blob/master/src/data.js
const LanguageNames = {
aa: {
name: 'Afar',
Function ArticleFinder
has 334 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ArticleFinder = (props) => {
const [isSubmitted, setIsSubmitted] = useState(false);
const [showFilters, setShowFilters] = useState(false);
useEffect(() => {
Function renderGraph
has 300 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderGraph = () => {
if (articleData.length === 0) {
return;
}
Function CourseApproval
has 287 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const CourseApproval = (props) => {
const [selectedWikiExpert, setSelectedWikiExpert] = useState({});
const [selectedCampaigns, setSelectedCampaigns] = useState([]);
const [selectedTags, setSelectedTags] = useState([]);
const [createdTagOption, setCreatedTagOption] = useState([]);
File Survey.js
has 636 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
//--------------------------------------------------------
// Vendor Requirements [imports]
//--------------------------------------------------------
import { assign, throttle } from 'lodash-es';
import Rails from '@rails/ujs';
File api.js
has 607 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { capitalize } from './strings';
import logErrorMessage from './log_error_message';
import request from './request';
import { stringify } from 'query-string';
import Rails from '@rails/ujs';
Function render
has 260 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
if (this.props.loading) {
return <Loading />;
}
Function CourseForm
has 255 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const CourseForm = (props) => {
const handleWikiChange = (wiki) => {
const home_wiki = wiki.value;
const prev_wiki = { ...props.course.home_wiki };
const wikis = CourseUtils.normalizeWikis(
File details.jsx
has 583 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import Instructors from './instructors';
Function render
has 249 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const i18nPrefix = this.props.course.string_prefix;
let buttonClass = 'button dark';
buttonClass += this.state.isPersisting ? ' working' : '';
File statistic_update_info_utils.spec.js
has 523 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import '../testHelper';
import { getLastUpdateMessage, getFirstUpdateMessage, firstUpdateTime, lastSuccessfulUpdateMoment, nextUpdateExpected, getLastUpdateSummary, getTotaUpdatesMessage, getUpdateLogs } from '../../app/assets/javascripts/utils/statistic_update_info_utils';
describe('firstUpdateTime', () => {
test(
File settings_actions.js
has 512 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
SET_ADMIN_USERS, SET_SPECIAL_USERS,
SUBMITTING_NEW_SPECIAL_USER, REVOKING_SPECIAL_USER,
SUBMITTING_NEW_ADMIN, REVOKING_ADMIN, SET_COURSE_CREATION_SETTINGS,
Function Block
has 206 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Block = (props) => {
const updateBlock = (valueKey, value) => {
const toPass = { ...props.block };
toPass[valueKey] = value;
delete toPass.deleteBlock;
Function TrainingSlideHandler
has 199 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const TrainingSlideHandler = () => {
const training = useSelector(state => state.training);
const routeParams = useParams();
const navigate = useNavigate();
const dispatch = useDispatch();
Function List
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
Open
const List = ({
keys,
sortable,
table_key,
className,
- 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 a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
Open
render() {
const canRename = this.canRename();
const isClassroomProgramType = this.props.course.type === 'ClassroomProgramCourse';
const timelineDatesDiffer = this.props.course.start !== this.props.course.timeline_start || this.props.course.end !== this.props.course.timeline_end;
const eventSync = this.props.course.flags.event_sync;
- 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 articleFinder
has 183 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function articleFinder(state = initialState, action) {
switch (action.type) {
case UPDATE_FINDER_FIELD: {
const newState = { ...state };
newState[action.data.key] = action.data.value;
Survey
has 51 functions (exceeds 20 allowed). Consider refactoring. Open
Open
const Survey = {
currentBlock: 0,
submitted: [],
submittedAll: false,
File course_creator.jsx
has 459 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';