Showing 462 of 1,666 total issues
Function ArticleFinderSearchBar
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function ArticleFinderSearchBar({ value, onChange, onSearch, disabled, wiki }) {
const [suggestions, setSuggestions] = useState([]);
const [isAutocompleteLoading, setAutocompleteLoading] = useState(false);
let searchClass = 'article-finder-search-bar';
- 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 NewReplyForm
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const NewReplyForm = ({ ticket, currentUser }) => {
const dispatch = useDispatch();
const [replyDetails, setReplyDetails] = useState({
cc: '',
content: '',
- 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 CourseTypeSelector
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const CourseTypeSelector = (props) => {
const _getFormattedCourseType = (type) => {
return {
ClassroomProgramCourse: 'Wikipedia Student Program',
VisitingScholarship: 'Visiting Scholarship',
- 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 OverviewStats
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const OverviewStats = ({ course }) => {
const isWikidata = course.home_wiki.project === 'wikidata';
const isWikipedia = course.home_wiki.project === 'wikipedia';
const valueClass = (stat) => {
- 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 upgradeSpecialUser
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const upgradeSpecialUser = (username, position) => (dispatch) => {
// grant a user admin status
// username: user's username
dispatch({
type: SUBMITTING_NEW_SPECIAL_USER,
Function notifications
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function notifications(state = initialState, action) {
switch (action.type) {
case ADD_NOTIFICATION: {
const newState = [...state, action.notification];
Function studentListKeys
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const studentListKeys = (course) => {
const contentAddedKey = course.home_wiki_bytes_per_word ? wordsAddedKey : charactersAddedKey(course.home_wiki.project);
return {
username: {
Function scrollTo
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
scrollTo(name, scrollBox) {
this.bump = false;
const paragraphs = this.scrollObject[name].filteredParagraphs;
const length = paragraphs.length;
this.nextPosition = paragraphs[this.scrollObject[name].index].coordinates;
Function fetchPageRevisionScore
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fetchPageRevisionScore = async (revids, wiki, dispatch) => {
const query = pageRevisionScoreQueryGenerator(map(revids, (revid) => {
return revid.revisions[0].revid;
}), wiki.project);
Function SearchableCourseList
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SearchableCourseList = () => {
const [searchParams, setSearchParams] = useSearchParams();
const { results, loaded, sort } = useSelector(state => state.course_search_results);
const dispatch = useDispatch();
const searchRef = useRef();
Function PopoverExpandable
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const PopoverExpandable = function (Component) {
const wrappedComponent = createReactClass({
displayName: 'PopoverExpandable',
statics: {
Function popover
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
popover() {
const PopoverExample = createReactClass({
getInitialState() {
return {
open: false
Function InlineUsers
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const InlineUsers = (props) => {
const lastUserIndex = props.users.length - 1;
let userList = props.users.map((user, index) => {
let extraInfo = '';
const link = `/users/${user.username}`; // User profile page
Function fetchAll
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const fetchAll = async (API_URL, params, continue_str) => {
const allData = [];
let continueToken;
let hasMore = true;
while (hasMore) {
- 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 scrollTo
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
scrollTo(name, scrollBox) {
this.bump = false;
const paragraphs = this.scrollObject[name].filteredParagraphs;
const length = paragraphs.length;
this.nextPosition = paragraphs[this.scrollObject[name].index].coordinates;
- 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 sortByKey
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const sortByKey = (models, sortKey, previousKey = null, desc = false, absolute = false, refresh = false) => {
const sameKey = sortKey === previousKey;
let newKey;
if (sameKey) {
newKey = null;
- 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 fetchRevisionsFromUsers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const fetchRevisionsFromUsers = async (course, users, days, last_date, filter) => {
const usernames = users.map(user => user.username);
let revisions = [];
const wikiPromises = [];
- 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 getFilteredArticleFinder
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
[getArticleFinderState], (articleFinder) => {
return pickBy(articleFinder.articles, (article) => {
const language = articleFinder.home_wiki.language;
const project = articleFinder.home_wiki.project;
if (article.grade && !includes(Object.keys(PageAssessmentGrades[project][language]), article.grade)) {
- 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 ActiveCourseList
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const ActiveCourseList = ({ defaultCampaignOnly = true }) => {
const { isLoaded, courses, sort } = useSelector(state => state.active_courses);
const dispatch = useDispatch();
useEffect(() => {
- 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 users
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function users(state = initialState, action) {
switch (action.type) {
case RECEIVE_USERS: {
// Transform the 'real_name' for users in 'action' into separate 'first_name'
// and 'last_name' properties if 'real_name' is available by using transformUsers.