WikiEducationFoundation/WikiEduDashboard

View on GitHub

Showing 462 of 1,666 total issues

Method unknown? has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def unknown?
    !created_claim? &&
      !changed_claim? &&
      !removed_claim? &&
      !added_alias? &&
Severity: Minor
Found in lib/wikidata_summary_parser.rb - About 1 hr to fix

    Function ButtonNavigation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const ButtonNavigation = (props) => {
      const dispatch = useDispatch();
    
      const {
        active, index, buttonLabel

      Function onSubmit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const onSubmit = (e, status, kind) => {
          e.preventDefault();
          if (isBlank(replyDetails.plainText)) {
            setReplyDetails(prevState => ({ ...prevState, sending: false }));
            return;
      Severity: Minor
      Found in app/assets/javascripts/components/tickets/new_reply_form.jsx - About 1 hr to fix

        Method to_question_params has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def to_question_params
              {
                :type => type,
                :question_group => question_group,
                :question_text  => question_text,
        Severity: Minor
        Found in config/initializers/surveys.rb - About 1 hr to fix

          Function userRoles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            userRoles(currentUser, users) {
              // Role values correspond to the CoursesUsers roles defined
              const roles = {};
              if (!currentUser) { return roles; }
              if (getFiltered(users, { id: currentUser.id, role: STUDENT_ROLE })[0]) {
          Severity: Minor
          Found in app/assets/javascripts/utils/user_utils.js - About 55 mins to fix

          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 findInView has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              findInView(name, paragraphs, length, scrollBox) {
                  const savedIndex = this.scrollObject[name].index - 1;
                  while (this.currentCoordinate !== null && this.isInView(scrollBox, this.currentCoordinate, this.nextPosition) === true) {
                      this.scrollObject[name].index += 1;
                      if (this.scrollObject[name].index >= length) {

          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 getInitialState has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            getInitialState() {
              // getting filters from the URL
              const { wiki, newness, tracked } = parse(this.props.router.location.search);
          
              // filter by "wiki"
          Severity: Minor
          Found in app/assets/javascripts/components/articles/article_list.jsx - About 55 mins to fix

          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 EmptyWeek has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const EmptyWeek = ({
            emptyTimeline,
            edit_permissions,
            usingCustomTitles,
            course,
          Severity: Minor
          Found in app/assets/javascripts/components/timeline/empty_week.jsx - About 55 mins to fix

          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 StudentRevisionsList has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export const StudentRevisionsList = ({ course, student, wikidataLabels, userRevisions }) => {
            const dispatch = useDispatch();
            const [isOpen, setIsOpen] = useState(false);
            const [namespace, setNamespace] = useState('all');
          
          

          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 AvailableArticle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export const AvailableArticle = ({ assignment, current_user, course, selectable }) => {
            const dispatch = useDispatch();
          
            const onSelectHandler = () => {
              const assignmentObj = {
          Severity: Minor
          Found in app/assets/javascripts/components/articles/available_article.jsx - About 55 mins to fix

          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 ArticleGraphs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const ArticleGraphs = ({ article }) => {
            const { id: article_id } = article;
          
            const [showGraph, setShowGraph] = useState(false);
            const [selectedRadio, setSelectedRadio] = useState('wp10_score');
          Severity: Minor
          Found in app/assets/javascripts/components/articles/article_graphs.jsx - About 55 mins to fix

          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 ArticlesHandler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const ArticlesHandler = (props) => {
            const [loading, setLoading] = useState(true);
          
            useEffect(() => {
              delayFetchAssignmentsAndArticles(props, () => setLoading(false));
          Severity: Minor
          Found in app/assets/javascripts/components/articles/articles_handler.jsx - About 55 mins to fix

          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 CourseAlert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const CourseAlert = (props) => {
            let componentsElement = null;
            let action = null;
          
            if (props.components) componentsElement = props.components;
          Severity: Minor
          Found in app/assets/javascripts/components/course/course_alert.jsx - About 55 mins to fix

          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 AvailableArticles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const AvailableArticles = (props) => {
            useEffect(() => {
              const project = props.course.home_wiki.project;
              document.title = `${props.course.title} - ${ArticleUtils.I18n('available', project)}`;
            }, []);
          Severity: Minor
          Found in app/assets/javascripts/components/articles/available_articles.jsx - About 55 mins to fix

          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 9 (exceeds 5 allowed). Consider refactoring.
          Open

            render() {
              if (!this.shouldShowDiff(this.props) || !this.props.revision) {
                return (
                  <div className={`tooltip-trigger ${this.props.showButtonClass}`}>
                    <button onClick={this.showDiff} aria-label="Open Diff Viewer" className="icon icon-diff-viewer"/>
          Severity: Minor
          Found in app/assets/javascripts/components/revisions/diff_viewer.jsx - About 55 mins to fix

          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 uploads has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function uploads(state = initialState, action) {
            switch (action.type) {
              case RECEIVE_UPLOADS: {
                const dataUploads = action.data.course.uploads;
                // Intial sorting by upload date
          Severity: Minor
          Found in app/assets/javascripts/reducers/uploads.js - About 55 mins to fix

          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 EditButton has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const EditButton = ({
            allowMultipleArticles, current_user, is_open, setHover, open, role, student,
            tooltip, tooltipIndicator, assignmentLength, project
          }) => {
            let assignText;
          Severity: Minor
          Found in app/assets/javascripts/components/common/AssignCell/AssignButton.jsx - About 55 mins to fix

          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 CampaignEditable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const CampaignEditable = ({ course_id }) => {
            const availableCampaigns = useSelector(state => getAvailableCampaigns(state));
            const campaigns = useSelector(state => state.campaigns.campaigns);
            const dispatch = useDispatch();
          
          
          Severity: Minor
          Found in app/assets/javascripts/components/overview/campaign_editable.jsx - About 55 mins to fix

          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 9 (exceeds 5 allowed). Consider refactoring.
          Open

            render() {
              const { course, current_user } = this.props;
          
              if (course.cloned_status === 1 || course.cloned_status === 3) {
                return (
          Severity: Minor
          Found in app/assets/javascripts/components/overview/overview_handler.jsx - About 55 mins to fix

          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

          Method set_articles_edited has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def set_articles_edited
              @articles_edited = {}
              @course.tracked_revisions.includes(:user, article: :wiki).each do |edit|
                # Skip if the Article record is missing
                next unless edit.article
          Severity: Minor
          Found in lib/analytics/course_articles_csv_builder.rb - About 55 mins to fix

          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

          Severity
          Category
          Status
          Source
          Language