Showing 1,205 of 1,252 total issues
Function renderCategoryCard
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static renderCategoryCard(category, orphanTabs, orphanAssessments) {
const hasOrphanAssessments =
orphanAssessments && orphanAssessments.length > 0;
const hasOrphanTabs = orphanTabs && orphanTabs.length > 0;
const categoryRow = category
- Create a ticketCreate a ticket
Function renderOptionsToDelete
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderOptionsToDelete = () => {
const shouldRenderOptionsToDelete =
deletedOptions && deletedOptions.length > 0;
if (!shouldRenderOptionsToDelete) {
return null;
- Create a ticketCreate a ticket
Function renderBody
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderBody = () => {
const { sections, canUpdate } = survey;
if (!canUpdate) return null;
if (!sections || sections.length < 1)
- Create a ticketCreate a ticket
Function Topic
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Topic = (props) => {
if (props.postIds.length === 0) {
return null;
}
- Create a ticketCreate a ticket
Function renderOutputStream
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static renderOutputStream(outputStreamType, output, showStaffOnlyWarning) {
return (
<Accordion
defaultExpanded={false}
disabled={!output}
- Create a ticketCreate a ticket
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { expanded } = this.state;
const { answerId, annotations, file, isUpdatingAnnotationAllowed } =
this.props;
const editorProps = {
- Create a ticketCreate a ticket
Method explanations_for_points_summary_incorrect
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def explanations_for_points_summary_incorrect(question, answer_text_array,
answer_text_lemma_status, correct_points, hash_point_serial)
explanations = []
question.groups.flat_map(&:points).each do |point|
- Create a ticketCreate a ticket
Function RollbarProvider
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const RollbarProvider = (props: RollbarProviderProps): JSX.Element => {
// TODO: To report user id as well after we move to SPA.
const rollbarConfig =
process.env.NODE_ENV === 'development'
? {}
- Create a ticketCreate a ticket
Function MuiTablePagination
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const MuiTablePagination = (props: PaginationProps): JSX.Element => {
const { t } = useTranslation();
const rowsPerPageOptions = useMemo(() => {
const options: RowsPerPageOptions = props.pages?.slice() ?? [];
- Create a ticketCreate a ticket
Function reducer
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(draft: AnnouncementsState, action: AnnouncementsActionType) => {
switch (action.type) {
case SAVE_ANNOUNCEMENT_LIST: {
const announcementList = action.announcementList;
const entityList = announcementList.map((data) => ({ ...data }));
- Create a ticketCreate a ticket
Function TopicList
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const TopicList: FC<TopicListProps> = (props) => {
const { listIsLoading, topicList } = props;
const { t } = useTranslation();
if (listIsLoading) {
- Create a ticketCreate a ticket
Function renderForm
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const renderForm = (): JSX.Element | null => {
if (type === 'subfolder' && folderInitialValues) {
return (
<FolderEdit
folderId={itemId}
- Create a ticketCreate a ticket
Function ConvertMcqMrqButton
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ConvertMcqMrqButton = (props: ConvertMcqMrqButtonProps): JSX.Element => {
const { for: question } = props;
const [converting, setConverting] = useState(false);
- Create a ticketCreate a ticket
Function handleTimelineChange
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const handleTimelineChange = (event): void => {
if (currentUser) {
const newTimeline = event.target.value;
const data: CourseUserEntity = {
...currentUser,
- Create a ticketCreate a ticket
Function SubmitEmptyFormButton
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SubmitEmptyFormButton: FC = () => {
const { t } = useTranslation();
const submission = useAppSelector(getSubmission);
const submissionFlags = useAppSelector(getSubmissionFlags);
- Create a ticketCreate a ticket
Function AutogradeSubmissionButton
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AutogradeSubmissionButton: FC = () => {
const { t } = useTranslation();
const dispatch = useAppDispatch();
const submission = useAppSelector(getSubmission);
- Create a ticketCreate a ticket
Function TestCasesHint
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const TestCasesHint = (): JSX.Element => {
const { t } = useTranslation();
return (
<>
- Create a ticketCreate a ticket
Function duplicate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const duplicate = async (duplicationUrl: string): Promise<void> => {
setDuplicating(true);
const toast = loadingToast(t(translations.duplicatingQuestion));
- Create a ticketCreate a ticket
Function ProgrammingFile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ProgrammingFile: FC<ProgrammingFileProps> = (props) => {
const {
answerId,
fieldName,
file,
- Create a ticketCreate a ticket
Function ErrorText
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
const ErrorText = ({ errors }) => {
if (
!errors ||
(errors.constructor === Object && Object.keys(errors).length === 0) ||
(errors.constructor === Array && errors.length === 0)
- Read upRead up
- Create a ticketCreate a ticket
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"