Showing 462 of 1,666 total issues
Function SummaryPanel
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SummaryPanel = (props) => {
const submit = () => {
props.submitWizard(props.courseId);
window.onbeforeunload = window.onbeforeunloadcache;
return props.router.navigate(`/courses/${props.courseId}/timeline`);
Function initRangeSliders
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
initRangeSliders() {
$('[data-range]').each((i, slider) => {
const $input = $(slider).next('[data-range-field]');
const min = parseInt($(slider).data('min'));
const max = parseInt($(slider).data('max'));
Function exports
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (env) => {
const mode = env.development ? 'development' : 'production';
const isProductionOrCI = env.production || env.coverage;
let devtool = 'eval-cheap-source-map';
// see https://webpack.js.org/configuration/devtool/ for the detailed descriptions of these
- 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 Option
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const Option = ({
index,
panel_index,
option,
open_weeks,
- 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 Nav
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const Nav = () => {
const {
rooturl: rootUrl,
logopath: logoPath,
fluid: fluidStr,
- 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
Method create_alerts
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create_alerts
@courses.each do |course|
next unless course.type == 'ClassroomProgramCourse'
next if course.students.empty?
next if Alert.exists?(course_id: course.id, type: 'FirstEnrolledStudentAlert')
- 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 initSlider
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
initSlider() {
this.$surveyContainer = $('[data-survey-form-container]');
this.parentSlider = this.$surveyContainer.slick(assign({}, slickOptions, { adaptiveHeight: false }));
this.parentSlider.on('init', (e, slick) => {
Function render
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { user } = this.props;
const adminLevel = user.permissions === 3
? 'Super Admin'
: 'Admin';
Function MainspaceChecklist
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const MainspaceChecklist = () => {
const [isVisible, setIsVisible] = useState(false);
const show = () => {
setIsVisible(true);
Function upgradeAdmin
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const upgradeAdmin = username => (dispatch) => {
// grant a user admin status
// username: user's username
dispatch({
type: SUBMITTING_NEW_ADMIN,
Function PeerReviewChecklist
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const PeerReviewChecklist = () => {
const [isVisible, setIsVisible] = useState(false);
const show = () => {
setIsVisible(true);
};
Function StatisticsUpdateModal
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const StatisticsUpdateModal = (props) => {
const course = props.course;
const helpMessage = Features.wikiEd ? I18n.t('metrics.wiki_ed_help') : I18n.t('metrics.outreach_help');
const updatesEndMoment = toDate(course.update_until);
const futureUpdatesRemaining = isAfter(updatesEndMoment, new Date());
Function Notifications
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Notifications = () => {
const dispatch = useDispatch();
const notifications = useSelector(state => state.newsNotifications);
const _handleClose = (notification) => {
Function Notifications
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Notifications = () => {
const dispatch = useDispatch();
const notifications = useSelector(state => state.notifications);
const _handleClose = (notification) => {
Function campaigns
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function campaigns(state = initialState, action) {
switch (action.type) {
case ADD_CAMPAIGN:
case DELETE_CAMPAIGN:
case RECEIVE_COURSE_CAMPAIGNS: {
Function saveTimeline
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async saveTimeline(courseId, data) {
const cleanObject = object => {
if (object.is_new) {
delete object.id;
delete object.is_new;
Function refreshData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const refreshData = (location, args, dispatch) => {
const {
lastUserRequestTimestamp,
courseSlug,
articlesLimit,
- 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 handleErrorNotification
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const handleErrorNotification = function (data) {
const notification = {};
notification.closable = true;
notification.type = 'error';
- 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 ModuleRow
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const ModuleRow = ({ isStudent, module, trainingLibrarySlug }) => {
const isTrainingModule = module.kind === TRAINING_MODULE_KIND;
const isExercise = module.kind === EXERCISE_KIND;
const isDiscussion = module.kind === DISCUSSION_KIND;
- 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 AddAvailableArticles
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const AddAvailableArticles = ({
course_id,
role,
project,
language,
- 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"